/** * Creates a new logical graph by union the vertex and edge sets of all graph * contained in the given collection. * * @param collection input collection * @return combined graph */ @Override public LogicalGraph execute(GraphCollection collection) { return collection.getConfig().getLogicalGraphFactory().fromDataSets( collection.getVertices(), collection.getEdges()); }
@Override public GraphCollection execute(GraphCollection collection) { config = collection.getConfig(); DataSet<GraphTransaction> input = collection .getGraphTransactions(); DataSet<GraphTransaction> output = execute(input); return config.getGraphCollectionFactory() .fromTransactions(output); }
@Override public GraphCollection execute(GraphCollection collection) { config = collection.getConfig(); DataSet<GraphTransaction> input = collection .getGraphTransactions(); DataSet<GraphTransaction> output = execute(input); return config.getGraphCollectionFactory() .fromTransactions(output); }
/** * Creates a new logical graph by union the vertex and edge sets of all graph * contained in the given collection. * * @param collection input collection * @return combined graph */ @Override public LogicalGraph execute(GraphCollection collection) { return collection.getConfig().getLogicalGraphFactory().fromDataSets( collection.getVertices(), collection.getEdges()); } }
@Override public GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> updatedTransactions = collection.getGraphTransactions() .map(new AggregateTransactions(aggregateFunctions)); return collection.getConfig().getGraphCollectionFactory().fromTransactions(updatedTransactions); }
@Override public GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> updatedTransactions = collection.getGraphTransactions() .map(new AggregateTransactions(aggregateFunctions)); return collection.getConfig().getGraphCollectionFactory().fromTransactions(updatedTransactions); }
@Override public GraphCollection execute( GraphCollection firstCollection, GraphCollection secondCollection) { // do some init stuff for the actual operator this.firstCollection = firstCollection; this.secondCollection = secondCollection; final DataSet<GraphHead> newGraphHeads = computeNewGraphHeads(); final DataSet<Vertex> newVertices = computeNewVertices(newGraphHeads); final DataSet<Edge> newEdges = computeNewEdges(newVertices); return firstCollection.getConfig().getGraphCollectionFactory() .fromDataSets(newGraphHeads, newVertices, newEdges); }
/** * Executes the operator for collections based on * {@link org.gradoop.flink.model.impl.layouts.transactional.TxCollectionLayout} * * @param collection graph collection * @return result graph collection */ private GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> filteredTransactions = collection.getGraphTransactions() .filter(new FilterTransactions(predicate)); return collection.getConfig().getGraphCollectionFactory() .fromTransactions(filteredTransactions); }
/** * Executes the operator for collections based on * {@link org.gradoop.flink.model.impl.layouts.transactional.TxCollectionLayout} * * @param collection graph collection * @return result graph collection */ private GraphCollection executeForTxLayout(GraphCollection collection) { DataSet<GraphTransaction> filteredTransactions = collection.getGraphTransactions() .filter(new FilterTransactions(predicate)); return collection.getConfig().getGraphCollectionFactory() .fromTransactions(filteredTransactions); } }
@Override public GraphCollection execute(GraphCollection collection) { // convert Gradoop graph collection to DIMSpan input format DataSet<LabeledGraphStringString> input = collection .getGraphTransactions() .map(new EPGMGraphTransactionToLabeledGraph()); // run DIMSpan DataSet<GraphTransaction> output = dimSpan.execute(input); // convert to Gradoop graph collection return collection.getConfig().getGraphCollectionFactory().fromTransactions(output); }
@Override public GraphCollection execute(GraphCollection collection) { // convert Gradoop graph collection to DIMSpan input format DataSet<LabeledGraphStringString> input = collection .getGraphTransactions() .map(new EPGMGraphTransactionToLabeledGraph()); // run DIMSpan DataSet<GraphTransaction> output = dimSpan.execute(input); // convert to Gradoop graph collection return collection.getConfig().getGraphCollectionFactory().fromTransactions(output); }
@Override public GraphCollection execute(GraphCollection collection) { return collection.getConfig().getGraphCollectionFactory().fromDataSets( collection.getGraphHeads().distinct(new Id<>()), collection.getVertices(), collection.getEdges()); }
@Override public GraphCollection execute(GraphCollection collection) { return collection.getConfig().getGraphCollectionFactory().fromDataSets( collection.getGraphHeads().distinct(new Id<>()), collection.getVertices(), collection.getEdges()); } }
@Override public DataSet<String> execute(GraphCollection collection) { // 1-10. DataSet<GraphHeadString> graphHeadLabels = getGraphHeadStrings(collection); // 11. add empty head to prevent empty result for empty collection graphHeadLabels = graphHeadLabels .union(collection .getConfig() .getExecutionEnvironment() .fromElements(new GraphHeadString(GradoopId.get(), ""))); // 12. label collection return graphHeadLabels .reduceGroup(new ConcatGraphHeadStrings()); }
@Override public GraphCollection executeForGVELayout(GraphCollection collection) { // the resulting logical graph holds multiple graph heads LogicalGraph modifiedGraph = executeInternal( collection.getGraphHeads(), collection.getVertices(), collection.getEdges(), collection.getConfig().getLogicalGraphFactory()); return collection.getFactory().fromDataSets( modifiedGraph.getGraphHead(), modifiedGraph.getVertices(), modifiedGraph.getEdges()); }
@Override public GraphCollection executeForGVELayout(GraphCollection collection) { // the resulting logical graph holds multiple graph heads LogicalGraph modifiedGraph = executeInternal( collection.getGraphHeads(), collection.getVertices(), collection.getEdges(), collection.getConfig().getLogicalGraphFactory()); return collection.getFactory().fromDataSets( modifiedGraph.getGraphHead(), modifiedGraph.getVertices(), modifiedGraph.getEdges()); }
/** * {@inheritDoc} */ @Override public DataSet<Boolean> isEmpty() { return getGraphHeads() .map(new True<>()) .distinct() .union(getConfig().getExecutionEnvironment().fromElements(false)) .reduce(new Or()) .map(new Not()); }
@Override public DataSet<Boolean> isEmpty() { return getGraphHeads() .map(new True<>()) .distinct() .union(getConfig().getExecutionEnvironment().fromElements(false)) .reduce(new Or()) .map(new Not()); }
@Override public LogicalGraph getGraph(final GradoopId graphID) { // filter vertices and edges based on given graph id DataSet<GraphHead> graphHead = getGraphHeads() .filter(new BySameId<>(graphID)); DataSet<Vertex> vertices = getVertices() .filter(new InGraph<>(graphID)); DataSet<Edge> edges = getEdges() .filter(new InGraph<>(graphID)); return new LogicalGraph( config.getLogicalGraphFactory().fromDataSets(graphHead, vertices, edges), getConfig()); }
@Override public GraphCollection execute(GraphCollection collection) { DataSet<GraphHead> graphHeads = collection.getGraphHeads().first(limit); DataSet<GradoopId> firstIds = graphHeads.map(new Id<>()); DataSet<Vertex> filteredVertices = collection.getVertices() .filter(new InAnyGraphBroadcast<>()) .withBroadcastSet(firstIds, GraphsContainmentFilterBroadcast.GRAPH_IDS); DataSet<Edge> filteredEdges = collection.getEdges() .filter(new InAnyGraphBroadcast<>()) .withBroadcastSet(firstIds, GraphsContainmentFilterBroadcast.GRAPH_IDS); return collection.getConfig().getGraphCollectionFactory() .fromDataSets(graphHeads, filteredVertices, filteredEdges); }