VertexIndex
VertexIndex[g,v]
gives the integer index for the vertex v in the graph g.
VertexIndex[{vw,…},…]
uses rules vw to specify the graph g.
Details
- VertexIndex is also known as vertex ordering.
- VertexIndex is a mapping that assigns a unique integer index to each vertex in a graph, often used for referencing elements in arrays.
- VertexIndex gives the ordering used in functions such as VertexList, AdjacencyMatrix, KirchhoffMatrix, IncidenceMatrix and GraphDistanceMatrix.
- VertexIndex[g,v] gives the position for a vertex v in VertexList[g].
- VertexIndex[g,v] gives the row position for a vertex v in IncidenceMatrix[g].
- VertexIndex[g,v] gives the row and column positions for a vertex v in AdjacencyMatrix[g], KirchhoffMatrix[g] and GraphDistanceMatrix[g].
Examples
open allclose allBasic Examples (1)
Scope (4)
VertexIndex works with undirected graphs:
Use rules to specify the graph:
VertexIndex works with large graphs:
Properties & Relations (11)
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:
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:
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:
VertexIndex and EdgeIndex give the row and column ordering used in IncidenceMatrix:
VertexIndex gives the ordering of VertexDegree:
Use VertexDegree directly:
VertexIndex gives the ordering of centralities:
Text
Wolfram Research (2010), VertexIndex, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexIndex.html (updated 2015).
CMS
Wolfram Language. 2010. "VertexIndex." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexIndex.html.
APA
Wolfram Language. (2010). VertexIndex. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexIndex.html