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:

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