com.pawjaw.graph.fppr
Class Vertex
java.lang.Object
com.pawjaw.graph.fppr.Vertex
- All Implemented Interfaces:
- java.lang.Comparable<Vertex>
public final class Vertex
- extends java.lang.Object
- implements java.lang.Comparable<Vertex>
Each element in the PageRank Graph
is represented by an instance of
this class. Vertex elements are by the Graph instance when the Graph is
instantiated. The number of Vertex elements is specified when the Graph is
instantiated. Vertex elements are labeled by contiguous increasing integer ids
starting at zero. The process for adding outgoing edges from a Vertex is by
retrieving the source Vertex from the Graph instance, then specifying a
destination Vertex also retrieved from the Graph instance as well as a
non-negative weight.
- See Also:
Graph
Field Summary |
int |
id
The id of this vertex. |
Constructor Summary |
protected |
Vertex(int id)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
id
public final int id
- The id of this vertex.
Vertex
protected Vertex(int id)
addOutgoingEdge
public void addOutgoingEdge(Vertex destination,
float weight)
- Add a directed outgoing edge from this Vertex to a destination Vertex.
Use the
Graph.vertex(int)
method to retrieve source and destination
Vertex elements.
Here is an example of creating a Graph with 10 Vertex
elements and adding an outgoing edge from Vertex with vertex id: 7 to
Vertex with vertex id: 2 with transition weight 0.5:
Graph g = new Graph(10);
Vertex source = g.vertex(7);
Vertex destination = g.vertex(2);
source.addOutgoingEdge(destination, 0.5);
- Parameters:
destination
- the destination of this outgoing edgeweight
- a non-negative transition weight for sampling walk steps- See Also:
Graph.vertex(int)
addSegment
protected void addSegment(Graph.Step step)
reset
protected void reset()
visit
protected void visit()
visits
protected int visits()
nextSegmentStart
protected Graph.Step nextSegmentStart()
sampleNeighbor
protected Vertex sampleNeighbor()
compareTo
public int compareTo(Vertex o)
- Specified by:
compareTo
in interface java.lang.Comparable<Vertex>