Graph Generation Language (GGL)
A domain-specific language for creating and manipulating graphs through declarative syntax. GGL allows you to define graph structures, generate common graph topologies, and apply transformation rules to evolve graphs over time. st suites including parser, generator, rule, and integration tests.
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
Quick Start
Commands
We also provide a justfile for Makefile'esque commands to be run inside of the devShell.
Installation
Option 1: Using Nix Flake (Recommended)
If you have Nix and direnv installed:
This repo uses Flakes from the get-go.
# Dev shell
# or run via cargo
# build
Option 2: Manual Installation
For documentation building, you'll also need:
Basic Example
graph social_network {
// Define nodes with types and attributes
node alice :person [name="Alice", age=30];
node bob :person [name="Bob", age=25];
node company :organization [name="Tech Corp"];
// Create relationships
edge friendship: alice -- bob [strength=0.8];
edge employment: alice -> company [role="Engineer"];
// 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;
}
Running
# Run with your GGL file
# Run tests
Tips
- Run
nix flake updateto update all flake inputs. - Run
nix --accept-flake-config run github:juspay/omnix cito build all outputs. - [pre-commit] hooks will automatically be setup in Nix shell. You can also run
pre-commit run -amanually to run the hooks (e.g.: to autoformat the project tree usingrustfmt,nixpkgs-fmt, etc.).
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with Rust and Pest parser
- Zulip
- nixos.wiki: Packaging Rust projects with nix