biograph (biograph)

Create biograph object

Syntax

BGobj = biograph(CMatrix)
BGobj = biograph(CMatrix, NodeIDs)

Arguments

CMatrixConnection 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.
NodeIdsNode 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.

Description

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 PropertyDescription
ID Enter a character string.
LabelEnter a character string.
DescriptionDescription of the graph. Enter text.
LayoutType Algorithm for the layout engine. Enter 'hierarchical'(default), 'equilibrium', 'radial'.
EdgeTypeEnter '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.
LayoutScaleProperty to scale the size of the nodes before calling the layout engine. Enter a positive number.
ShowArrowsProperty to control showing arrows with the edges. Enter either 'on' (default) or 'off'.
NodeAutoSizeProperty to control precalculating the node size before calling the layout engine. Enter either 'on' or 'off'.
NodeCallbackUser callback for all nodes. Enter the name of a function or a function handle. Default is 'display'.
EdgeCallbackUser callback for all edges. Enter the name of a function or function handle. Default is 'display'.
NodesColumn vector with handles to nodes. Size of vector is NumberOfNodes x 1. For properties of the Nodes property, see the table below.
EdgesColumn 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

IDCharacter string defined when the biograph object is created. Node IDs must be unique. Read-only.
LabelUser defined label for a node on a graph. Enter a character string. The default value is the ID property.
DescriptionDescription of the node. Enter text.
PositionTwo element numeric vector of x and y coordinates computed by the layout engine. The default is []. For example, [150 150].
ShapeEnter 'box'(default), 'ellipse', 'circle', 'rect', 'rectangle', 'diamond', 'trapezium', 'house', 'invtrapezium', 'inverse', 'parallelogram'.
SizeTwo 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].
ColorRGB three element numeric vector. Default is [1 1 0.7].
LineWidthPositive number. Default is 1.
LineColorRGB three element numeric vector. Default is [0.3 0.3 1].
FontSizePositive number. Default is 8 pts.
TextColorRGB three element numeric vector. Default is [0 0 0].

Properties of the Edge Property

IDCharacter string defined when the biograph object is created. Edge IDs must be unique. Read-only.
LabelLabel for a node on a graph. Enter a string.
DescriptionDescription for a node. Enter a text.
LineWidthPositive number. Default is 1.
LineColorRGB three element numeric vector. Default is [0.5 0.5 0.5].
Visible Enter either true or false.

Method Summary

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

Example

  1. 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'
  2. 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.

See Also

Bioinformatics Toolbox methods for the object biograph, biograph, dolayout, getancestors, getdescendants, getedgesbynodeid, getnodesbyid, getrelatives, view

MATLAB functions get, set


© 1994-2005 The MathWorks, Inc.