This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
Returns \(True\) if G is a forest.
A forest is a graph with no undirected cycles.
For directed graphs, \(G\) is a forest if the underlying graph is a forest. The underlying graph is obtained by treating each directed edge as a single undirected edge in a multigraph.
G : graph
The graph to test.
b : bool
A boolean that is \(True\) if \(G\) is a forest.
In another convention, a directed forest is known as a polyforest and then forest corresponds to a branching.