iteration.map(new IdentityMapper<Long>()).union(iteration.map(new IdentityMapper<Long>()))) .output(new DiscardingOutputFormat<Long>());
.map(new IdentityMapper<Tuple2<Long,Long>>()) .withBroadcastSet(bc_input1, "bc1") .union(joinResult) .output(new DiscardingOutputFormat<Tuple2<Long, Long>>());
/** * Counts the elements in the given dataset and stores the result in a * 1-element dataset. * * @param dataSet input dataset * @param <T> element type in input dataset * @return 1-element dataset with count of input dataset */ public static <T> DataSet<Long> count(DataSet<T> dataSet) { return dataSet .map(new Tuple1With1L<T>()) .union(dataSet.getExecutionEnvironment().fromElements(new Tuple1<>(0L))) .sum(0) .map(new ValueOf1<>()); }
/** * Counts the elements in the given dataset and stores the result in a * 1-element dataset. * * @param dataSet input dataset * @param <T> element type in input dataset * @return 1-element dataset with count of input dataset */ public static <T> DataSet<Long> count(DataSet<T> dataSet) { return dataSet .map(new Tuple1With1L<T>()) .union(dataSet.getExecutionEnvironment().fromElements(new Tuple1<>(0L))) .sum(0) .map(new ValueOf1<>()); }
/** * Returns the subgraph of the given supergraph that is induced by the * edges that fulfil the given filter function. * * @param superGraph supergraph * @return edge-induced subgraph */ private LG edgeInducedSubgraphProjectFirst(LG superGraph) { DataSet<E> filteredEdges = superGraph.getEdges().filter(edgeFilterFunction); DataSet<Tuple1<GradoopId>> vertexIdentifiers = filteredEdges .map(new SourceId<>()) .map(new ObjectTo1<>()) .union(filteredEdges .map(new TargetId<>()) .map(new ObjectTo1<>())) .distinct(); DataSet<V> filteredVertices = vertexIdentifiers .join(superGraph.getVertices()) .where(0).equalTo(new Id<>()) .with(new RightSide<>()); return superGraph.getFactory().fromDataSets(filteredVertices, filteredEdges); }
/** * Returns the subgraph of the given supergraph that is induced by the * edges that fulfil the given filter function. * * @param superGraph supergraph * @return edge-induced subgraph */ private LG edgeInducedSubgraphProjectFirst(LG superGraph) { DataSet<E> filteredEdges = superGraph.getEdges().filter(edgeFilterFunction); DataSet<Tuple1<GradoopId>> vertexIdentifiers = filteredEdges .map(new SourceId<>()) .map(new ObjectTo1<>()) .union(filteredEdges .map(new TargetId<>()) .map(new ObjectTo1<>())) .distinct(); DataSet<V> filteredVertices = vertexIdentifiers .join(superGraph.getVertices()) .where(0).equalTo(new Id<>()) .with(new RightSide<>()); return superGraph.getFactory().fromDataSets(filteredVertices, filteredEdges); }
.union(result.getEdges() .map(new ExpandGraphsToIdSet<>())) .union(result.getGraphHead()
/** * Verifies that the given graph is consistent, contains only edges that connect to vertices * within the subgraph. * * @param subgraph supergraph * @return verified subgraph */ private LG verify(LG subgraph) { DataSet<Tuple2<Tuple2<E, V>, V>> verifiedTriples = subgraph.getEdges() .join(subgraph.getVertices()) .where(new SourceId<>()).equalTo(new Id<>()) .join(subgraph.getVertices()) .where("0.targetId").equalTo(new Id<>()); DataSet<E> verifiedEdges = verifiedTriples .map(new Value0Of2<>()) .map(new Value0Of2<>()); DataSet<V> verifiedVertices = verifiedTriples .map(new Value0Of2<>()) .map(new Value1Of2<>()) .union(verifiedTriples.map(new Value1Of2<>())) .distinct(new Id<>()); return subgraph.getFactory().fromDataSets(verifiedVertices, verifiedEdges); }
/** * Verifies that the given graph is consistent, contains only edges that connect to vertices * within the subgraph. * * @param subgraph supergraph * @return verified subgraph */ private LG verify(LG subgraph) { DataSet<Tuple2<Tuple2<E, V>, V>> verifiedTriples = subgraph.getEdges() .join(subgraph.getVertices()) .where(new SourceId<>()).equalTo(new Id<>()) .join(subgraph.getVertices()) .where("0.targetId").equalTo(new Id<>()); DataSet<E> verifiedEdges = verifiedTriples .map(new Value0Of2<>()) .map(new Value0Of2<>()); DataSet<V> verifiedVertices = verifiedTriples .map(new Value0Of2<>()) .map(new Value1Of2<>()) .union(verifiedTriples.map(new Value1Of2<>())) .distinct(new Id<>()); return subgraph.getFactory().fromDataSets(verifiedVertices, verifiedEdges); } }
.union(logicalGraph.getVertices());
.with(new LeftSide<>()) .map(new Value0Of2<>()) .union(vi) .map(new MapFunctionAddGraphElementToGraph2<>(newGraphid));
.with(new LeftSide<>()) .map(new Value0Of2<>()) .union(vi) .map(new MapFunctionAddGraphElementToGraph2<>(newGraphid));