scatterFunction.setDirection(this.configuration.getDirection()); } else { scatterFunction.setDirection(EdgeDirection.OUT); EdgeDirection messagingDirection = scatterFunction.getDirection();
@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.scatterFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.scatterFunction.init(getIterationRuntimeContext()); } this.scatterFunction.preSuperstep(); }
@Override public void close() throws Exception { this.scatterFunction.postSuperstep(); }
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, VV>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, VV>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, VV> newVertexState = stateIter.next(); scatterFunction.set(edges.iterator(), out, newVertexState.getId()); scatterFunction.sendMessages(newVertexState); } } }
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, Tuple3<VV, LongValue, LongValue>>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, Tuple3<VV, LongValue, LongValue>>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, Tuple3<VV, LongValue, LongValue>> vertexWithDegrees = stateIter.next(); nextVertex.f0 = vertexWithDegrees.f0; nextVertex.f1 = vertexWithDegrees.f1.f0; scatterFunction.setInDegree(vertexWithDegrees.f1.f1.getValue()); scatterFunction.setOutDegree(vertexWithDegrees.f1.f2.getValue()); scatterFunction.set(edges.iterator(), out, vertexWithDegrees.getId()); scatterFunction.sendMessages(nextVertex); } } }
if (getDirection().equals(EdgeDirection.OUT)) { outValue.f0 = next.getField(1); else if (getDirection().equals(EdgeDirection.IN)) { outValue.f0 = next.getField(0); if (getDirection().equals(EdgeDirection.ALL)) { if (next.getField(0).equals(vertexId)) {
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, Tuple3<VV, LongValue, LongValue>>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, Tuple3<VV, LongValue, LongValue>>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, Tuple3<VV, LongValue, LongValue>> vertexWithDegrees = stateIter.next(); nextVertex.f0 = vertexWithDegrees.f0; nextVertex.f1 = vertexWithDegrees.f1.f0; scatterFunction.setInDegree(vertexWithDegrees.f1.f1.getValue()); scatterFunction.setOutDegree(vertexWithDegrees.f1.f2.getValue()); scatterFunction.set(edges.iterator(), out, vertexWithDegrees.getId()); scatterFunction.sendMessages(nextVertex); } } }
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, VV>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, VV>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, VV> newVertexState = stateIter.next(); scatterFunction.set(edges.iterator(), out, newVertexState.getId()); scatterFunction.sendMessages(newVertexState); } } }
if (getDirection().equals(EdgeDirection.OUT)) { outValue.f0 = next.getField(1); else if (getDirection().equals(EdgeDirection.IN)) { outValue.f0 = next.getField(0); if (getDirection().equals(EdgeDirection.ALL)) { if (next.getField(0).equals(vertexId)) {
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, Tuple3<VV, LongValue, LongValue>>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, Tuple3<VV, LongValue, LongValue>>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, Tuple3<VV, LongValue, LongValue>> vertexWithDegrees = stateIter.next(); nextVertex.f0 = vertexWithDegrees.f0; nextVertex.f1 = vertexWithDegrees.f1.f0; scatterFunction.setInDegree(vertexWithDegrees.f1.f1.getValue()); scatterFunction.setOutDegree(vertexWithDegrees.f1.f2.getValue()); scatterFunction.set(edges.iterator(), out, vertexWithDegrees.getId()); scatterFunction.sendMessages(nextVertex); } } }
@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.scatterFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.scatterFunction.init(getIterationRuntimeContext()); } this.scatterFunction.preSuperstep(); }
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, VV>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, VV>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, VV> newVertexState = stateIter.next(); scatterFunction.set(edges.iterator(), out, newVertexState.getId()); scatterFunction.sendMessages(newVertexState); } } }
scatterFunction.setDirection(this.configuration.getDirection()); } else { scatterFunction.setDirection(EdgeDirection.OUT); EdgeDirection messagingDirection = scatterFunction.getDirection();
@Override public void close() throws Exception { this.scatterFunction.postSuperstep(); }
if (getDirection().equals(EdgeDirection.OUT)) { outValue.f0 = next.getField(1); else if (getDirection().equals(EdgeDirection.IN)) { outValue.f0 = next.getField(0); if (getDirection().equals(EdgeDirection.ALL)) { if (next.getField(0).equals(vertexId)) {
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, Tuple3<VV, LongValue, LongValue>>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, Tuple3<VV, LongValue, LongValue>>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, Tuple3<VV, LongValue, LongValue>> vertexWithDegrees = stateIter.next(); nextVertex.f0 = vertexWithDegrees.f0; nextVertex.f1 = vertexWithDegrees.f1.f0; scatterFunction.setInDegree(vertexWithDegrees.f1.f1.getValue()); scatterFunction.setOutDegree(vertexWithDegrees.f1.f2.getValue()); scatterFunction.set(edges.iterator(), out, vertexWithDegrees.getId()); scatterFunction.sendMessages(nextVertex); } } }
@Override public void open(Configuration parameters) throws Exception { if (getRuntimeContext().hasBroadcastVariable("number of vertices")) { Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices"); this.scatterFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue()); } if (getIterationRuntimeContext().getSuperstepNumber() == 1) { this.scatterFunction.init(getIterationRuntimeContext()); } this.scatterFunction.preSuperstep(); }
@Override public void coGroup(Iterable<Edge<K, EV>> edges, Iterable<Vertex<K, VV>> state, Collector<Tuple2<K, Message>> out) throws Exception { final Iterator<Vertex<K, VV>> stateIter = state.iterator(); if (stateIter.hasNext()) { Vertex<K, VV> newVertexState = stateIter.next(); scatterFunction.set(edges.iterator(), out, newVertexState.getId()); scatterFunction.sendMessages(newVertexState); } } }
scatterFunction.setDirection(this.configuration.getDirection()); } else { scatterFunction.setDirection(EdgeDirection.OUT); EdgeDirection messagingDirection = scatterFunction.getDirection();
@Override public void close() throws Exception { this.scatterFunction.postSuperstep(); }