@Test public void testWithEmptyNeighborhood() throws Exception { EPGMVertex someVertex = vertexFactory.createVertex(); Tuple2<EPGMVertex, List<NeighborhoodVertex>> inputEmpty = new Tuple2<>(someVertex, Collections.emptyList()); List<EPGMEdge> result = getExecutionEnvironment().fromElements(inputEmpty) .flatMap(toTest).collect(); assertEquals(0, result.size()); }
@Override public void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out) { final List<NeighborhoodVertex> neighbors = value.f1; for (NeighborhoodVertex source : neighbors) { reuseEdge.setSourceId(source.getNeighborId()); for (NeighborhoodVertex target : neighbors) { if (source == target) { continue; } reuseEdge.setId(GradoopId.get()); reuseEdge.setTargetId(target.getNeighborId()); out.collect(reuseEdge); } } }
CreateCartesianNeighborhoodEdges implements FlatMapFunction<Tuple2<V, List<NeighborhoodVertex>>, E>, ResultTypeQueryable<E> { @Override public void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out) { final List<NeighborhoodVertex> neighbors = value.f1; for (NeighborhoodVertex source : neighbors) { reuseEdge.setSourceId(source.getNeighborId()); for (NeighborhoodVertex target : neighbors) { if (source == target) { continue; } reuseEdge.setId(GradoopId.get()); reuseEdge.setTargetId(target.getNeighborId()); out.collect(reuseEdge); } } } }
CreateCartesianNeighborhoodEdges implements FlatMapFunction<Tuple2<V, List<NeighborhoodVertex>>, E>, ResultTypeQueryable<E> { @Override public void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out) { final List<NeighborhoodVertex> neighbors = value.f1; for (NeighborhoodVertex source : neighbors) { reuseEdge.setSourceId(source.getNeighborId()); for (NeighborhoodVertex target : neighbors) { if (source == target) { continue; } reuseEdge.setId(GradoopId.get()); reuseEdge.setTargetId(target.getNeighborId()); out.collect(reuseEdge); } } } CreateCartesianNeighborhoodEdges(EdgeFactory<E> factory, String newEdgeLabel); }
CreateCartesianNeighborhoodEdges implements FlatMapFunction<Tuple2<V, List<NeighborhoodVertex>>, E>, ResultTypeQueryable<E> { @Override public void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out) { final List<NeighborhoodVertex> neighbors = value.f1; for (NeighborhoodVertex source : neighbors) { reuseEdge.setSourceId(source.getNeighborId()); for (NeighborhoodVertex target : neighbors) { if (source == target) { continue; } reuseEdge.setId(GradoopId.get()); reuseEdge.setTargetId(target.getNeighborId()); out.collect(reuseEdge); } } } CreateCartesianNeighborhoodEdges(EdgeFactory<E> factory, String newEdgeLabel); @Override void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out); @Override TypeInformation<E> getProducedType(); }
CreateCartesianNeighborhoodEdges implements FlatMapFunction<Tuple2<V, List<NeighborhoodVertex>>, E>, ResultTypeQueryable<E> { @Override public void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out) { final List<NeighborhoodVertex> neighbors = value.f1; for (NeighborhoodVertex source : neighbors) { reuseEdge.setSourceId(source.getNeighborId()); for (NeighborhoodVertex target : neighbors) { if (source == target) { continue; } reuseEdge.setId(GradoopId.get()); reuseEdge.setTargetId(target.getNeighborId()); out.collect(reuseEdge); } } } CreateCartesianNeighborhoodEdges(EdgeFactory<E> factory, String newEdgeLabel); @Override void flatMap(Tuple2<V, List<NeighborhoodVertex>> value, Collector<E> out); @Override TypeInformation<E> getProducedType();  }