edu.uci.ics.jung.graph
Interface Edge

All Superinterfaces:
ArchetypeEdge, UserDataContainer
All Known Subinterfaces:
DirectedEdge, GraphCollapser.CollapsedEdge, UndirectedEdge
All Known Implementing Classes:
AbstractSparseEdge, BipartiteGraphCollapser.CollapsedBipartiteEdge, DirectedSparseEdge, GraphCollapser.DirectedCollapsedEdge, GraphCollapser.UndirectedCollapsedEdge, UndirectedSparseEdge

public interface Edge
extends ArchetypeEdge

A specific type of ArchetypeEdge that connects exactly two instances of Vertex. Instances of Edge may be either directed or undirected.

If either of the vertices incident to an Edge is removed from its graph, then this edge becomes ill-formed and must also be removed from the graph.

Author:
Danyel Fisher, Joshua O'Madadhain, Scott White
See Also:
Graph, Vertex

Nested Class Summary
 
Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer
UserDataContainer.CopyAction
 
Method Summary
 Pair getEndpoints()
          Returns a pair consisting of both incident vertices.
 Vertex getOpposite(Vertex v)
          Returns the vertex at the opposite end of this edge from the specified vertex v.
 
Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeEdge
copy, getEqualEdge, getEquivalentEdge, getGraph, getIncidentVertices, isIncident, numVertices
 
Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
 

Method Detail

getOpposite

public Vertex getOpposite(Vertex v)
Returns the vertex at the opposite end of this edge from the specified vertex v. Throws IllegalArgumentException if v is not incident to this edge.

For example, if this edge connects vertices a and b, this.getOpposite(a) returns b.

Throws:
java.lang.IllegalArgumentException

getEndpoints

public Pair getEndpoints()
Returns a pair consisting of both incident vertices. This is equivalent to getIncidentVertices, except that it returns the data in the form of a Pair rather than a Set. This allows easy access to the two vertices. Note that the pair is in no particular order.