CompleteGraphQ[g,vlist]
yields True if the subgraph induced by vlist is a complete graph, and False otherwise.
CompleteGraphQ
CompleteGraphQ[g,vlist]
yields True if the subgraph induced by vlist is a complete graph, and False otherwise.
Details
- 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.
Examples
open all close allBasic Examples (2)
Test whether a graph is complete:
Graph[{12, 23, 31}]CompleteGraphQ[%]CompleteGraph[5]CompleteGraphQ[%]AdjacencyGraph[{{0, 1, 1}, {1, 0, 1}, {1, 1, 0}}]CompleteGraphQ[%]Petersen graph is not a complete graph:
PetersenGraph[5, 2]CompleteGraphQ[%]Scope (6)
Test undirected or directed graphs:
CompleteGraphQ /@ {[image], [image]}CompleteGraphQ[[image]]CompleteGraphQ[[image]]Graph[{12, 23, 31, 34}, VertexShapeFunction -> "Name"]{CompleteGraphQ[%, {1, 2, 3}], CompleteGraphQ[%, {1, 3, 4}]}CompleteGraphQ gives False for anything that is not a complete graph:
CompleteGraphQ[x]CompleteGraphQ[Graph[garbage]]g = CompleteGraph[10000];CompleteGraphQ[g]//Timing{VertexCount[g], EdgeCount[g]}Properties & Relations (11)
A complete graph has no self-loops:
CompleteGraph[4]{CompleteGraphQ[%], LoopFreeGraphQ[%]}A TreeGraph is not a complete graph:
TreeGraph[{12, 13}]CompleteGraphQ[%]The only complete path graphs are triangles (undirected):
PathGraph[{12, 23, 31}]CompleteGraphQ[%]PathGraph[{12, 21}]CompleteGraphQ[%]A complete graph on
vertices has
edges:
EdgeCount[CompleteGraph[n]]The complete graph
is a cycle graph
:
{CompleteGraph[3], CycleGraph[3]}The complete graph
is a wheel graph
:
{CompleteGraph[4], WheelGraph[4]}The complete graph
is the line graph of the star graph
:
{CompleteGraph[6], LineGraph[StarGraph[7]]}A complete graph is an
-regular graph:
VertexDegree[CompleteGraph[5]]The GraphComplement of a complete graph is an empty graph:
GraphComplement[CompleteGraph[5]]EmptyGraphQ[%]For a complete graph, all entries outside the diagonal are 1s in the AdjacencyMatrix:
AdjacencyMatrix[CompleteGraph[25]]//MatrixPlotComplete graphs are their own cliques:
CompleteGraph[5]Subgraph[%, First[FindClique[%]]]See Also
Related Guides
Text
Wolfram Research (2010), CompleteGraphQ, Wolfram Language function, https://reference.wolfram.com/language/ref/CompleteGraphQ.html (updated 2014).
CMS
Wolfram Language. 2010. "CompleteGraphQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/CompleteGraphQ.html.
APA
Wolfram Language. (2010). CompleteGraphQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompleteGraphQ.html
BibTeX
@misc{reference.wolfram_2026_completegraphq, author="Wolfram Research", title="{CompleteGraphQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CompleteGraphQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_completegraphq, organization={Wolfram Research}, title={CompleteGraphQ}, year={2014}, url={https://reference.wolfram.com/language/ref/CompleteGraphQ.html}, note=[Accessed: 13-June-2026]}