java.lang.Object
org.jgrapht.alg.vertexcover.util.RatioVertex<V>
- Type Parameters:
V
- the graph vertex type
- All Implemented Interfaces:
Comparable<RatioVertex<V>>
Helper class for vertex covers. Guarantees that vertices can be sorted, thereby obtaining a
unique ordering.
- Author:
- Joris Kinable
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
degree of this vertexfinal int
unique id, used to guarantee that compareTo never returns 0final int
Deprecated, for removal: This API element is subject to removal in a future version.final Map<RatioVertex<V>,
Integer> Map of neighbors, and a count of the number of edges to this neighborfinal V
original vertexdouble
weight of the vertex -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNeighbor
(RatioVertex<V> v) Add a neighbor.int
compareTo
(RatioVertex<V> other) boolean
int
Returns the degree of the vertexdouble
getRatio()
Returns the ratio between the vertex' weight and its degreeint
hashCode()
void
Remove a neighbor.toString()
-
Field Details
-
v
original vertex -
weight
public double weightweight of the vertex -
ID
Deprecated, for removal: This API element is subject to removal in a future version.useid
insteadunique id, used to guarantee that compareTo never returns 0 -
id
public final int idunique id, used to guarantee that compareTo never returns 0 -
degree
protected int degreedegree of this vertex -
neighbors
Map of neighbors, and a count of the number of edges to this neighbor
-
-
Constructor Details
-
RatioVertex
Create a new ratio vertex- Parameters:
id
- unique idv
- the vertexweight
- the vertex weight
-
-
Method Details
-
addNeighbor
Add a neighbor.- Parameters:
v
- the neighbor
-
removeNeighbor
Remove a neighbor.- Parameters:
v
- the neighbor to remove
-
getDegree
public int getDegree()Returns the degree of the vertex- Returns:
- degree of the vertex
-
getRatio
public double getRatio()Returns the ratio between the vertex' weight and its degree- Returns:
- the ratio between the vertex' weight and its degree
-
compareTo
- Specified by:
compareTo
in interfaceComparable<V>
-
hashCode
public int hashCode() -
equals
-
toString
-
id
instead