VertexCount[g]
gives a count of the number of vertices in the graph g.
VertexCount[g,patt]
gives a count of the number of vertices that match the pattern patt.
VertexCount[{vw,…},…]
uses rules vw to specify the graph g.


VertexCount
VertexCount[g]
gives a count of the number of vertices in the graph g.
VertexCount[g,patt]
gives a count of the number of vertices that match the pattern patt.
VertexCount[{vw,…},…]
uses rules vw to specify the graph g.
Details

- VertexCount is also known as the order of the graph.
- VertexCount[g] returns the number of vertices in the graph g.
- VertexCount works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

Examples
open all close allScope (7)
VertexCount works with undirected graphs:
Use rules to specify the graph:
Use patterns to count a subset of vertices:
VertexCount works with large graphs:
Applications (3)
Properties & Relations (5)
Number of vertices of CompleteGraph[n]:
VertexCount can be found using VertexList:
The number of vertices can be found from matrix representations:
The number of rows and columns of an adjacency matrix:
The number of rows of an incidence matrix:
The number of rows or columns of a Kirchhoff matrix:
The number of vertices of the line graph of graph g is equal to the number of edges of g:
Related Guides
Text
Wolfram Research (2010), VertexCount, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexCount.html (updated 2015).
CMS
Wolfram Language. 2010. "VertexCount." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexCount.html.
APA
Wolfram Language. (2010). VertexCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexCount.html
BibTeX
@misc{reference.wolfram_2025_vertexcount, author="Wolfram Research", title="{VertexCount}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexCount.html}", note=[Accessed: 08-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_vertexcount, organization={Wolfram Research}, title={VertexCount}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexCount.html}, note=[Accessed: 08-August-2025]}