public abstract class GatherFunction<K,VV,Message> extends Object implements Serializable
updateVertex(Vertex, MessageIterator)
, which is
invoked once per vertex per superstep.
<K>
The vertex key type.
<VV>
The vertex value type.
<Message>
The message type.Constructor and Description |
---|
GatherFunction() |
Modifier and Type | Method and Description |
---|---|
<T> Collection<T> |
getBroadcastSet(String name)
Gets the broadcast data set registered under the given name.
|
long |
getInDegree()
Retrieves the vertex in-degree (number of in-coming edges).
|
<T extends Aggregator<?>> |
getIterationAggregator(String name)
Gets the iteration aggregator registered under the given name.
|
long |
getNumberOfVertices()
Retrieves the number of vertices in the graph.
|
long |
getOutDegree()
Retrieve the vertex out-degree (number of out-going edges).
|
<T extends Value> |
getPreviousIterationAggregate(String name)
Get the aggregated value that an aggregator computed in the previous iteration.
|
int |
getSuperstepNumber()
Gets the number of the superstep, starting at 1.
|
void |
postSuperstep()
This method is executed once per superstep after the gather function has been invoked for each vertex.
|
void |
preSuperstep()
This method is executed once per superstep before the gather function is invoked for each vertex.
|
void |
setNewVertexValue(VV newValue)
Sets the new value of this vertex.
|
abstract void |
updateVertex(Vertex<K,VV> vertex,
MessageIterator<Message> inMessages)
This method is invoked once per vertex per superstep.
|
public long getNumberOfVertices()
IterationConfiguration.setOptNumVertices(boolean)
option has been set; -1 otherwise.public abstract void updateVertex(Vertex<K,VV> vertex, MessageIterator<Message> inMessages) throws Exception
setNewVertexValue(Object)
. If the vertex
state is changed, it will trigger the sending of messages via the ScatterFunction
.vertex
- The vertex.inMessages
- The incoming messages to this vertex.Exception
- The computation may throw exceptions, which causes the superstep to fail.public void preSuperstep() throws Exception
Exception
- Exceptions in the pre-superstep phase cause the superstep to fail.public void postSuperstep() throws Exception
Exception
- Exceptions in the post-superstep phase cause the superstep to fail.public void setNewVertexValue(VV newValue)
This should be called at most once per updateVertex.
newValue
- The new vertex value.public int getSuperstepNumber()
public <T extends Aggregator<?>> T getIterationAggregator(String name)
name
- The name of the aggregator.public <T extends Value> T getPreviousIterationAggregate(String name)
name
- The name of the aggregator.public <T> Collection<T> getBroadcastSet(String name)
ScatterGatherConfiguration.addBroadcastSetForGatherFunction(String, org.apache.flink.api.java.DataSet)
.name
- The name under which the broadcast set is registered.public long getInDegree()
public long getOutDegree()
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.