Calculate node positions and edge trajectories
dolayout(BGobj, 'Paths', PathsOnlyValue)
|BGobj||Biograph object created by the biograph function (object constructor).|
|PathsOnlyValue||Controls the calculation of only the edge paths, leaving the nodes at their current positions. Choices are true or false (default).|
dolayout(BGobj) calls the layout engine to calculate the optimal position for each node so that its 2-D rendering is clean and uncluttered, and then calculates the best curves to represent the edges. The layout engine uses the following properties of the biograph object:
LayoutType — Specifies the layout engine as 'hierarchical', 'equilibrium', or 'radial'.
LayoutScale — Rescales the sizes of the node before calling the layout engine. This gives more space to the layout and reduces the overlapping of nodes.
NodeAutoSize — Controls precalculating the node size before calling the layout engine. When NodeAutoSize is set to 'on', the layout engine uses the node properties FontSize and Shape, and the biograph object property LayoutScale to precalculate the actual size of each node. When NodeAutoSize is set to 'off', the layout engine uses the node property Size.
For more information on the above properties, see Properties of a Biograph Object. For an example of accessing and specifying the above properties of a biograph object, see Create a Biograph object, specify and access its properties.
This example shows how to create a biograph object and calculate node positions and edge trajectories.
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]; bg = biograph(cm)
Biograph object with 5 nodes and 9 edges.
Nodes do not have positions yet.
ans = 
Call the layout engine and render the graph.
ans = 98 206
Manually modify a node position and recalculate the paths only.
bg.nodes(1).Position = [150 150]; dolayout(bg, 'Pathsonly', true); view(bg)