IndexGraph

IndexGraph[g]

replaces the vertices of the graph g by its vertex indices.

IndexGraph[g,r]

replaces the vertices with integers r, r+1, .

IndexGraph[{vw,},]

uses rules vw to specify the graph g.

Details and Options

  • IndexGraph works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

Examples

open allclose all

Basic Examples  (2)

Replace the vertices of the graph with its vertex indices:

Replace the vertices with indices starting from 6:

Scope  (7)

IndexGraph works with undirected graphs:

Directed graphs:

Multigraphs:

Mixed graphs:

Replace the vertices with negative indices:

Use rules to specify the graph:

IndexGraph works with large graphs:

Properties & Relations  (5)

IndexGraph has the same number of vertices as the original graph:

IndexGraph has the same number of edges as the original graph:

IndexGraph is isomorphic to the original graph:

Use VertexReplace to replace the vertices of the graph:

IndexGraph has the same adjacency matrix as the original graph:

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