This document specifies graph export formats for visualization and formal analysis interchange.
Priority: MUST
The engine MUST support exporting the net structure to at least one standard graph format suitable for visualization. The canonical format is DOT (Graphviz), a widely-supported, text-based format.
Acceptance Criteria:
- Export produces valid, parseable output in the chosen format.
- All places and transitions in the net are represented.
- All arcs (input, output, inhibitor, read, reset) are represented.
Implementation notes:
- Java: DOT (Graphviz) format
- TypeScript: DOT (Graphviz) format
- Rust: Not yet implemented
Test derivation: Build net with all arc types; export; verify output parses correctly.
Priority: MUST
Places are rendered as distinct shapes from transitions:
- Places: circles, ellipses, or stadium-shaped nodes (following Petri net convention)
- Place names are displayed as labels
Acceptance Criteria:
- Places are visually distinguishable from transitions.
- Place names are readable.
Test derivation: Export net; verify place nodes use correct shape syntax.
Priority: MUST
Transitions are rendered as rectangles or bars (following Petri net convention). Transition names are displayed as labels.
Acceptance Criteria:
- Transitions are visually distinguishable from places.
- Transition names are readable.
Test derivation: Export net; verify transition nodes use correct shape syntax.
Priority: MUST
Each arc type has a visually distinct rendering:
- Input arc: solid arrow from place to transition
- Output arc: solid arrow from transition to place
- Inhibitor arc: arrow with circle arrowhead (standard notation)
- Read arc: dashed arrow or bidirectional arrow (test arc notation)
- Reset arc: double-line arrow or distinctive marking
Acceptance Criteria:
- Each arc type is visually distinguishable.
- Arc direction reflects flow (place→transition for input, transition→place for output).
Test derivation: Build net with all 5 arc types; export; verify each arc type has distinct rendering.
Priority: SHOULD
XOR output branches should be labeled to indicate the branching structure. Each branch of a XOR should be visually identifiable.
Acceptance Criteria:
- XOR branches have labels or visual grouping.
- The viewer can identify which outputs belong to which XOR branch.
Test derivation: Net with XOR output; export; verify branches are labeled.
Priority: SHOULD
Multi-token arcs (Exactly(n), All, AtLeast(m)) display count notation on the arc label:
- Exactly(n): label shows "×n" or "n"
- All: label shows "*" or "all"
- AtLeast(m): label shows "≥m"
Acceptance Criteria:
- Non-One cardinality is displayed on the arc.
- One cardinality has no label (default).
Test derivation: Net with Exactly(3) and AtLeast(5) inputs; export; verify labels show counts.
Priority: SHOULD
The export supports configuration options:
- Layout direction: top-to-bottom, left-to-right, etc.
- Show/hide types: toggle token type annotations
- Show/hide timing: toggle timing interval display on transitions
- Show/hide priority: toggle priority display on transitions
Acceptance Criteria:
- Configuration controls what information is displayed.
- Default configuration shows all information.
- Minimal configuration hides types, timing, and priority.
Test derivation: Export with default config; export with minimal config; verify difference.
Priority: SHOULD
The export applies visual styling to distinguish node categories:
- Start places (no incoming arcs): highlighted (e.g., green)
- End places (no outgoing arcs): highlighted (e.g., blue)
- Transitions: distinct color (e.g., yellow)
Acceptance Criteria:
- Start places are visually distinct from other places.
- End places are visually distinct from other places.
Test derivation: Net with start and end places; export; verify styling applied.
Priority: MAY
The engine MAY support exporting to formal analysis interchange formats suitable for external tools (e.g., PNML for Petri net tools, STTT format for Sirio timing analysis).
Acceptance Criteria:
- Export produces valid output in the target format.
- Places, transitions, arcs, and timing are represented.
Implementation notes:
- Not yet implemented in any language
Test derivation: Export to interchange format; validate against schema.
Priority: MAY
The engine MAY support generating diagrams from net structure annotations at compile time, embedding them in documentation or source comments.
Acceptance Criteria:
- Net structure annotations are processed at compile time.
- Diagrams are generated without running the net.
Implementation notes:
- Java:
@NetStructureannotation processed by@petrinetJavadoc taglet to generate DOT→SVG diagrams - TypeScript:
@petrinetTypeDoc plugin resolves net definitions and generates embedded SVG diagrams - Rust:
libpetri-docgenbuild-dependency crate generates DOT→SVG diagrams viaSvgGenerator/generate_svg()
Test derivation: Annotated net structure; build project; verify diagram generated.