pub fn is_undirected_tree(graph: &Graph) -> boolExpand description
Returns whether graph is a tree when read as undirected: connected and without cycles.
Unlike for is_tree, the direction of the edges does not matter: edges toward the root, or in
mixed directions, make a tree as well. The edges a -> b and b -> a count as one, so a tree may
store its edges in both directions, and self-loops are ignored. The empty graph is a tree.
Time: O(node_count + edge_count x alpha(node_count)), plus O(log max_out_degree) for each pair
a -> b, b -> a; O(1) for more than 3 x node_count - 2 edges, too many for any tree.
Memory: 5 x node_count bytes while it runs.