K
- The type of the vertex key (the vertex identifier).VV
- The type of the vertex value (the state of the vertex).Message
- The type of the message sent between vertices along the edges.EV
- The type of the values that are associated with the edges.public class ScatterGatherIteration<K,VV,Message,EV> extends Object implements CustomUnaryOperation<Vertex<K,VV>,Vertex<K,VV>>
Scatter-Gather algorithms operate on graphs, which are defined through vertices and edges. The algorithms send messages along the edges and update the state of vertices based on the old state and the incoming messages. All vertices have an initial state. The computation terminates once no vertex updates its state any more. Additionally, a maximum number of iterations (supersteps) may be specified.
The computation is here represented by two functions:
GatherFunction
receives incoming messages and may updates the state for
the vertex. If a state is updated, messages are sent from this vertex. Initially, all vertices are
considered updated.ScatterFunction
takes the new vertex state and sends messages along the outgoing
edges of the vertex. The outgoing edges may optionally have an associated value, such as a weight.Scatter-Gather graph iterations are are run by calling
Graph.runScatterGatherIteration(ScatterFunction, GatherFunction, int)
.
Modifier and Type | Method and Description |
---|---|
void |
configure(ScatterGatherConfiguration parameters)
Configures this scatter-gather iteration with the provided parameters.
|
DataSet<Vertex<K,VV>> |
createResult()
Creates the operator that represents this scatter-gather graph computation.
|
ScatterGatherConfiguration |
getIterationConfiguration() |
void |
setInput(DataSet<Vertex<K,VV>> inputData)
Sets the input data set for this operator.
|
static <K,VV,Message,EV> |
withEdges(DataSet<Edge<K,EV>> edgesWithValue,
ScatterFunction<K,VV,Message,EV> sf,
GatherFunction<K,VV,Message> gf,
int maximumNumberOfIterations)
Creates a new scatter-gather iteration operator for graphs where the edges are associated with a value (such as
a weight or distance).
|
public void setInput(DataSet<Vertex<K,VV>> inputData)
setInput
in interface CustomUnaryOperation<Vertex<K,VV>,Vertex<K,VV>>
inputData
- The input data set, which in the case of this operator represents the set of
vertices with their initial state.CustomUnaryOperation.setInput(org.apache.flink.api.java.DataSet)
public DataSet<Vertex<K,VV>> createResult()
createResult
in interface CustomUnaryOperation<Vertex<K,VV>,Vertex<K,VV>>
public static <K,VV,Message,EV> ScatterGatherIteration<K,VV,Message,EV> withEdges(DataSet<Edge<K,EV>> edgesWithValue, ScatterFunction<K,VV,Message,EV> sf, GatherFunction<K,VV,Message> gf, int maximumNumberOfIterations)
K
- The type of the vertex key (the vertex identifier).VV
- The type of the vertex value (the state of the vertex).Message
- The type of the message sent between vertices along the edges.EV
- The type of the values that are associated with the edges.edgesWithValue
- The data set containing edges.sf
- The function that turns changed vertex states into messages along the edges.gf
- The function that updates the state of the vertices from the incoming messages.public void configure(ScatterGatherConfiguration parameters)
parameters
- the configuration parameterspublic ScatterGatherConfiguration getIterationConfiguration()
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.