A collection of example applications demonstrating graph processing algorithms using Apache Flink's Gelly Graph API
—
Collection of graph processing algorithms implementing the standardized Driver interface. Each algorithm provides configurable parameters, analytics reporting, and consistent execution patterns.
Base interface that all graph algorithms must implement, providing standardized algorithm description, execution, and analytics.
/**
* Base interface for all graph processing algorithms
* @param <K> Vertex key type
* @param <VV> Vertex value type
* @param <EV> Edge value type
*/
public interface Driver<K, VV, EV> extends Parameterized {
/** One-line algorithm description for command-line listings */
String getShortDescription();
/** Multi-line detailed algorithm description with usage information */
String getLongDescription();
/** Execute the algorithm on the input graph */
DataSet plan(Graph<K, VV, EV> graph) throws Exception;
/** Print algorithm-specific analytics and results to console */
void printAnalytics(PrintStream out);
}Base implementation providing common functionality for algorithm drivers.
/**
* Base class for algorithm drivers with common parameter handling
*/
public abstract class DriverBase<K, VV, EV> extends ParameterizedBase implements Driver<K, VV, EV> {
/** Execution parallelism configuration */
LongParameter parallelism;
/** Default analytics implementation (no-op) */
public void printAnalytics(PrintStream out);
}Computes PageRank centrality scores using power iteration method with configurable damping factor and convergence criteria.
/**
* PageRank centrality algorithm with configurable parameters
*/
public class PageRank extends DriverBase<K, VV, EV> {
/** PageRank damping factor (default: 0.85) */
DoubleParameter dampingFactor;
/** Iteration convergence control */
IterationConvergence iterationConvergence;
/** Include zero-degree vertices in results */
BooleanParameter includeZeroDegreeVertices;
}Usage Examples:
# Basic PageRank execution
--algorithm PageRank --damping_factor 0.85 --iterations 10
# PageRank with convergence threshold
--algorithm PageRank --damping_factor 0.9 --convergence_threshold 0.001Finds connected components in undirected graphs using iterative label propagation.
/**
* Connected components algorithm for finding graph connectivity
*/
public class ConnectedComponents extends DriverBase<K, VV, EV> {
// Inherits parallelism parameter from DriverBase
}Usage Examples:
# Find connected components
--algorithm ConnectedComponents
# With custom parallelism
--algorithm ConnectedComponents --parallelism 4Computes Hub and Authority scores using Hyperlink-Induced Topic Search algorithm.
/**
* HITS (Hyperlink-Induced Topic Search) algorithm
* Computes hub and authority scores for directed graphs
*/
public class HITS extends DriverBase<K, VV, EV> {
// Implementation details handled by base class parameters
}Computes local and global clustering coefficients measuring graph transitivity.
/**
* Clustering coefficient computation for measuring graph clustering
*/
public class ClusteringCoefficient extends DriverBase<K, VV, EV> {
// Computes both local coefficients per vertex and global coefficient
}Enumerates all triangles (3-cycles) in the graph for structural analysis.
/**
* Triangle listing algorithm for finding all triangles in graph
*/
public class TriangleListing extends DriverBase<K, VV, EV> {
// Lists all triangles as triplets of vertices
}Computes Adamic-Adar similarity scores for link prediction and graph analysis.
/**
* Adamic-Adar similarity measure for link prediction
*/
public class AdamicAdar extends DriverBase<K, VV, EV> {
// Computes similarity based on common neighbors weighted by neighbor degree
}Computes Jaccard similarity coefficients between vertices based on common neighbors.
/**
* Jaccard similarity index for measuring vertex similarity
*/
public class JaccardIndex extends DriverBase<K, VV, EV> {
// Computes Jaccard coefficient: |intersection| / |union|
}Computes comprehensive graph statistics and structural metrics.
/**
* Comprehensive graph metrics computation
* Provides detailed statistics about graph structure
*/
public class GraphMetrics extends DriverBase<K, VV, EV> {
// Computes vertex count, edge count, degree distribution, etc.
}Generates simple edge list representation of the graph.
/**
* Edge list generator for exporting graph structure
*/
public class EdgeList extends DriverBase<K, VV, EV> {
// Outputs graph as list of edges
}/**
* Controls iterative algorithm convergence behavior
*/
public class IterationConvergence extends ParameterizedBase {
/** Maximum number of iterations */
LongParameter iterations;
/** Convergence threshold for early termination */
DoubleParameter convergenceThreshold;
/** Enable convergence threshold checking */
BooleanParameter convergenceEnabled;
}Basic Algorithm Execution:
// Create and configure algorithm
PageRank pageRank = new PageRank();
pageRank.configure(parameterTool);
// Execute on graph
DataSet result = pageRank.plan(inputGraph);
// Print analytics
pageRank.printAnalytics(System.out);Algorithm Selection by Name:
// Get algorithm from factory
ParameterizedFactory<Driver> factory = createDriverFactory();
Driver algorithm = factory.get("PageRank");
if (algorithm != null) {
algorithm.configure(parameters);
DataSet result = algorithm.plan(graph);
algorithm.printAnalytics(System.out);
}Algorithm Listing:
// List all available algorithms
ParameterizedFactory<Driver> factory = createDriverFactory();
for (Driver algorithm : factory) {
System.out.println(algorithm.getName() + ": " + algorithm.getShortDescription());
}Install with Tessl CLI
npx tessl i tessl/maven-org-apache-flink--flink-gelly-examples-2-12