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

UndirectedGraphQ

UndirectedGraphQ[g]
yields True if the graph g is an undirected graph and False otherwise.
  • A graph is undirected if every edge in the graph is undirected.
Test whether a graph is undirected:
UndirectedGraphQ gives False for inputs that are not undirected graphs:
Test whether a graph is undirected:
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]=
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
 
UndirectedGraphQ gives False for inputs that are not undirected graphs:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Test undirected and directed graphs:
UndirectedGraphQ gives False for anything that is not an undirected graph:
Test large graphs:
The empty graphs are undirected graphs:
An undirected graph can have self-loops:
A graph is either undirected or directed:
A symmetric adjacency matrix is interpreted to be an undirected graph:
Use DirectedEdges->True to interpret it as a directed graph:
The incidence matrix of an undirected graph has no negative entries:
UndirectedGraphQ gives False for non-explicit graphs:
New in 8