https://github.com/bobbens/pygraphgram
A small test for grammar rewriting for procedural content generation.
https://github.com/bobbens/pygraphgram
graph-rewriting pcg
Last synced: 7 months ago
JSON representation
A small test for grammar rewriting for procedural content generation.
- Host: GitHub
- URL: https://github.com/bobbens/pygraphgram
- Owner: bobbens
- Created: 2024-05-17T12:25:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-18T13:08:31.000Z (about 2 years ago)
- Last Synced: 2025-01-02T22:43:30.200Z (over 1 year ago)
- Topics: graph-rewriting, pcg
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
A small test for grammar rewriting for procedural content generation.
Heavily inspired by [graphgram](https://github.com/ihh/graphgram).
This is more of a learning experience / demo / playground than a serious library or software.
### Features
* Ullman's Subgraph Isomorphism Algorithm for matching
* Double Pushout Algorithm for rewriting
* Grammar based on Neighbourhood Controlled Embedding Directed graph with Boundary Constraint (B-dNCE)
* Simplified embedding rules for input / output edges
* graphviz visualization support
### Usage
You can test the main script with:
```
$ python test.py
```
It should print some output and generate a pdf document showing an example generated graph.
### Files
* `graph.py`: Simple directed graph representation
* `ullman.py`: Simple implementation of Ullman's Subgraph Isomorphism Algorithm
* `grammar.py`: Contains the grammar definitions and double pushout rewriting algorithm
* `test.py`: Code demo showing all features