EdgeIndex

EdgeIndex[g,e]

gives the integer index for the edge e in the graph g.

EdgeIndex[{vw,},]

uses rules vw to specify the graph g.

Details

Examples

open allclose all

Basic Examples  (1)

Find the integer index of an edge:

The index corresponds to the position in the edge list:

Scope  (4)

EdgeIndex works with undirected graphs:

Directed graphs:

Use rules to specify the graph:

EdgeIndex works with large graphs:

Properties & Relations  (5)

The EdgeIndex of an edge corresponds to its position in EdgeList:

Sort the vertices in undirected edges for comparison:

EdgeIndex is typically faster than Position:

EdgeQ can be used to tell whether EdgeIndex will succeed:

Try an edge item:

Try a non-edge item:

Use VertexIndex to find the integer index of a vertex:

VertexIndex and EdgeIndex give the row and column ordering used in IncidenceMatrix:

Test whether is incident to :

Possible Issues  (1)

Some edges 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), EdgeIndex, Wolfram Language function, https://reference.wolfram.com/language/ref/EdgeIndex.html (updated 2015).

Text

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

BibTeX

@misc{reference.wolfram_2021_edgeindex, author="Wolfram Research", title="{EdgeIndex}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/EdgeIndex.html}", note=[Accessed: 22-October-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_edgeindex, organization={Wolfram Research}, title={EdgeIndex}, year={2015}, url={https://reference.wolfram.com/language/ref/EdgeIndex.html}, note=[Accessed: 22-October-2021 ]}

CMS

Wolfram Language. 2010. "EdgeIndex." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/EdgeIndex.html.

APA

Wolfram Language. (2010). EdgeIndex. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EdgeIndex.html