This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# TreeGraphQ

 TreeGraphQ[g] yields True if the graph g is a tree and False otherwise.
• A tree is a connected graph with no cycles.
Test whether a graph is a tree:
A graph with cycles is not a tree:
Test whether a graph is a tree:
 Out[1]=
 Out[2]=
 Out[3]=
 Out[4]=
 Out[5]=
 Out[6]=

A graph with cycles is not a tree:
 Out[1]=
 Out[2]=
 Scope   (2)
TreeGraphQ gives False for anything that is not a tree graph:
Test large graphs:
A tree graph can be a simple graph:
A tree graph can be a weighted graph:
A star is a special tree with as many leaves as possible:
A path graph with no repeated vertices is a tree with two leaves:
A graph with self-loops is not a tree graph:
A graph with cycles is not a tree graph:
A disconnected graph is not a tree graph:
A tree graph with vertices has edges:
A tree graph is a bipartite graph:
A tree graph is not Hamiltonian:
TreeGraphQ gives False for non-explicit graphs:
New in 8