|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgrapht.alg.util.VertexDegreeComparator<V,E>
public class VertexDegreeComparator<V,E>
Compares two vertices based on their degree.
Used by greedy algorithms that need to sort vertices by their degree. Two vertices are considered equal if their degrees are equal.
Constructor Summary | |
---|---|
VertexDegreeComparator(UndirectedGraph<V,E> g)
Creates a comparator for comparing the degrees of vertices in the specified graph. |
|
VertexDegreeComparator(UndirectedGraph<V,E> g,
boolean ascendingOrder)
Creates a comparator for comparing the degrees of vertices in the specified graph. |
Method Summary | |
---|---|
int |
compare(V v1,
V v2)
Compare the degrees of v1 and v2 , taking into
account whether ascending or descending order is used. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public VertexDegreeComparator(UndirectedGraph<V,E> g)
g
- graph with respect to which the degree is calculated.public VertexDegreeComparator(UndirectedGraph<V,E> g, boolean ascendingOrder)
g
- graph with respect to which the degree is calculated.ascendingOrder
- true - compares in ascending order of degrees
(lowest first), false - compares in descending order of degrees (highest
first).Method Detail |
---|
public int compare(V v1, V v2)
v1
and v2
, taking into
account whether ascending or descending order is used.
compare
in interface java.util.Comparator<V>
v1
- the first vertex to be compared.v2
- the second vertex to be compared.
v1
comes before v2
, +1 if
v1
comes after v2
, 0 if equal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |