Crate graph_generation_language

Source
Expand description

§Graph Generation Language (GGL)

GGL is a domain-specific language for creating and manipulating graphs through declarative syntax.

§Overview

GGL allows you to:

  • Define graph structures using intuitive node and edge declarations
  • Generate common graph topologies with built-in generators
  • Apply transformation rules to modify graph structure
  • Export graphs in standard JSON format

§Quick Example

graph social_network {
    // Define nodes with types and attributes
    node alice :person [name="Alice", age=30];
    node bob :person [name="Bob", age=25];

    // Create relationships
    edge friendship: alice -- bob [strength=0.8];

    // Generate additional structure
    generate complete {
        nodes: 5;
        prefix: "user";
    }

    // Apply transformation rules
    rule add_metadata {
        lhs { node N :person; }
        rhs { node N :person [active=true]; }
    }

    apply add_metadata 10 times;
}

§Features

  • Declarative Syntax: Define graphs using intuitive node and edge declarations
  • Built-in Generators: Create common graph structures (complete, path, cycle, grid, star, tree, scale-free)
  • Transformation Rules: Apply pattern-based rules to modify graph structure
  • Rich Attributes: Support for typed nodes and edges with metadata
  • JSON Output: Export graphs in standard JSON format

§Getting Started

§Installation

Prerequisites:

  • Rust 1.70 or later
  • Cargo (comes with Rust)

Building from source:

git clone https://github.com/ocasazza/graph-generation-language.git
cd graph-generation-language
cargo build --release

§Your First Graph

Create a simple graph:

graph hello_world {
    node alice;
    node bob;
    edge friendship: alice -- bob;
}

§Modules

  • types - Core data structures for nodes, edges, and graphs
  • parser - GGL language parser and AST definitions
  • generators - Built-in graph generators for common topologies
  • rules - Transformation rule engine for graph manipulation

Modules§

generators
Graph Generators
parser
rules
types
Core Data Types

Structs§

GGLEngine
The main GGL engine for parsing and executing GGL programs.

Functions§

set_panic_hook
Sets up panic hook for better error reporting in WebAssembly environments.