Class MasterComputeContext<CONFIG extends PregelConfig>
- java.lang.Object
-
- org.neo4j.graphalgo.beta.pregel.context.PregelContext<CONFIG>
-
- org.neo4j.graphalgo.beta.pregel.context.MasterComputeContext<CONFIG>
-
public class MasterComputeContext<CONFIG extends PregelConfig> extends PregelContext<CONFIG>
-
-
Field Summary
-
Fields inherited from class org.neo4j.graphalgo.beta.pregel.context.PregelContext
config
-
-
Constructor Summary
Constructors Constructor Description MasterComputeContext(CONFIG config, Graph graph, int iteration, NodeValue nodeValue, java.util.concurrent.ExecutorService executorService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
doubleArrayNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.double
doubleNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.java.util.concurrent.ExecutorService
executorService()
Returns an executor service that can be used for parallel master computations.void
forEachNode(java.util.function.LongPredicate consumer)
Accepts a consumer function that is called for every node in the graph.boolean
isInitialSuperstep()
Indicates if the current superstep is the first superstep.boolean
isMultiGraph()
Indicates whether the input graph is a multi-graph.long[]
longArrayNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.long
longNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.long
nodeCount()
Number of nodes in the input graph.long
relationshipCount()
Number of relationships in the input graph.void
setNodeValue(long nodeId, java.lang.String key, double value)
Sets a node double value for given the node schema key.void
setNodeValue(long nodeId, java.lang.String key, double[] value)
Sets a node long value for given the node schema key.void
setNodeValue(long nodeId, java.lang.String key, long value)
Sets a node long value for given the node schema key.void
setNodeValue(long nodeId, java.lang.String key, long[] value)
Sets a node long value for given the node schema key.int
superstep()
Returns the current superstep (0-based).-
Methods inherited from class org.neo4j.graphalgo.beta.pregel.context.PregelContext
config
-
-
-
-
Method Detail
-
isMultiGraph
public boolean isMultiGraph()
Description copied from class:PregelContext
Indicates whether the input graph is a multi-graph.- Specified by:
isMultiGraph
in classPregelContext<CONFIG extends PregelConfig>
-
nodeCount
public long nodeCount()
Description copied from class:PregelContext
Number of nodes in the input graph.- Specified by:
nodeCount
in classPregelContext<CONFIG extends PregelConfig>
-
relationshipCount
public long relationshipCount()
Description copied from class:PregelContext
Number of relationships in the input graph.- Specified by:
relationshipCount
in classPregelContext<CONFIG extends PregelConfig>
-
superstep
public int superstep()
Returns the current superstep (0-based).
-
executorService
public java.util.concurrent.ExecutorService executorService()
Returns an executor service that can be used for parallel master computations.
-
isInitialSuperstep
public boolean isInitialSuperstep()
Indicates if the current superstep is the first superstep.
-
forEachNode
public void forEachNode(java.util.function.LongPredicate consumer)
Accepts a consumer function that is called for every node in the graph. The consumer receives one node id at the time. If the consumer returns true, the next node is passed in. Otherwise the iteration stops.- Parameters:
consumer
-
-
doubleNodeValue
public double doubleNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.- Throws:
java.lang.IllegalArgumentException
- if the key does not exist or the value is not a double
-
longNodeValue
public long longNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.- Throws:
java.lang.IllegalArgumentException
- if the key does not exist or the value is not a long
-
longArrayNodeValue
public long[] longArrayNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.- Throws:
java.lang.IllegalArgumentException
- if the key does not exist or the value is not a long array
-
doubleArrayNodeValue
public double[] doubleArrayNodeValue(long nodeId, java.lang.String key)
Returns the node value for the given node schema key.- Throws:
java.lang.IllegalArgumentException
- if the key does not exist or the value is not a double array
-
setNodeValue
public void setNodeValue(long nodeId, java.lang.String key, double value)
Sets a node double value for given the node schema key.- Parameters:
key
- node schema keyvalue
- property value
-
setNodeValue
public void setNodeValue(long nodeId, java.lang.String key, long value)
Sets a node long value for given the node schema key.- Parameters:
key
- node schema keyvalue
- property value
-
setNodeValue
public void setNodeValue(long nodeId, java.lang.String key, long[] value)
Sets a node long value for given the node schema key.- Parameters:
key
- node schema keyvalue
- property value
-
setNodeValue
public void setNodeValue(long nodeId, java.lang.String key, double[] value)
Sets a node long value for given the node schema key.- Parameters:
key
- node schema keyvalue
- property value
-
-