libpetri-export — DOT/Graphviz Export Pipeline
Converts a PetriNet into a
DOT string for Graphviz rendering.
Architecture
The pipeline has four layers, separating concerns cleanly:
PetriNet ──► map_to_graph() ──► Graph ──► render_dot() ──► DOT string
(knows Petri nets) (format-agnostic)
- Styles ([
styles]) — Color/shape constants from the shared spec - Graph model ([
graph]) — Format-agnostic typed graph (nodes, edges, clusters) - Mapper ([
mapper]) — Petri net → Graph (place classification, arc styling) - Renderer ([
dot_renderer]) — Graph → DOT string (no Petri net knowledge)
Quick Start
use Place;
use Transition;
use PetriNet;
use one;
use out_place;
use fork;
use dot_export;
let p1 = new;
let p2 = new;
let t = builder
.input
.output
.action
.build;
let net = builder.transition.build;
let dot = dot_export;
assert!;
Example Output
Configuration
DotConfig controls rendering:
| Field | Default | Effect |
|---|---|---|
direction |
TopToBottom |
Graph layout direction |
show_types |
true |
Display place token types |
show_intervals |
true |
Display timing intervals on transitions |
show_priority |
true |
Display priority values |
environment_places |
{} |
Place names styled as external event sources |
Visual Vocabulary
- Green circles — start places (no incoming arcs)
- Blue circles — end places (no outgoing arcs)
- Red dashed circles — environment places (external event injection)
- Solid arrows — input/output arcs
- Dashed arrows — read arcs
- Dot-headed arrows — inhibitor arcs
- Double arrows — reset arcs