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

Examples

open allclose all

Basic Examples  (1)

Find the integer index of a vertex:

The index corresponds to the position in the vertex list:

Scope  (4)

VertexIndex works with undirected graphs:

Directed 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:

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:

Possible Issues  (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:

Wolfram Research (2010), VertexIndex, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexIndex.html (updated 2015).

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

BibTeX

@misc{reference.wolfram_2024_vertexindex, author="Wolfram Research", title="{VertexIndex}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexIndex.html}", note=[Accessed: 30-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_vertexindex, organization={Wolfram Research}, title={VertexIndex}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexIndex.html}, note=[Accessed: 30-December-2024 ]}