This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

VertexIndex

VertexIndex
gives the integer index for the vertex v in the graph g.
Find the integer index of a vertex:
The index corresponds to the position in the vertex list:
Find the integer index of a vertex:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
The index corresponds to the position in the vertex list:
In[3]:=
Click for copyable input
Out[3]=
VertexIndex works with undirected graphs:
Directed graphs:
VertexIndex works with large graphs:
Compare performance with a direct search in VertexList[g]:
The VertexIndex of a vertex corresponds to its position in VertexList:
VertexIndex is typically faster than Position:
VertexQ can be used to tell whether VertexIndex will succeed:
Try a vertex item:
Use EdgeIndex to find the integer index of an edge:
VertexIndex gives the row and column ordering used in AdjacencyMatrix:
Test whether and are adjacent:
VertexIndex gives the row and column ordering used in WeightedAdjacencyMatrix:
Find the weight of the edge :
VertexIndex gives the row and column ordering used in AdjacencyMatrix:
Find the shortest distance between and :
VertexIndex gives the row and column ordering used in KirchhoffMatrix:
Find the vertex degree of :
VertexIndex and EdgeIndex give the row and column ordering used in IncidenceMatrix:
Test whether is incident to :
VertexIndex gives the ordering of VertexDegree:
Find the vertex degree for 1:
Use VertexDegree directly:
VertexIndex gives the ordering of centralities:
Find centrality measures for 1:
Some vertices do not seem to have integer indices:
Membership is tested using SameQ rather than Equal:
By using identical expressions the integer index is found:
New in 8