radial_tree_layout

radial_tree_layout#

graph_tool.draw.radial_tree_layout(g, root, rel_order=None, rel_order_leaf=False, weighted=False, node_weight=None, r=1.0)[source]#

Computes a radial layout of the graph according to the minimum spanning tree centered at the root vertex.

Parameters:
gGraph

Graph to be used.

rootVertex or int

The root of the radial tree.

rel_orderVertexPropertyMap (optional, default: None)

Relative order of the nodes at each respective branch.

rel_order_leafbool (optional, default: False)

If True, the relative order of the leafs will propagate to the root. Otherwise they will propagate in the opposite direction.

weightedbool (optional, default: False)

If true, the angle between the child branches will be computed according to weight of the entire sub-branches.

node_weightVertexPropertyMap (optional, default: None)

If given, the relative spacing between leafs will correspond to the node weights.

rfloat (optional, default: 1.)

Layer spacing.

Returns:
posVertexPropertyMap

A vector-valued vertex property map with the coordinates of the vertices.

Notes

This algorithm has complexity \(O(V + E)\), or \(O(V\log V + E)\) if rel_order is given.

Examples

>>> g = gt.price_network(1000)
>>> pos = gt.radial_tree_layout(g, g.vertex(0))
>>> gt.graph_draw(g, pos=pos, output="graph-draw-radial.pdf")
<...>
../_images/graph-draw-radial.png

Radial tree layout of a Price network.#