Graph
attribute EdgeArrow
Section titled “attribute EdgeArrow”EdgeArrow = Literal['triangle', 'circle-triangle', 'triangle-backcurve', 'tee', 'circle', 'chevron', 'triangle-tee', 'triangle-cross', 'vee', 'square', 'diamond'] | Noneclass EdgeStyle
Section titled “class EdgeStyle”class EdgeStyle(BaseModel):Visual style options for a GraphEdge.
Attributes:
dashedbool— Renders the edge as a dashed line.boldbool— Renders the edge as a bold line.
Source
class EdgeStyle(BaseModel): """Visual style options for a `GraphEdge`.
Attributes: dashed: Renders the edge as a dashed line. bold: Renders the edge as a bold line. """
dashed: bool = False bold: bool = Falseclass ElkLayoutConfig
Section titled “class ElkLayoutConfig”class ElkLayoutConfig(BaseModel):ELK-based layout configuration for a Graph visualization.
Attributes:
optionsdict[str, str | int | float | bool] | None— Additional ELK layout options passed directly to the renderer. Keys and values mirror the ELK option format (e.g.{"elk.algorithm": "force"}).
For all available options see https://eclipse.dev/elk/reference/options.html.
Source
class ElkLayoutConfig(BaseModel): """ELK-based layout configuration for a `Graph` visualization.
Attributes: options: Additional ELK layout options passed directly to the renderer. Keys and values mirror the ELK option format (e.g. ``{"elk.algorithm": "force"}``).
For all available options see https://eclipse.dev/elk/reference/options.html. """
type: Literal["elk"] = "elk" options: dict[str, str | int | float | bool] | None = Noneclass Graph
Section titled “class Graph”class Graph(Visualization):Graph visualization composed of nodes and directed edges.
This visualization is meant for model-like structures (for example Petri nets or directly-follows graphs). Layout is performed by the frontend renderer (ELK).
Attributes:
typeLiteral['graph']— Fixed discriminator"graph".nodeslist[GraphNode]— List of nodes.edgeslist[GraphEdge]— List of edges.layout_configLayoutConfig— Layout hints consumed by the renderer.
Source
class Graph(Visualization): """Graph visualization composed of nodes and directed edges.
This visualization is meant for model-like structures (for example Petri nets or directly-follows graphs). Layout is performed by the frontend renderer (ELK).
Attributes: type: Fixed discriminator `"graph"`. nodes: List of nodes. edges: List of edges. layout_config: Layout hints consumed by the renderer. """
type: Literal["graph"] = "graph" nodes: list[GraphNode] = Field(default_factory=list) edges: list[GraphEdge] = Field(default_factory=list) layout_config: LayoutConfig = Field(default_factory=ElkLayoutConfig)class GraphEdge
Section titled “class GraphEdge”class GraphEdge(AnnotatedElement):A directed edge in a Graph visualization.
An edge connects source -> target and can carry labels and arrowhead styles.
Attributes:
idstr— Unique edge id. Defaults to a generated UUID string.sourcestr— Source node id.targetstr— Target node id.colorstr | None— Optional edge color.labelstr | None— Optional label shown along the edge.styleEdgeStyle— Visual style options.start_arrowEdgeArrow— Optional arrowhead style at the start of the edge.end_arrowEdgeArrow— Optional arrowhead style at the end of the edge.start_labelstr | None— Optional label shown near the source.end_labelstr | None— Optional label shown near the target.annotationT | None— Optional attached visualization.
Source
class GraphEdge(AnnotatedElement): """A directed edge in a `Graph` visualization.
An edge connects `source` -> `target` and can carry labels and arrowhead styles.
Attributes: id: Unique edge id. Defaults to a generated UUID string. source: Source node id. target: Target node id. color: Optional edge color. label: Optional label shown along the edge. style: Visual style options. start_arrow: Optional arrowhead style at the start of the edge. end_arrow: Optional arrowhead style at the end of the edge. start_label: Optional label shown near the source. end_label: Optional label shown near the target. annotation: Optional attached visualization. """
id: str = Field(default_factory=uuid_factory) source: str target: str color: str | None = None label: str | None = None style: EdgeStyle = EdgeStyle() start_arrow: EdgeArrow = None end_arrow: EdgeArrow = None start_label: str | None = None end_label: str | None = None
layout_attrs: dict[str, str | int | float | bool] | None = Noneclass GraphNode
Section titled “class GraphNode”class GraphNode(AnnotatedElement):A node in a Graph visualization.
A node defines its identity and visual appearance (shape, label, colors, size).
Layout coordinates (x, y) are typically filled by the layouting step, not
by the resource author.
Attributes:
idstr— Unique node id. Defaults to a generated UUID string.labelstr | None— Optional label shown near the node.shapeGraphShapes— Node shape identifier.widthfloat | None— Optional node width.heightfloat | None— Optional node height.colorstr | None— Optional fill color (for example hex).xfloat | None— Optional x-coordinate after layouting.yfloat | None— Optional y-coordinate after layouting.border_colorstr | None— Optional border/stroke color.styleNodeStyle— Visual style options.label_posLiteral['top', 'center', 'bottom']— Label position relative to the node.rankLiteral['source', 'sink'] | int | None— Optional layout constraint (source/sink or numeric rank).annotationT | None— Optional attached visualization.
Source
class GraphNode(AnnotatedElement): """A node in a `Graph` visualization.
A node defines its identity and visual appearance (shape, label, colors, size). Layout coordinates (`x`, `y`) are typically filled by the layouting step, not by the resource author.
Attributes: id: Unique node id. Defaults to a generated UUID string. label: Optional label shown near the node. shape: Node shape identifier. width: Optional node width. height: Optional node height. color: Optional fill color (for example hex). x: Optional x-coordinate after layouting. y: Optional y-coordinate after layouting. border_color: Optional border/stroke color. style: Visual style options. label_pos: Label position relative to the node. rank: Optional layout constraint (source/sink or numeric rank). annotation: Optional attached visualization. """
id: str = Field(default_factory=uuid_factory) label: str | None = None shape: GraphShapes width: float | None = None height: float | None = None color: str | None = None x: float | None = None y: float | None = None border_color: str | None = None style: NodeStyle = NodeStyle() label_pos: Literal["top", "center", "bottom"] = "center"
rank: Literal["source", "sink"] | int | None = None layout_attrs: dict[str, str | int | float | bool] | None = Noneattribute GraphShapes
Section titled “attribute GraphShapes”GraphShapes = Literal['circle', 'triangle', 'rectangle', 'diamond', 'hexagon']class GraphvizLayoutConfig
Section titled “class GraphvizLayoutConfig”class GraphvizLayoutConfig(BaseModel):Source
class GraphvizLayoutConfig(BaseModel): type: Literal["graphviz"] = "graphviz" engine: GraphvizLayoutEngineName = "dot" graphAttrs: dict[str, str | int | float | bool] | None = None nodeAttrs: dict[str, str | int | float | bool] | None = None edgeAttrs: dict[str, str | int | float | bool] | None = Noneattribute LayoutConfig
Section titled “attribute LayoutConfig”LayoutConfig = Annotated[Union[GraphvizLayoutConfig, ElkLayoutConfig], Field(discriminator='type')]class NodeStyle
Section titled “class NodeStyle”class NodeStyle(BaseModel):Visual style options for a GraphNode.
Attributes:
double_borderbool— Renders a second border inside the node (e.g. final-marking places).inner_symbolLiteral['triangle', 'square'] | None— Optional symbol rendered inside the node shape.initial_tokensint | None— Optional initial token count rendered inside a place node.final_tokensint | None— Optional final token count rendered inside a place node.
Source
class NodeStyle(BaseModel): """Visual style options for a `GraphNode`.
Attributes: double_border: Renders a second border inside the node (e.g. final-marking places). inner_symbol: Optional symbol rendered inside the node shape. initial_tokens: Optional initial token count rendered inside a place node. final_tokens: Optional final token count rendered inside a place node. """
double_border: bool = False inner_symbol: Literal["triangle", "square"] | None = None initial_tokens: int | None = None final_tokens: int | None = Noneattribute DIRECTED_ELK_GRAPH_LAYOUT
Section titled “attribute DIRECTED_ELK_GRAPH_LAYOUT”DIRECTED_ELK_GRAPH_LAYOUT = ElkLayoutConfig(options={'elk.algorithm': 'layered', 'elk.direction': 'RIGHT', 'elk.edgeRouting': 'SPLINES', 'elk.hierarchyHandling': 'INCLUDE_CHILDREN', 'elk.separateConnectedComponents': True, 'elk.spacing.nodeNode': 48, 'elk.spacing.edgeNode': 24, 'elk.spacing.edgeEdge': 16, 'elk.spacing.componentComponent': 96, 'elk.layered.cycleBreaking.strategy': 'GREEDY', 'elk.layered.layering.strategy': 'NETWORK_SIMPLEX', 'elk.layered.crossingMinimization.strategy': 'LAYER_SWEEP', 'elk.layered.crossingMinimization.greedySwitch.type': 'TWO_SIDED', 'elk.layered.crossingMinimization.greedySwitch.activationThreshold': 40, 'elk.layered.nodePlacement.strategy': 'NETWORK_SIMPLEX', 'elk.layered.nodePlacement.favorStraightEdges': True, 'elk.layered.spacing.nodeNodeBetweenLayers': 120, 'elk.layered.spacing.edgeNodeBetweenLayers': 36, 'elk.layered.spacing.edgeEdgeBetweenLayers': 18, 'elk.layered.thoroughness': 15, 'elk.layered.unnecessaryBendpoints': False})High-quality ELK layered layout for large directed model graphs.
This is the preferred ELK preset for large Petri nets: it favors a stable left-to-right flow, spline edges, explicit layer spacing, and stronger crossing minimization without forcing frontend-specific defaults.
attribute FORCE_GRAPH_LAYOUT
Section titled “attribute FORCE_GRAPH_LAYOUT”FORCE_GRAPH_LAYOUT = GraphvizLayoutConfig(engine='sfdp', graphAttrs={'overlap': 'false', 'splines': 'spline'})Force-directed layout for general non-hierarchical graphs.
Useful for dense or cyclic graphs where neither layering nor a radial root produces a readable result.
attribute DIRECTED_GRAPH_LAYOUT
Section titled “attribute DIRECTED_GRAPH_LAYOUT”DIRECTED_GRAPH_LAYOUT = GraphvizLayoutConfig(engine='dot', graphAttrs={'rankdir': 'LR', 'nodesep': 0.35, 'ranksep': 0.55, 'splines': 'spline'})Left-to-right layered layout for directed model graphs.
Useful for process models, directly-follows graphs, Petri nets, and other graphs where edge direction should communicate progression.
attribute ORDERED_TREE_LAYOUT
Section titled “attribute ORDERED_TREE_LAYOUT”ORDERED_TREE_LAYOUT = GraphvizLayoutConfig(engine='dot', graphAttrs={'ordering': 'out', 'rankdir': 'TB', 'nodesep': 0.3, 'ranksep': 0.5, 'splines': 'line'})Top-down tree layout that preserves child order from the edge list.
Useful for process trees, expression trees, parse trees, and other rooted structures where sibling order carries meaning.
attribute RADIAL_GRAPH_LAYOUT
Section titled “attribute RADIAL_GRAPH_LAYOUT”RADIAL_GRAPH_LAYOUT = GraphvizLayoutConfig(engine='twopi', graphAttrs={'ranksep': 0.85, 'splines': 'spline', 'overlap': 'false'})Radial layout for connected relationship graphs.
Useful for object-to-object graphs or social-style networks where there is no single process direction and neighborhoods matter more than layers.