Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Predicates and Properties > AcyclicGraphQ >
Mathematica > Visualization and Graphics > Graphs & Networks > Graph Predicates and Properties > AcyclicGraphQ >

AcyclicGraphQ

AcyclicGraphQ[g]
yields True if the graph g is an acyclic graph and False otherwise.
  • A graph has a cycle if there is a path that starts and ends in the same vertex.
Test whether a graph is acyclic:
A cycle graph is not acyclic:
Test whether a graph is acyclic:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
 
A cycle graph is not acyclic:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Test undirected or directed graphs:
AcyclicGraphQ gives False for anything that is not an acyclic graph:
Test large graphs:
New in 8
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF