CompleteGraphQ

CompleteGraphQ[g]
yields True if the graph g is a complete graph, and False otherwise.

CompleteGraphQ[g,vlist]
yields True if the subgraph induced by vlist is a complete graph, and False otherwise.

DetailsDetails

  • A graph is complete if there is an edge between every pair of distinct vertices.
  • CompleteGraphQ works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Test whether a graph is complete:

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]=

Petersen graph is not a complete graph:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2010
(8.0)
| Updated in 2014
(10.0)