Main Content

biograph

(Removed) Create biograph object

biograph has been removed. Use graph or digraph instead. For details, see Version History.

Syntax

BGobj = biograph(CMatrix)
BGobj = biograph(CMatrix, NodeIDs)
BGobj = biograph(CMatrix, NodeIDs, ...'ID', IDValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'Label', LabelValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'Description', DescriptionValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'LayoutType', LayoutTypeValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'EdgeType', EdgeTypeValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'Scale', ScaleValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'LayoutScale', LayoutScaleValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'EdgeTextColor', EdgeTextColorValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'EdgeFontSize', EdgeFontSizeValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'ShowArrows', ShowArrowsValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'ArrowSize', ArrowSizeValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'ShowWeights', ShowWeightsValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'ShowTextInNodes', ShowTextInNodesValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'NodeAutoSize', NodeAutoSizeValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'NodeCallback', NodeCallbackValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'EdgeCallback', EdgeCallbackValue, ...)
BGobj = biograph(CMatrix, NodeIDs, ...'CustomNodeDrawFcn', CustomNodeDrawFcnValue, ...)

Arguments

CMatrixFull or sparse square matrix that acts as a connection matrix. That is, a value of 1 indicates a connection between nodes while a 0 indicates no connection. The number of rows/columns is equal to the number of nodes.
NodeIDs

Node labels. Enter any of the following:

  • Cell array of character vectors or string vector with the number of character vectors (or strings) equal to the number of rows or columns in the connection matrix CMatrix. Each character vector (or string) must be unique.

  • Character array with the number of rows equal to the number of nodes. Each row in the array must be unique.

  • Character vector or string with the number of characters equal to the number of nodes. Each character must be unique.

Default values are the row or column numbers.

Note

You must specify NodeIDs if you want to specify property name/value pairs. Set NodeIDs to [] to use the default values of the row/column numbers.

IDValue Character vector or string to identify the biograph object. Default is ''.
LabelValueCharacter vector or string to label the biograph object. Default is ''.
DescriptionValueCharacter vector or string that describes the biograph object. Default is ''.
LayoutTypeValue

Character vector or string that specifies the algorithm for the layout engine. Choices are:

  • 'hierarchical' (default) — Uses a topological order of the graph to assign levels, and then arranges the nodes from top to bottom, while minimizing crossing edges.

  • 'radial' — Uses a topological order of the graph to assign levels, and then arranges the nodes from inside to outside of the circle, while minimizing crossing edges.

  • 'equilibrium' — Calculates layout by minimizing the energy in a dynamic spring system.

EdgeTypeValue

Character vector or string that specifies how edges display. Choices are:

  • 'straight'

  • 'curved' (default)

  • 'segmented'

Note

Curved or segmented edges occur only when necessary to avoid obstruction by nodes. Biograph objects with LayoutType equal to 'equilibrium' or 'radial' cannot produce curved or segmented edges.

ScaleValue Positive number that post-scales the node coordinates. Default is 1.
LayoutScaleValuePositive number that scales the size of the nodes before calling the layout engine. Default is 1.
EdgeTextColorValueThree-element numeric vector of RGB values. Default is [0, 0, 0], which defines black.
EdgeFontSizeValuePositive number that sets the size of the edge font in points. Default is 8.
ShowArrowsValueControls the display of arrows for the edges. Choices are 'on' (default) or 'off'.
ArrowSizeValuePositive number that sets the size of the arrows in points. Default is 8.
ShowWeightsValueControls the display of text indicating the weight of the edges. Choices are 'on' or 'off' (default).
ShowTextInNodesValue

Character vector or string that specifies the node property used to label nodes when you display a biograph object using the view method. Choices are:

  • 'Label' — Uses the Label property of the node object (default).

  • 'ID' — Uses the ID property of the node object.

  • 'None'

NodeAutoSizeValueControls precalculating the node size before calling the layout engine. Choices are 'on' (default) or 'off'.

Note

Set it to off if you want to apply different node sizes by changing the Size property.

NodeCallbackValueUser callback for all nodes. Enter the name of a function, a function handle, or a cell array with multiple function handles. After using the view function to display the biograph in the Biograph Viewer, you can double-click a node to activate the first callback, or right-click and select a callback to activate. Default is @(node) inspect(node), which displays the Property Inspector dialog box.
EdgeCallbackValueUser callback for all edges. Enter the name of a function, a function handle, or a cell array with multiple function handles. After using the view function to display the biograph object in the Biograph Viewer, you can right-click and select a callback to activate. Default is the anonymous function, @(edge) inspect(edge), which displays the Property Inspector dialog box.
CustomNodeDrawFcnValueFunction handle to a customized function to draw nodes. Default is [].

Description

BGobj = biograph(CMatrix) creates a biograph 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.

