V
- the graph vertex typepublic class RatioVertex<V> extends Object implements 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
|
Map<RatioVertex<V>,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(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.
|
String |
toString() |
public final V v
public double weight
public final int ID
protected int degree
public final Map<RatioVertex<V>,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 Comparable<RatioVertex<V>>
Copyright © 2016. All rights reserved.