pub fn is_path(graph: &Graph) -> bool
Returns whether graph is a path: a tree in which every node has out-degree at most 1.
graph
The empty graph is a path.
Time: O(node_count + edge_count). Memory: 8 x node_count bytes while it runs.