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
FieldsModifier and TypeFieldDescriptionprotected intdegree of this vertexfinal intunique id, used to guarantee that compareTo never returns 0final intDeprecated, 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 Voriginal vertexdoubleweight of the vertex - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddNeighbor(RatioVertex<V> v) Add a neighbor.intcompareTo(RatioVertex<V> other) booleanintReturns the degree of the vertexdoublegetRatio()Returns the ratio between the vertex' weight and its degreeinthashCode()voidRemove 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.useidinsteadunique 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:
 compareToin interfaceComparable<V>
 - 
hashCode
public int hashCode() - 
equals
 - 
toString
 
 - 
 
idinstead