prefectTree method
Creates a perfectly balanced tree of height
and a branching factor of
arity
. In the resulting tree all leaf nodes are at the same depth.
Implementation
Graph<V, E> prefectTree({required int height, int arity = 2}) => completeTree(
vertexCount: arity == 1
? height + 1
: (pow(arity, height + 1) - 1) ~/ (arity - 1),
arity: arity,
);