aryagraph.generators.classic.balanced_tree#
- aryagraph.generators.classic.balanced_tree(r: int, h: int, *, directed: bool = False) Graph[source]#
Perfectly balanced
r-ary tree of heighth.Nodes are numbered breadth-first from the root
0; nodei’s children arer·i + 1 … r·i + r. There are(r^(h+1) - 1) / (r - 1)nodes (h + 1whenr = 1). Directed arcs point from parent to child.