/** * Computes the intersection between the edge set and the given edge set. For all matching pairs, * only one edge will be in the resulting data set. * * @param edges edges to compute intersection with * @return edge set containing one edge for all matching pairs of the same edge */ private DataSet<Edge<K, EV>> getDistinctEdgeIntersection(DataSet<Edge<K, EV>> edges) { return this.getEdges() .join(edges) .where(0, 1, 2) .equalTo(0, 1, 2) .with(new JoinFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>>() { @Override public Edge<K, EV> join(Edge<K, EV> first, Edge<K, EV> second) throws Exception { return first; } }).withForwardedFieldsFirst("*").name("Intersect edges") .distinct() .name("Edges"); }
/** * Computes the intersection between the edge set and the given edge set. For all matching pairs, * only one edge will be in the resulting data set. * * @param edges edges to compute intersection with * @return edge set containing one edge for all matching pairs of the same edge */ private DataSet<Edge<K, EV>> getDistinctEdgeIntersection(DataSet<Edge<K, EV>> edges) { return this.getEdges() .join(edges) .where(0, 1, 2) .equalTo(0, 1, 2) .with(new JoinFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>>() { @Override public Edge<K, EV> join(Edge<K, EV> first, Edge<K, EV> second) throws Exception { return first; } }).withForwardedFieldsFirst("*").name("Intersect edges") .distinct() .name("Edges"); }
/** * Computes the intersection between the edge set and the given edge set. For all matching pairs, * only one edge will be in the resulting data set. * * @param edges edges to compute intersection with * @return edge set containing one edge for all matching pairs of the same edge */ private DataSet<Edge<K, EV>> getDistinctEdgeIntersection(DataSet<Edge<K, EV>> edges) { return this.getEdges() .join(edges) .where(0, 1, 2) .equalTo(0, 1, 2) .with(new JoinFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>>() { @Override public Edge<K, EV> join(Edge<K, EV> first, Edge<K, EV> second) throws Exception { return first; } }).withForwardedFieldsFirst("*").name("Intersect edges") .distinct() .name("Edges"); }
/** * Computes the intersection between the edge set and the given edge set. For all matching pairs, * only one edge will be in the resulting data set. * * @param edges edges to compute intersection with * @return edge set containing one edge for all matching pairs of the same edge */ private DataSet<Edge<K, EV>> getDistinctEdgeIntersection(DataSet<Edge<K, EV>> edges) { return this.getEdges() .join(edges) .where(0, 1, 2) .equalTo(0, 1, 2) .with(new JoinFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>>() { @Override public Edge<K, EV> join(Edge<K, EV> first, Edge<K, EV> second) throws Exception { return first; } }).withForwardedFieldsFirst("*").name("Intersect edges") .distinct() .name("Edges"); }
/** * Computes new vertices based on the new subgraphs. For each vertex, each * graph is collected in a flatMap function and then joined with the new * subgraph dataset. * * @param newGraphHeads graph dataset of the resulting graph collection * @return vertex set of the resulting graph collection */ @Override protected DataSet<Vertex> computeNewVertices( DataSet<GraphHead> newGraphHeads) { DataSet<Tuple2<Vertex, GradoopId>> verticesWithGraphs = firstCollection.getVertices().flatMap(new PairVertexWithGraphs<>()); return verticesWithGraphs .join(newGraphHeads) .where(1) .equalTo(new Id<>()) .with(new LeftJoin0OfTuple2<>()) .withForwardedFieldsFirst("f0->*") .distinct(new Id<>()); }
/** * Computes new vertices based on the new subgraphs. For each vertex, each * graph is collected in a flatMap function and then joined with the new * subgraph dataset. * * @param newGraphHeads graph dataset of the resulting graph collection * @return vertex set of the resulting graph collection */ @Override protected DataSet<Vertex> computeNewVertices( DataSet<GraphHead> newGraphHeads) { DataSet<Tuple2<Vertex, GradoopId>> verticesWithGraphs = firstCollection.getVertices().flatMap(new PairVertexWithGraphs<>()); return verticesWithGraphs .join(newGraphHeads) .where(1) .equalTo(new Id<>()) .with(new LeftJoin0OfTuple2<>()) .withForwardedFieldsFirst("f0->*") .distinct(new Id<>()); }