WLJS LogoWLJS Notebook

VertexCount

VertexCount[g] gives the number of vertices in graph g. VertexCount[g, patt] counts vertices matching the pattern.

Examples

Count vertices:

VertexCount[CompleteGraph[10]]
(* 10 *)

VertexCount[GridGraph[{5, 5}]]
(* 25 *)

Count matching pattern:

g = Graph[{1, 2, 3, "a", "b"}, {1 <-> 2}]
VertexCount[g, _Integer]
(* 3 *)

Please visit the official Wolfram Language Reference for more details.

On this page