WLJS LogoWLJS Notebook

VertexList

VertexList[g] gives the list of vertices in graph g.

Examples

Get vertices from a graph:

g = Graph[{1 -> 2, 2 -> 3, 3 -> 1}]

VertexList[g]
(* {1, 2, 3} *)

VertexList[CompleteGraph[5]]
(* {1, 2, 3, 4, 5} *)

Please visit the official Wolfram Language Reference for more details.

On this page