V - the graph vertex typepublic class RatioVertex<V> extends java.lang.Object implements java.lang.Comparable<RatioVertex<V>>
| Modifier and Type | Field and Description |
|---|---|
protected int |
degree
degree of this vertex
|
int |
ID
unique id, used to guarantee that compareTo never returns 0
|
java.util.Map<RatioVertex<V>,java.lang.Integer> |
neighbors
Map of neighbors, and a count of the number of edges to this neighbor
|
V |
v
original vertex
|
double |
weight
weight of the vertex
|
| Constructor and Description |
|---|
RatioVertex(int ID,
V v,
double weight)
Create a new ratio vertex
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNeighbor(RatioVertex<V> v)
Add a neighbor.
|
int |
compareTo(RatioVertex<V> other) |
boolean |
equals(java.lang.Object o) |
int |
getDegree()
Returns the degree of the vertex
|
double |
getRatio()
Returns the ratio between the vertex' weight and its degree
|
int |
hashCode() |
void |
removeNeighbor(RatioVertex<V> v)
Remove a neighbor.
|
java.lang.String |
toString() |
public final V v
public double weight
public final int ID
protected int degree
public final java.util.Map<RatioVertex<V>,java.lang.Integer> neighbors
public RatioVertex(int ID,
V v,
double weight)
ID - unique idv - the vertexweight - the vertex weightpublic void addNeighbor(RatioVertex<V> v)
v - the neighborpublic void removeNeighbor(RatioVertex<V> v)
v - the neighbor to removepublic int getDegree()
public double getRatio()
public int compareTo(RatioVertex<V> other)
compareTo in interface java.lang.Comparable<RatioVertex<V>>public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2019. All Rights Reserved.