• Graph Algorithms

    Graph Algorithms

    The logic blocks with which the Graph API and top-level algorithms are assembled are accessible in Gelly as graphalgorithms in the org.apache.flink.graph.asm package. These algorithms provide optimization and tuning throughconfiguration parameters and may provide implicit runtime reuse when processing the same input with a similarconfiguration.

    AlgorithmDescription
    degree.annotate.directed.VertexInDegreeAnnotate vertices of a directed graph with the in-degree.
    1. DataSet<Vertex<K, LongValue>> inDegree = graph .run(new VertexInDegree() .setIncludeZeroDegreeVertices(true));
    Optional configuration:-setIncludeZeroDegreeVertices: by default only the edge set is processed for the computation of degree; when this flag is set an additional join is performed against the vertex set in order to output vertices with an in-degree of zero-setParallelism: override the operator parallelism
    degree.annotate.directed.VertexOutDegreeAnnotate vertices of a directed graph with the out-degree.
    1. DataSet<Vertex<K, LongValue>> outDegree = graph .run(new VertexOutDegree() .setIncludeZeroDegreeVertices(true));
    Optional configuration:-setIncludeZeroDegreeVertices: by default only the edge set is processed for the computation of degree; when this flag is set an additional join is performed against the vertex set in order to output vertices with an out-degree of zero-setParallelism: override the operator parallelism
    degree.annotate.directed.VertexDegreesAnnotate vertices of a directed graph with the degree, out-degree, and in-degree.
    1. DataSet<Vertex<K, Tuple2<LongValue, LongValue>>> degrees = graph .run(new VertexDegrees() .setIncludeZeroDegreeVertices(true));
    Optional configuration:-setIncludeZeroDegreeVertices: by default only the edge set is processed for the computation of degree; when this flag is set an additional join is performed against the vertex set in order to output vertices with out- and in-degree of zero-setParallelism: override the operator parallelism
    degree.annotate.directed.EdgeSourceDegreesAnnotate edges of a directed graph with the degree, out-degree, and in-degree of the source ID.
    1. DataSet<Edge<K, Tuple2<EV, Degrees>>> sourceDegrees = graph .run(new EdgeSourceDegrees());
    Optional configuration:-setParallelism: override the operator parallelism
    degree.annotate.directed.EdgeTargetDegreesAnnotate edges of a directed graph with the degree, out-degree, and in-degree of the target ID.
    1. DataSet<Edge<K, Tuple2<EV, Degrees>>> targetDegrees = graph .run(new EdgeTargetDegrees();
    Optional configuration:-setParallelism: override the operator parallelism
    degree.annotate.directed.EdgeDegreesPairAnnotate edges of a directed graph with the degree, out-degree, and in-degree of both the source and target vertices.
    1. DataSet<Edge<K, Tuple2<EV, Degrees>>> degrees = graph .run(new EdgeDegreesPair());
    Optional configuration:-setParallelism: override the operator parallelism
    degree.annotate.undirected.VertexDegreeAnnotate vertices of an undirected graph with the degree.
    1. DataSet<Vertex<K, LongValue>> degree = graph .run(new VertexDegree() .setIncludeZeroDegreeVertices(true) .setReduceOnTargetId(true));
    Optional configuration:-setIncludeZeroDegreeVertices: by default only the edge set is processed for the computation of degree; when this flag is set an additional join is performed against the vertex set in order to output vertices with a degree of zero-setParallelism: override the operator parallelism-setReduceOnTargetId: the degree can be counted from either the edge source or target IDs. By default the source IDs are counted. Reducing on target IDs may optimize the algorithm if the input edge list is sorted by target ID.
    degree.annotate.undirected.EdgeSourceDegreeAnnotate edges of an undirected graph with degree of the source ID.
    1. DataSet<Edge<K, Tuple2<EV, LongValue>>> sourceDegree = graph .run(new EdgeSourceDegree() .setReduceOnTargetId(true));
    Optional configuration:-setParallelism: override the operator parallelism-setReduceOnTargetId: the degree can be counted from either the edge source or target IDs. By default the source IDs are counted. Reducing on target IDs may optimize the algorithm if the input edge list is sorted by target ID.
    degree.annotate.undirected.EdgeTargetDegreeAnnotate edges of an undirected graph with degree of the target ID.
    1. DataSet<Edge<K, Tuple2<EV, LongValue>>> targetDegree = graph .run(new EdgeTargetDegree() .setReduceOnSourceId(true));
    Optional configuration:-setParallelism: override the operator parallelism-setReduceOnSourceId: the degree can be counted from either the edge source or target IDs. By default the target IDs are counted. Reducing on source IDs may optimize the algorithm if the input edge list is sorted by source ID.
    degree.annotate.undirected.EdgeDegreePairAnnotate edges of an undirected graph with the degree of both the source and target vertices.
    1. DataSet<Edge<K, Tuple3<EV, LongValue, LongValue>>> pairDegree = graph .run(new EdgeDegreePair() .setReduceOnTargetId(true));
    Optional configuration:-setParallelism: override the operator parallelism-setReduceOnTargetId: the degree can be counted from either the edge source or target IDs. By default the source IDs are counted. Reducing on target IDs may optimize the algorithm if the input edge list is sorted by target ID.
    degree.filter.undirected.MaximumDegreeFilter an undirected graph by maximum degree.
    1. Graph<K, VV, EV> filteredGraph = graph .run(new MaximumDegree(5000) .setBroadcastHighDegreeVertices(true) .setReduceOnTargetId(true));
    Optional configuration:-setBroadcastHighDegreeVertices: join high-degree vertices using a broadcast-hash to reduce data shuffling when removing a relatively small number of high-degree vertices.-setParallelism: override the operator parallelism-setReduceOnTargetId: the degree can be counted from either the edge source or target IDs. By default the source IDs are counted. Reducing on target IDs may optimize the algorithm if the input edge list is sorted by target ID.
    simple.directed.SimplifyRemove self-loops and duplicate edges from a directed graph.
    1. graph.run(new Simplify());
    Optional configuration:-setParallelism: override the operator parallelism
    simple.undirected.SimplifyAdd symmetric edges and remove self-loops and duplicate edges from an undirected graph.
    1. graph.run(new Simplify());
    Optional configuration:-setParallelism: override the operator parallelism
    translate.TranslateGraphIdsTranslate vertex and edge IDs using the given TranslateFunction.
    1. graph.run(new TranslateGraphIds(new LongValueToStringValue()));
    Required configuration:-translator: implements type or value conversionOptional configuration:-setParallelism: override the operator parallelism
    translate.TranslateVertexValuesTranslate vertex values using the given TranslateFunction.
    1. graph.run(new TranslateVertexValues(new LongValueAddOffset(vertexCount)));
    Required configuration:-translator: implements type or value conversionOptional configuration:-setParallelism: override the operator parallelism
    translate.TranslateEdgeValuesTranslate edge values using the given TranslateFunction.
    1. graph.run(new TranslateEdgeValues(new Nullify()));
    Required configuration:-translator: implements type or value conversionOptional configuration:-setParallelism: override the operator parallelism