T
- the type of data which is stored in the Vertices this Edge
attachespublic class UndirectedEdge<T> extends Edge<T>
Modifier and Type | Method and Description |
---|---|
UndirectedVertex<T> |
getOtherVertex(UndirectedVertex<T> one)
Gets the vertex that this edge connects which is not the one provided
|
UnmodifiablePair<UndirectedVertex<T>,UndirectedVertex<T>> |
getVertices()
Gets the vertices that this edge connects
|
void |
removeFromGraph()
Removes this component from the graph it is a part of.
|
void |
replaceVertex(UndirectedVertex<T> oldVertex,
UndirectedVertex<T> newVertex)
Replaces one of the vertices this edge connects with a new one
|
java.lang.String |
toString() |
fromGraph, fromSameGraphAs
public UndirectedVertex<T> getOtherVertex(UndirectedVertex<T> one)
one
- a vertex this edge connectspublic UnmodifiablePair<UndirectedVertex<T>,UndirectedVertex<T>> getVertices()
public void removeFromGraph()
GraphComponent
removeFromGraph
in class GraphComponent
public void replaceVertex(UndirectedVertex<T> oldVertex, UndirectedVertex<T> newVertex)
oldVertex
- the old vertex to replacenewVertex
- the new vertex to connect topublic java.lang.String toString()
toString
in class GraphComponent