pub fn symmetric_tree(branches: &[u32], mode: TreeMode) -> IgraphResult<Graph>Expand description
Build a symmetric tree where each vertex at depth d has
branches[d] children.
Vertex 0 is the root. Children at each level are added in BFS
order, and the per-level branching count is read from branches.
Empty branches yields the singleton tree on one vertex.
§Errors
IgraphError::InvalidArgument— any entry ofbranchesis zero (a zero branching count yields a degenerate tree with no vertices at the next level, which upstream rejects).IgraphError::InvalidArgument— vertex count overflowsu32.
§Examples
use rust_igraph::{symmetric_tree, TreeMode};
// Root + 2 kids + 4 grandkids = 7 vertices (perfect binary depth-2).
let t = symmetric_tree(&[2, 2], TreeMode::Undirected).unwrap();
assert_eq!(t.vcount(), 7);
assert_eq!(t.ecount(), 6);
assert!(!t.is_directed());