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

GraphQ

GraphQ[g]
yields True if g is a valid Graph object and False otherwise.
Test whether an object is a valid Graph object:
Special graphs:
Matrix graphs:
Random graphs:
A Graphics object that contains a picture of a graph is not a valid Graph object:
Test whether an object is a valid Graph object:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Special graphs:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Matrix graphs:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Random graphs:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
A Graphics object that contains a picture of a graph is not a valid Graph object:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
GraphQ gives False for anything that is not a graph:
Test large graphs:
Test whether a graph is directed or undirected:
Test whether a graph is simple:
A graph can have self-loops:
Test whether a graph is bipartite:
Test whether a graph is weighted:
GraphQ gives False for non-explicit graphs:
For an explicit integer it is a graph object:
New in 8