/** * add graph to output * @param caption output caption * @param graph graph */ public void add(String caption, LogicalGraph graph) { add(caption, graph.getConfig().getGraphCollectionFactory().fromGraph(graph)); }
/** * Prints the logical graph to the standard output. * * @param logicalGraph The logical graph that is supposed to be printed. * @throws Exception Forwarded from flink execute. */ public static void print(LogicalGraph logicalGraph) throws Exception { GraphCollectionFactory collectionFactory = logicalGraph.getConfig().getGraphCollectionFactory(); GraphCollection graphCollection = collectionFactory.fromGraph(logicalGraph); print(graphCollection); }
@Override public void write(LogicalGraph logicalGraph, boolean overwrite) throws IOException { write(logicalGraph.getConfig().getGraphCollectionFactory().fromGraph(logicalGraph), overwrite); }
@Override public void write(LogicalGraph logicalGraph, boolean overwrite) throws IOException { write(logicalGraph.getConfig().getGraphCollectionFactory().fromGraph(logicalGraph), overwrite); }
@Override public void write(LogicalGraph logicalGraph, boolean overwrite) throws IOException { write(logicalGraph.getConfig().getGraphCollectionFactory().fromGraph(logicalGraph), overwrite); }
@Override public DataSet<Boolean> execute(LogicalGraph firstGraph, LogicalGraph secondGraph) { GraphCollectionFactory collectionFactory = firstGraph.getConfig() .getGraphCollectionFactory(); return collectionEquality .execute(collectionFactory.fromGraph(firstGraph), collectionFactory.fromGraph(secondGraph)); }
@Override public DataSet<Boolean> execute(LogicalGraph firstGraph, LogicalGraph secondGraph) { GraphCollectionFactory collectionFactory = firstGraph.getConfig() .getGraphCollectionFactory(); return collectionEquality .execute(collectionFactory.fromGraph(firstGraph), collectionFactory.fromGraph(secondGraph)); } }
/** * Default transformation from a Gradoop Graph to a Gelly Graph. * * @param graph Gradoop Graph. * @return Gelly Graph. */ public Graph<GradoopId, VV, EV> transformToGelly(LogicalGraph graph) { DataSet<Vertex<GradoopId, VV>> gellyVertices = graph.getVertices().map(toGellyVertex); DataSet<Edge<GradoopId, EV>> gellyEdges = graph.getEdges().map(toGellyEdge); return Graph.fromDataSet(gellyVertices, gellyEdges, graph.getConfig().getExecutionEnvironment()); }
public static void printDirectedCanonicalAdjacencyMatrix(LogicalGraph graph) throws Exception { printDirectedCanonicalAdjacencyMatrix(graph.getConfig().getGraphCollectionFactory() .fromGraph(graph)); }
/** * Test writing and reading the given graph to and from IndexedCSV. * * @param tmpPath path to write csv * @param input logical graph * @throws Exception if the execution or IO fails. */ private void checkIndexedCSVWrite(String tmpPath, LogicalGraph input) throws Exception { checkIndexedCSVWrite(tmpPath, input.getConfig().getGraphCollectionFactory().fromGraph(input)); }
/** * Test writing and reading the given graph to and from CSV * * @param tmpPath path to write csv * @param input logical graph * @throws Exception if the execution or IO fails. */ private void checkCSVWrite(String tmpPath, LogicalGraph input) throws Exception { checkCSVWrite(tmpPath, input.getConfig().getGraphCollectionFactory().fromGraph(input)); }
public static void printUndirectedCanonicalAdjacencyMatrix(LogicalGraph graph) throws Exception { printUndirectedCanonicalAdjacencyMatrix(graph.getConfig().getGraphCollectionFactory() .fromGraph(graph)); }
@Override public DataSet<Boolean> isEmpty() { return getVertices() .map(new True<>()) .distinct() .union(getConfig().getExecutionEnvironment().fromElements(false)) .reduce(new Or()) .map(new Not()); }
/** * {@inheritDoc} */ @Override public DataSet<Boolean> isEmpty() { return getVertices() .map(new True<>()) .distinct() .union(getConfig().getExecutionEnvironment().fromElements(false)) .reduce(new Or()) .map(new Not()); }
@Override public LogicalGraph executeInGelly(Graph<GradoopId, PropertyValue, NullValue> graph) { DataSet<Vertex> labeledVertices = executeInternal(graph) .join(currentGraph.getVertices()) .where(0).equalTo(new Id<>()) .with(new LPVertexJoin(propertyKey)); // return labeled graph return currentGraph.getConfig().getLogicalGraphFactory() .fromDataSets(labeledVertices, currentGraph.getEdges()); }
@Override public GraphCollection execute(LogicalGraph graph) { LogicalGraph graphWithWccIds = graph.callForGraph(new AnnotateWeaklyConnectedComponents( propertyKey, maxIterations)); GraphCollection split = graphWithWccIds.splitBy(propertyKey); return graph.getConfig().getGraphCollectionFactory().fromDataSets( split.getGraphHeads(), split.getVertices().map(new PropertyRemover<>(propertyKey)), split.getEdges().map(new PropertyRemover<>(propertyKey))); }
@Override public GraphCollection execute(LogicalGraph graph) { LogicalGraph graphWithWccIds = graph.callForGraph(new AnnotateWeaklyConnectedComponents( propertyKey, maxIterations)); GraphCollection split = graphWithWccIds.splitBy(propertyKey); return graph.getConfig().getGraphCollectionFactory().fromDataSets( split.getGraphHeads(), split.getVertices().map(new PropertyRemover<>(propertyKey)), split.getEdges().map(new PropertyRemover<>(propertyKey))); } }
@Override public LogicalGraph execute(LogicalGraph graph) { DataSet<Vertex> vertices = graph.getVertices(); DataSet<Edge> edges = graph.getEdges(); DataSet<Map<String, PropertyValue>> aggregate = aggregateVertices(vertices) .union(aggregateEdges(edges)) .reduceGroup(new CombinePartitionAggregates(aggregateFunctions)); DataSet<GraphHead> graphHead = graph.getGraphHead() .map(new SetAggregateProperty(aggregateFunctions)) .withBroadcastSet(aggregate, SetAggregateProperty.VALUE); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(graphHead, vertices, edges); }
@Override public LogicalGraph executeInGelly(Graph<GradoopId, NullValue, NullValue> graph) throws Exception { DataSet<Vertex> newVertices = new org.apache.flink.graph.library.linkanalysis.PageRank<GradoopId, NullValue, NullValue>( dampingFactor, iterations).setIncludeZeroDegreeVertices(includeZeroDegrees).run(graph) .join(currentGraph.getVertices()) .where(new PageRankResultKey()).equalTo(new Id<>()) .with(new PageRankToAttribute(propertyKey)); return currentGraph.getConfig().getLogicalGraphFactory().fromDataSets( currentGraph.getGraphHead(), newVertices, currentGraph.getEdges()); }
@Override public LogicalGraph executeInGelly(Graph<GradoopId, NullValue, NullValue> graph) throws Exception { DataSet<Vertex> newVertices = new org.apache.flink.graph.library.linkanalysis.PageRank<GradoopId, NullValue, NullValue>( dampingFactor, iterations).setIncludeZeroDegreeVertices(includeZeroDegrees).run(graph) .join(currentGraph.getVertices()) .where(new PageRankResultKey()).equalTo(new Id<>()) .with(new PageRankToAttribute(propertyKey)); return currentGraph.getConfig().getLogicalGraphFactory().fromDataSets( currentGraph.getGraphHead(), newVertices, currentGraph.getEdges()); } }