A forest is a finite simple graph that is undirected and acyclic (i.e., has no graph cycles). Forests therefore consist only of (possibly disconnected) trees, hence the name "forest."
Examples of forests include the singleton graph, empty graphs, and all trees.
A forest with components and
nodes has
graph edges. The enumerations
below count forests up to graph isomorphism.
The numbers of forests on
,
2, ... nodes are 1, 2, 3, 6, 10, 20, 37, ... (OEIS
A005195).
An undirected graph can be tested to determine if it is acyclic (i.e., a forest) in the Wolfram Language using AcyclicGraphQ[g]. A collection of acyclic graphs is available as GraphData["Acyclic"] or GraphData["Forest"].
The total numbers of trees in all the forests of orders , 2, ... are 1, 3, 6, 13, 24, 49, 93,
190, 381, ... (OEIS A005196). The average numbers
of trees are therefore 1, 3/2, 2, 13/6, 12/5, 49/20, 93/37,
5/2, ... (OEIS A095131 and A095132).
The triangle of numbers of -node forests containing
trees is 1; 1, 1; 1, 1, 1; 2, 2,
1, 1; 3, 3, 2, 1, 1; ... (OEIS A095133).