pub fn is_undirected_forest(graph: &Graph) -> boolExpand description
Returns whether graph is a forest when read as undirected: without cycles.
Unlike for is_forest, the direction of the edges does not matter. The edges a -> b and
b -> a count as one, so they make no cycle, and self-loops are ignored. The empty graph is a
forest.
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 forest.
Memory: 5 x node_count bytes while it runs.