| Bioinformatics Toolbox | ![]() |
Create biograph object
BGobj = biograph(CMatrix)
BGobj = biograph(CMatrix, NodeIDs)
| CMatrix | Connection matrix. Enter a square matrix that is full or sparse. For a square matrix the number of rows is equal to the number of nodes. A value of 1 indicates a connection to a node while a 0 indicates no connection. |
| NodeIds | Node identification strings. Enter a cell array of strings with the same number of strings as the number of rows/columns in the connection matrix (CMatrix). Default values are the row/column numbers. |
BGobj = biograph(CMatrix) creates a graph object (BGobj) using a connection matrix (CMatrix). All nondiagonal and positive entries in the connection matrix (CMatrix) indicate connected nodes, rows represent the source nodes, and columns represent the sink nodes.
A biograph (BGobj) has two properties (Nodes, Edges) that have their own properties.
BGobj = biograph(CMatrix, NodeIDs) specifies the node identification strings (NodeIDs).
Access properties of a biograph object with BGobj.propertyname, BGobj.propertyname.propertyname, or with the get and set commands.
Properties for the Object Biograph
| Biograph Property | Description |
|---|---|
| ID | Enter a character string. |
| Label | Enter a character string. |
| Description | Description of the graph. Enter text. |
| LayoutType | Algorithm for the layout engine. Enter 'hierarchical'(default), 'equilibrium', 'radial'. |
| EdgeType | Enter 'straight', 'curved'(default), 'segmented'. Curved or segmented edges occur only when necessary to avoid obstruction by nodes. Graphs with LayoutType equal to 'equilibrium' or 'Radial' cannot produce curved or segmented edges. |
| Scale | Property to post-scale the node coordinates. Enter a positive number. |
| LayoutScale | Property to scale the size of the nodes before calling the layout engine. Enter a positive number. |
| ShowArrows | Property to control showing arrows with the edges. Enter either 'on' (default) or 'off'. |
| NodeAutoSize | Property to control precalculating the node size before calling the layout engine. Enter either 'on' or 'off'. |
| NodeCallback | User callback for all nodes. Enter the name of a function or a function handle. Default is 'display'. |
| EdgeCallback | User callback for all edges. Enter the name of a function or function handle. Default is 'display'. |
| Nodes | Column vector with handles to nodes. Size of vector is NumberOfNodes x 1. For properties of the Nodes property, see the table below. |
| Edges | Column vector with handles to edges. Size of
vector is NumberOfEdges x 1. For properties of the Edges property, see the table below. |
Properties of the Nodes Property
| ID | Character string defined when the biograph object is created. Node IDs must be unique. Read-only. |
| Label | User defined label for a node on a graph. Enter a character string. The default value is the ID property. |
| Description | Description of the node. Enter text. |
| Position | Two element numeric vector of x and y coordinates computed by the layout engine. The default is []. For example, [150 150]. |
| Shape | Enter 'box'(default), 'ellipse', 'circle', 'rect', 'rectangle', 'diamond', 'trapezium', 'house', 'invtrapezium', 'inverse', 'parallelogram'. |
| Size | Two element numeric vector calculated before calling the layout engine using the actual font size and shape of the node. The default value is [10 10]. |
| Color | RGB three element numeric vector. Default is [1 1 0.7]. |
| LineWidth | Positive number. Default is 1. |
| LineColor | RGB three element numeric vector. Default is [0.3 0.3 1]. |
| FontSize | Positive number. Default is 8 pts. |
| TextColor | RGB three element numeric vector. Default is [0 0 0]. |
Properties of the Edge Property
| ID | Character string defined when the biograph object is created. Edge IDs must be unique. Read-only. |
| Label | Label for a node on a graph. Enter a string. |
| Description | Description for a node. Enter a text. |
| LineWidth | Positive number. Default is 1. |
| LineColor | RGB three element numeric vector. Default is [0.5 0.5 0.5]. |
| Visible | Enter either true or false. |
| biograph (biograph) | Create biograph object |
| dolayout (biograph) | Calculate node positions and edge trajectories |
| getancestors (biograph) | Find ancestors in a biograph object |
| getdescendants (biograph) | Find descendants in a biograph object |
| getedgesbynodeid (biograph) | Get handles to edges in graph |
| getnodesbyid (biograph) | Get handles to nodes |
| getrelatives (biograph) | Find relatives in a biograph object |
| view (biograph) | Draw figure from biograph object |
Create a biograph object.
cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0];
bg1 = biograph(cm)
get(bg1.nodes,'ID')
ans =
'Node 1'
'Node 2'
'Node 3'
'Node 4'
'Node 5'Create a biograph object and assign the node IDs.
cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0];
ids = {'M30931','L07625','K03454','M27323','M15390'};
bg2 = biograph(cm,ids);
get(bg2.nodes,'ID');
view(bg2);

In bg1.Node, the properties ID and Label are set to the same value. However, you can only modify the Label field. Node.ID is used internally to identify the nodes.
Bioinformatics Toolbox methods for the object biograph, biograph, dolayout, getancestors, getdescendants, getedgesbynodeid, getnodesbyid, getrelatives, view
MATLAB functions get, set
| baselookup | blastncbi | ![]() |
© 1994-2005 The MathWorks, Inc.