This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

LoopFreeGraphQ

LoopFreeGraphQ[g]
yields True if the graph g has no self-loops, and False otherwise.
  • A self-loop in a graph is an edge that connects a vertex to itself.
Test whether a graph has no self-loops:
LoopFreeGraphQ gives False for a graph with self-loops:
Test whether a graph has no self-loops:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
 
LoopFreeGraphQ gives False for a graph with self-loops:
In[1]:=
Click for copyable input
Out[1]=
Test undirected and directed graphs:
LoopFreeGraphQ gives False for anything that is not a graph without self-loops:
Test large graphs:
A bipartite graph has no self-loops:
A TreeGraph has no self-loops:
A typical PathGraph has no self-loops:
The adjacency matrix of a graph without self-loops has a zero diagonal:
The incidence matrix of a graph without self-loops has no entries greater than 1:
LoopFreeGraphQ gives False for non-explicit graphs:
New in 8