T
- the weight type of this edgeE
- the edge type of the edge that this edge referencespublic final class ContractedEdge<T,E extends DirectedEdge<T,E> & java.lang.Comparable<? super E>>
extends java.lang.Object
AbstractRenamedEdge
, which represents contracted edges.Modifier and Type | Field and Description |
---|---|
protected int |
from |
E |
original |
protected int |
to |
Constructor and Description |
---|
ContractedEdge(E original)
Creates a new contracted edge that keeps the start and end indices from the original edge.
|
ContractedEdge(int from,
int to,
E original)
Creates a new contracted edge that connects the vertices from and to and internally references the original edge.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(R other) |
boolean |
equals(java.lang.Object o) |
int |
from()
Returns where the edge starts.
|
int |
hashCode() |
ContractedEdge<T,E> |
reversed()
Returns a new edge with
DirectedEdge.from() and DirectedEdge.to() swapped. |
int |
to()
Returns where the edge ends.
|
java.lang.String |
toString() |
T |
weight()
Returns the weight of the edge.
|
protected final int from
protected final int to
public final E extends DirectedEdge<T,E> & java.lang.Comparable<? super E> original
public ContractedEdge(E original)
original
- the original edge that we would like to contractpublic ContractedEdge(int from, int to, E original)
from
- the from index of the contracted edgeto
- the to index of the contracted edgeoriginal
- the original edge that should be referencedpublic ContractedEdge<T,E> reversed()
DirectedEdge
DirectedEdge.from()
and DirectedEdge.to()
swapped.DirectedEdge.from()
and DirectedEdge.to()
swappedpublic java.lang.String toString()
public int from()
DirectedEdge
from
in interface DirectedEdge<T,R extends util.graph.edge.AbstractRenamedEdge<T,E,R>>
public int to()
DirectedEdge
to
in interface DirectedEdge<T,R extends util.graph.edge.AbstractRenamedEdge<T,E,R>>
public T weight()
DirectedEdge
weight
in interface DirectedEdge<T,R extends util.graph.edge.AbstractRenamedEdge<T,E,R>>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(R other)
compareTo
in interface java.lang.Comparable<R extends util.graph.edge.AbstractRenamedEdge<T,E,R>>