BGobj = biograph(CMatrix, NodeIDs) specifies the node labels. NodeIDs can be:

  • Cell array of character vectors or string vector with the number of character vectors (or strings) equal to the number of rows or columns in the connection matrix CMatrix. Each character vector or string must be unique.

  • Character array with the number of rows equal to the number of nodes. Each row in the array must be unique.

  • Character vector or string with the number of characters equal to the number of nodes. Each character must be unique.

Default values are the row or column numbers.

Note

If you want to specify property name/value pairs, you must specify NodeIDs. Set NodeIDs to [] to use the default values of the row/column numbers.

BGobj = biograph(..., 'PropertyName', PropertyValue, ...) calls biograph with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:

BGobj = biograph(CMatrix, NodeIDs, ...'ID', IDValue, ...) specifies an ID for the biograph object. Default is ''.

BGobj = biograph(CMatrix, NodeIDs, ...'Label', LabelValue, ...) specifies a label for the biograph object. Default is ''.

BGobj = biograph(CMatrix, NodeIDs, ...'Description', DescriptionValue, ...) specifies a description of the biograph object. Default is ''.

BGobj = biograph(CMatrix, NodeIDs, ...'LayoutType', LayoutTypeValue, ...) specifies the algorithm for the layout engine.

BGobj = biograph(CMatrix, NodeIDs, ...'EdgeType', EdgeTypeValue, ...) specifies how edges display.

BGobj = biograph(CMatrix, NodeIDs, ...'Scale', ScaleValue, ...) post-scales the node coordinates. Default is 1.

BGobj = biograph(CMatrix, NodeIDs, ...'LayoutScale', LayoutScaleValue, ...) scales the size of the nodes before calling the layout engine. Default is 1.

BGobj = biograph(CMatrix, NodeIDs, ...'EdgeTextColor', EdgeTextColorValue, ...) specifies a three-element numeric vector of RGB values. Default is [0, 0, 0], which defines black.

BGobj = biograph(CMatrix, NodeIDs, ...'EdgeFontSize', EdgeFontSizeValue, ...) sets the size of the edge font in points. Default is 8.

BGobj = biograph(CMatrix, NodeIDs, ...'ShowArrows', ShowArrowsValue, ...) controls the display of arrows for the edges. Choices are 'on' (default) or 'off'.

BGobj = biograph(CMatrix, NodeIDs, ...'ArrowSize', ArrowSizeValue, ...) sets the size of the arrows in points. Default is 8.

BGobj = biograph(CMatrix, NodeIDs, ...'ShowWeights', ShowWeightsValue, ...) controls the display of text indicating the weight of the edges. Choices are 'on' (default) or 'off'.

BGobj = biograph(CMatrix, NodeIDs, ...'ShowTextInNodes', ShowTextInNodesValue, ...) specifies the node property used to label nodes when you display a biograph object using the view method.

BGobj = biograph(CMatrix, NodeIDs, ...'NodeAutoSize', NodeAutoSizeValue, ...) controls precalculating the node size before calling the layout engine. Choices are 'on' (default) or 'off'.

BGobj = biograph(CMatrix, NodeIDs, ...'NodeCallback', NodeCallbackValue, ...) specifies user callback for all nodes.

BGobj = biograph(CMatrix, NodeIDs, ...'EdgeCallback', EdgeCallbackValue, ...) specifies user callback for all edges.

BGobj = biograph(CMatrix, NodeIDs, ...'CustomNodeDrawFcn', CustomNodeDrawFcnValue, ...) specifies function handle to customized function to draw nodes. Default is [].

Version History

Introduced in R2006a

expand all

R2022b: biograph has been removed

biograph has been removed. See the following table for alternative functions from graph and digraph objects.

Methods of biographAlternative Functions from graph and digraph Objects
allshortestpaths (biograph)distances
conncomp (biograph)conncomp
dolayout (biograph)Not applicable
getancestors (biograph)predecessors. Note that the function does not let you specify NumGenerations. You can use distances to find the distances from all nodes to the target node after setting the edge weight to 1, and filter the nodes by distance to the appropriate depth.
getdescendants (biograph)successors. If you need to specify NumGenerations, see the workaround listed above for predecessors.
getedgesbynodeid (biograph)findedge
getmatrix (biograph)adjacency
getnodesbyid (biograph)findnode
getrelatives (biograph)neighbors
getweightmatrix (biograph)adjacency
isdag (biograph)isdag
isomorphism (biograph)isomorphism
isspantree (biograph) A graph is a spanning tree if and only if all nodes are reachable from an arbitrary start node, and |E| == |N| - 1, where E is the number of edges and N is the number of nodes. You can use either bfsearch or dfsearch to check such conditions are true for a given graph.
maxflow (biograph)maxflow
minspantree (biograph)minspantree
shortestpath (biograph)shortestpath
topoorder (biograph)toposort
traverse (biograph)bfsearch or dfsearch
view (biograph)plot. The name-value arguments of the plot function can be used to control the properties of the graph. The arguments can be used as replacements for many of the biograph object properties to change the appearance of the graph.

See Also

|