Pandora
Class GraphNode

public class GraphNode
implements java.lang.Comparable
Class that represents a graph node. If one wishes to add extra features to the node ( e.g a vector with the nodes neighbors ) this can be done by simply adding the desired variables at the declaration of variables section of the source code.
Version:
0.1
Author:
Foudalis Ilias
Constructor Detail

GraphNode

public GraphNode()
Class constructor.

Method Detail

addParent

public void addParent(Pandora.GraphNode parent)
Adds a parent to the node.
Parameters:
parent - GraphNode : The parent of the node.

compareTo

public int compareTo(java.lang.Object o)
Compares two nodes. Two nodes are considered to be equal if they have the same creation order.
Parameters:
o - Object : The node to compare our node with.
Returns:
int : 0 if equal, -1 if different.

getAge

public int getAge()
Returns the x coordinate of the node.
Returns:
double

getAllParents

public java.util.Vector getAllParents()
Returns all the parents of the node.
Returns:
Vector : Vector holding the node's parents. The elements of the vector are of type GraphNode.

getCreationOrder

public int getCreationOrder()
Returns the creation order of the node.
Returns:
int

getDegree

public int getDegree()
Returns the degree of the node.
Returns:
int

getFertility

public boolean getFertility()
Returns true if a node is fertile.
Returns:
boolean

getLengthDistance

public int getLengthDistance()
Returns the length distance ( hop distance ) from this node to the first.
Returns:
int

getOutDegree

public int getOutDegree()
Returns the out degree of the node.
Returns:
int

getParent

public Pandora.GraphNode getParent(int i)
Returns the ith parent of the node. If the parent does not exist it returns null.
Parameters:
i - int : the ith parent.
Returns:
GraphNode : The parent node or null.

getSP

public java.util.SortedSet getSP()
Returns the shortest path from this node to the first node.
Returns:
SortedSet

getX

public double getX()
Returns the age of the node.
Returns:
int

getY

public double getY()
Returns the y coordinate of the node.
Returns:
double

setAge

public void setAge(int age)
Sets the age of the node ( used only by models that implement the fertility feature ).
Parameters:
age - int : The age of the node.

setCreationOrder

public void setCreationOrder(int creationOrder)
Sets the creation order of the node.
Parameters:
creationOrder - int : The creation order of the node.

setDegree

public void setDegree(int degree)
Sets the degree of the node ( used for non directed graphs ).
Parameters:
degree - int : The degree of the node.

setFertility

public void setFertility(boolean isFertile)
Sets the fertility of a node ( used only by models that implement the fertility feature ).
Parameters:
isFertile - boolean : If true then the vertex is considered fertile.

setLengthDistance

public void setLengthDistance(int lengthDistance)
Sets the length distance ( or hop distance ) of the node from the first ( central ) node.
Parameters:
lengthDistance - int : The distance counted in hops from the first node.

setOutDegree

public void setOutDegree(int out)
Sets the out degree of a node.
Parameters:
out - int : The out degree.

setSP

public void setSP(java.util.SortedSet sp)
Sets the shortest path of the node.
Parameters:
sp - SortedSet : The nodes that are in the path from this node to the first node

setX

public void setX(double X)
Sets the x coordinate of the node.
Parameters:
X - double : The x coordinate.

setY

public void setY(double Y)
Sets the y coordinate of the node.
Parameters:
Y - double : The y coordinate.

update

public void update()
Updates the shortest path of the node from the first node ( central ) node of the graph.