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:
- g
Graph
Graph to be used.
- root
Vertex
orint
The root of the radial tree.
- rel_order
VertexPropertyMap
(optional, default:None
) Relative order of the nodes at each respective branch.
- rel_order_leaf
bool
(optional, default:False
) If
True
, the relative order of the leafs will propagate to the root. Otherwise they will propagate in the opposite direction.- weighted
bool
(optional, default:False
) If true, the angle between the child branches will be computed according to weight of the entire sub-branches.
- node_weight
VertexPropertyMap
(optional, default:None
) If given, the relative spacing between leafs will correspond to the node weights.
- r
float
(optional, default:1.
) Layer spacing.
- g
- Returns:
- pos
VertexPropertyMap
A vector-valued vertex property map with the coordinates of the vertices.
- pos
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") <...>