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.

Examples

open allclose all

Basic Examples  (2)

Count the number of vertices:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Count the number of vertices that match a pattern:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Scope  (7)

Generalizations & Extensions  (1)

Applications  (3)

Properties & Relations  (5)

See Also

VertexList  EdgeCount  AdjacencyMatrix  IncidenceMatrix  Graph

Introduced in 2010
(8.0)
| Updated in 2015
(10.3)