# indexLabelGraph -- Relabels the vertices of a graph or digraph according to their indices, indexed from 0.

## Synopsis

• Usage:
G' = indexLabelGraph G
D' = indexLabelGraph D
• Inputs:
• G, an instance of the type Graph,
• D, an instance of the type Digraph,
• Outputs:
• G', an instance of the type Graph,
• D', an instance of the type Digraph, the graph or digraph with vertices relabeled according to their indices starting from 0.

## Description

This method relabels the vertices of a graph or digraph according to their indices. The method indexes from 0 to the number of vertices minus one.

 i1 : G = graph({1,2,3,4,5},{{1,3},{3,4},{4,5}}); i2 : indexLabelGraph G o2 = Graph{0 => {2} } 1 => {} 2 => {0, 3} 3 => {2, 4} 4 => {3} o2 : Graph i3 : D = digraph({1,2,3,4,5},{{1,2},{2,3},{3,1},{4,5},{5,4}}) o3 = Digraph{1 => {2}} 2 => {3} 3 => {1} 4 => {5} 5 => {4} o3 : Digraph i4 : indexLabelGraph D o4 = Digraph{0 => {1}} 1 => {2} 2 => {0} 3 => {4} 4 => {3} o4 : Digraph

## See also

• reindexBy -- reindexes the vertices according to the input ordering.

## Ways to use indexLabelGraph :

• "indexLabelGraph(Digraph)"
• "indexLabelGraph(Graph)"

## For the programmer

The object indexLabelGraph is .