edu.hawaii.ics.yucheng
Class JadeSolver.VertexNode

java.lang.Object
  extended by edu.hawaii.ics.yucheng.JadeSolver.VertexNode
Enclosing class:
JadeSolver

 class JadeSolver.VertexNode
extends java.lang.Object

Implementation of a vertex node. Each node holds a vertex index, weight, a list of connected vertices, and an array that provides O(1) time to determine if another vertex is connected.


Field Summary
 int index
          The index of the vertex.
private  JadeSolver.GraphData myGraph
           
private  int myHops
           
private  java.util.Collection<JadeSolver.VertexNode> myNeighborCache
           
 float weight
          The weight of the vertex.
 
Constructor Summary
JadeSolver.VertexNode(JadeSolver.GraphData g, int index)
          Initializes a new instance of the class.
 
Method Summary
 int degree()
          Returns the degree (the number of edges).
 int hops()
          Returns the number of hops.
 java.util.Collection<JadeSolver.VertexNode> neighbors()
          Returns a collection of neighboring vertices.
 void setHops(int hops)
          Sets the number of hops associated with this vertex to the root.
 java.lang.String toString()
          Returns the string representation of the class data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

public final int index
The index of the vertex.


myGraph

private final JadeSolver.GraphData myGraph

myHops

private int myHops

myNeighborCache

private java.util.Collection<JadeSolver.VertexNode> myNeighborCache

weight

public final float weight
The weight of the vertex.

Constructor Detail

JadeSolver.VertexNode

public JadeSolver.VertexNode(JadeSolver.GraphData g,
                             int index)
Initializes a new instance of the class.

Parameters:
g - The graph data.
index - The vertex index for this instance.
Method Detail

degree

public int degree()
Returns the degree (the number of edges).

Returns:
The degree.

hops

public int hops()
Returns the number of hops.

Returns:
The number of hops.

neighbors

public java.util.Collection<JadeSolver.VertexNode> neighbors()
Returns a collection of neighboring vertices.

Returns:
A collection of neighboring vertices.

setHops

public void setHops(int hops)
Sets the number of hops associated with this vertex to the root.

Parameters:
hops - The number of hops.

toString

public java.lang.String toString()
Returns the string representation of the class data.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of the class data.