Class PageRank
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAllows for traversing all edge types of the graph.voidAllows for traversing all node types of the graph.voidaddEdgeType(int type, EdgesDirection dir) Allows for traversing edges of the given type.voidaddNodeType(int type) Allows for traversing nodes of the given type.voidclose()Closes the PageRank instance.booleanisClosed()Gets if PageRank instance has been closed or not.voidrun()Runs the algorithm.voidsetDamping(double damping) Sets the damping value for the PageRank.voidsetDefaultWeight(double weight) Sets the default weight for those cases when a given edge does not have a weight attribute set.voidsetEdgeWeightAttributeType(int attr) Sets the attribute to use as edge weight.voidsetInitialPageRankValue(double startValue) Sets the initial PageRank value.voidsetNumIterations(int numIterations) Sets the number of iterations to run the PageRank for.voidsetOutputAttributeType(int attr) Sets the output attribute type.voidsetStartingNode(long startNode) Sets the starting node of the page rank to compute the Personalized PageRank variant.voidsetTolerance(double tolerance) Sets the tolerance threashold to continue computing the PageRank after each iteration.
-
Constructor Details
-
PageRank
-
-
Method Details
-
setDamping
public void setDamping(double damping) Sets the damping value for the PageRank.- Parameters:
damping- [in] The damping value. Default: 0.85
-
setDefaultWeight
public void setDefaultWeight(double weight) Sets the default weight for those cases when a given edge does not have a weight attribute set.Default: 0.0
- Parameters:
weight- [in] The default weight
-
run
Runs the algorithm.sparksee::gdb::Error
- Throws:
RuntimeException- null
-
addAllEdgeTypes
Allows for traversing all edge types of the graph.The direction is interpreted as in which direction an edge can be followed from a node to influence other nodes.
- Parameters:
dir- [in] Edge direction.
-
setOutputAttributeType
Sets the output attribute type.If the PageRank will run on more than one node type, then the output attribute must be of type GLOBAL_TYPE or NODES_TYPE. Otherwise, it must be a valid attribute for the used node type.
- Parameters:
attr- [in] The attribute to store the result. Default: InvalidAttribute- Throws:
RuntimeException- null
-
setStartingNode
Sets the starting node of the page rank to compute the Personalized PageRank variant.sparksee::gdb::Error
- Parameters:
startNode- null- Throws:
RuntimeException- null
-
setInitialPageRankValue
public void setInitialPageRankValue(double startValue) Sets the initial PageRank value.If a starting node is set, this initial value is only set for the starting node and the rest of nodes are set to 0.0
- Parameters:
startValue- [in] The initial value to set. Default: 0.0
-
setEdgeWeightAttributeType
Sets the attribute to use as edge weight.If the multiple edge are set for traversal, this attribute must be of type GLOBAL_TYPE or EDGES_TYPE. Additionally, the attribute must be of type Double. Finally, negative weights are treated as non existing, so the default weight applies.
sparksee::gdb::Error
- Parameters:
attr- [in] The attribute type to use as a weight. Default: InvalidAttribute- Throws:
RuntimeException- null
-
addEdgeType
Allows for traversing edges of the given type.If the edge type was already added, the existing direction is overwritten The direction is interpreted as in which direction an edge can be followed from a node to influence other nodes.
- Parameters:
type- [in] Edge type.dir- [in] Edge direction.- Throws:
RuntimeException- null
-
setNumIterations
public void setNumIterations(int numIterations) Sets the number of iterations to run the PageRank for.- Parameters:
numIterations- [in] The number of interations to set. Default: 20
-
setTolerance
public void setTolerance(double tolerance) Sets the tolerance threashold to continue computing the PageRank after each iteration.If all the changes to any PPR value after an iteration are below that tolerance threshold, the algorithm finishes.
- Parameters:
tolerance- [in] The tolerance to use normalized between 0 and 1. Default: 0.000001
-
isClosed
public boolean isClosed()Gets if PageRank instance has been closed or not.- Returns:
- TRUE if the PageRank instance has been closed, FALSE otherwise.
- See Also:
-
addNodeType
Allows for traversing nodes of the given type.- Parameters:
type- null- Throws:
RuntimeException- null
-
close
public void close()Closes the PageRank instance.It must be called to ensure the integrity of all data.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
addAllNodeTypes
public void addAllNodeTypes()Allows for traversing all node types of the graph.
-