or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

algorithm-drivers.mdindex.mdinput-sources.mdlegacy-examples.mdparameter-system.mdrunner-framework.md
tile.json

runner-framework.mddocs/

Runner Framework

The Runner framework provides a unified command-line interface for executing graph algorithms with configurable inputs and outputs. It serves as the main entry point for the flink-gelly-examples library and coordinates algorithm execution through a consistent parameter-driven approach.

Capabilities

Main Execution Entry Point

The primary entry point for command-line execution of graph algorithms.

/**
 * Main class that executes Flink graph processing drivers
 * Coordinates input sources, algorithms, and output formatters
 */
public class Runner {
  /**
   * Command-line entry point for executing graph algorithms
   * @param args Command-line arguments specifying algorithm, input, and output
   * @throws Exception if execution fails or parameters are invalid
   */
  public static void main(String[] args) throws Exception;
}

Usage Pattern:

flink run flink-gelly-examples_2.10-1.3.3.jar \
  --algorithm <algorithm_name> [algorithm_options] \
  --input <input_name> [input_options] \
  --output <output_name> [output_options]

Available Commands:

  • List algorithms: flink run flink-gelly-examples_2.10-1.3.3.jar (no parameters)
  • Algorithm help: flink run flink-gelly-examples_2.10-1.3.3.jar --algorithm <name>

Algorithm Registry

The Runner maintains registries of available algorithms and input sources through parameterized factories.

/**
 * Factory for creating parameterized instances by name
 * Provides iteration over available implementations
 */
private static class ParameterizedFactory<T extends Parameterized> 
    implements Iterable<T> {
  
  /**
   * Add a class to the factory registry
   * @param cls Class extending T to register
   * @return this factory for method chaining
   */
  public ParameterizedFactory<T> addClass(Class<? extends T> cls);
  
  /**
   * Get an instance by name
   * @param name String matching getName() of registered class
   * @return Instance of the named class or null if not found
   */
  public T get(String name);
}

Supported Algorithms

The Runner framework supports the following graph algorithms:

  • AdamicAdar: Similarity score weighted by centerpoint degree
  • ClusteringCoefficient: Local clustering coefficient computation
  • ConnectedComponents: Connected component detection using GSA
  • EdgeList: Simple graph edge list output
  • GraphMetrics: Comprehensive graph metrics computation
  • HITS: Hub and authority scoring algorithm
  • JaccardIndex: Jaccard similarity coefficient computation
  • PageRank: Link analysis ranking algorithm
  • TriangleListing: Triangle enumeration in graphs

Usage Examples:

# Run PageRank with damping factor 0.9 and 20 iterations
flink run flink-gelly-examples_2.10-1.3.3.jar \
  --algorithm PageRank \
  --dampingFactor 0.9 \
  --iterationConvergence "20;0.001" \
  --input CompleteGraph --vertex_count 1000 \
  --output print

# Run Connected Components on CSV data
flink run flink-gelly-examples_2.10-1.3.3.jar \
  --algorithm ConnectedComponents \
  --input CSV --input_filename edges.csv --type long \
  --output csv --output_filename components.csv

Supported Input Sources

The Runner framework supports various graph input sources:

  • CSV: Read graphs from CSV files with configurable delimiters and key types
  • CirculantGraph: Generate circulant graphs with offset ranges
  • CompleteGraph: Generate complete graphs (all vertices connected)
  • CycleGraph: Generate cycle/ring graphs
  • EchoGraph: Generate echo graphs with specified vertex degree
  • EmptyGraph: Generate graphs with vertices but no edges
  • GridGraph: Generate multi-dimensional grid graphs
  • HypercubeGraph: Generate N-dimensional hypercube graphs
  • PathGraph: Generate linear path graphs
  • RMatGraph: Generate R-MAT scale-free random graphs
  • SingletonEdgeGraph: Generate graphs with singleton edges
  • StarGraph: Generate star topology graphs

Usage Examples:

# Use R-MAT generator with 2^12 vertices and edge factor 8
--input RMatGraph --scale 12 --edge_factor 8 --seed 12345

# Use CSV input with string keys and custom delimiters
--input CSV --input_filename graph.txt --type string \
  --input_field_delimiter ";" --comment_prefix "//"

# Use 3D grid graph with wrapped endpoints
--input GridGraph --dim0 "10:true" --dim1 "10:false" --dim2 "5:true"

Supported Output Formats

The Runner framework supports multiple output formats depending on algorithm capabilities:

  • CSV: Write results to CSV files with configurable delimiters
  • Print: Output results to console for inspection
  • Hash: Compute and display hash of results for verification

Output Examples:

# CSV output with custom delimiters
--output csv --output_filename results.csv \
  --output_line_delimiter "\n" --output_field_delimiter ","

# Console output
--output print

# Hash verification
--output hash

Error Handling and Help

The Runner provides comprehensive error handling and usage help:

/**
 * List available algorithms with descriptions
 * @return Formatted string listing all registered algorithms
 */
private static String getAlgorithmsListing();

/**
 * Display usage for a specific algorithm including compatible inputs and outputs
 * @param algorithmName Name of the algorithm to show usage for
 * @return Formatted usage string with all options
 */
private static String getAlgorithmUsage(String algorithmName);

Error Conditions:

  • Missing required parameters throw ProgramParametrizationException
  • Invalid algorithm names throw ProgramParametrizationException
  • Invalid input types throw ProgramParametrizationException
  • Unsupported output formats throw ProgramParametrizationException

Help Usage:

# List all available algorithms
flink run flink-gelly-examples_2.10-1.3.3.jar

# Show help for specific algorithm
flink run flink-gelly-examples_2.10-1.3.3.jar --algorithm PageRank

# Invalid parameters show usage automatically
flink run flink-gelly-examples_2.10-1.3.3.jar --algorithm InvalidAlgorithm

Types

// Core execution interfaces
interface Driver<K, VV, EV> extends Parameterized {
  String getShortDescription();
  String getLongDescription(); 
  void plan(Graph<K, VV, EV> graph) throws Exception;
}

interface Input<K, VV, EV> extends Parameterized {
  String getIdentity();
  Graph<K, VV, EV> create(ExecutionEnvironment env) throws Exception;
}

// Output format interfaces
interface CSV {
  void writeCSV(String filename, String lineDelimiter, String fieldDelimiter) throws Exception;
}

interface Print {
  void print(String executionName) throws Exception;
}

interface Hash {
  void hash(String executionName) throws Exception;
}

// Parameter parsing and validation
class ParameterTool {
  public static ParameterTool fromArgs(String[] args);
  public String get(String key);
  public String getRequired(String key) throws RuntimeException;
  public boolean has(String key);
}

class ProgramParametrizationException extends Exception {
  public ProgramParametrizationException(String message);
}