Graph
GraphNode ¶
Bases: 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:
| Name | Type | Description |
|---|---|---|
id | str | Unique node id. Defaults to a generated UUID string. |
label | str | None | Optional label shown near the node. |
shape | GraphShapes | Node shape identifier. |
width | float | None | Optional node width. |
height | float | None | Optional node height. |
color | str | None | Optional fill color (for example hex). |
x | float | None | Optional x-coordinate after layouting. |
y | float | None | Optional y-coordinate after layouting. |
border_color | str | None | Optional border/stroke color. |
label_pos | Literal['top', 'center', 'bottom'] | Label position relative to the node. |
rank | Literal['source', 'sink'] | int | None | Optional layout constraint (source/sink or numeric rank). |
layout_attrs | dict[str, str | int | float | bool] | None | Additional Graphviz attributes for this node. |
annotation | T | None | Optional attached visualization. |
Source code in src/ocelescope/src/ocelescope/visualization/default/graph.py
GraphEdge ¶
Bases: AnnotatedElement
A directed edge in a Graph visualization.
An edge connects source -> target and can carry labels and arrowhead styles.
Attributes:
| Name | Type | Description |
|---|---|---|
id | str | Unique edge id. Defaults to a generated UUID string. |
source | str | Source node id. |
target | str | Target node id. |
color | str | None | Optional edge color. |
label | str | None | Optional label shown along the edge. |
start_arrow | EdgeArrow | Optional arrowhead style at the start of the edge. |
end_arrow | EdgeArrow | Optional arrowhead style at the end of the edge. |
start_label | str | None | Optional label shown near the source. |
end_label | str | None | Optional label shown near the target. |
layout_attrs | dict[str, str | int | float | bool] | None | Additional Graphviz attributes for this edge. |
annotation | T | None | Optional attached visualization. |
Source code in src/ocelescope/src/ocelescope/visualization/default/graph.py
GraphvizLayoutConfig ¶
Bases: BaseModel
Layout configuration for Graph rendering via Graphviz.
This config selects the Graphviz layout engine and allows you to define default Graphviz attributes for the graph, nodes, and edges.
Attributes:
| Name | Type | Description |
|---|---|---|
engine | GraphvizLayoutEngineName | Graphviz layout engine name. |
graphAttrs | dict[str, str | int | float | bool] | None | Global Graphviz graph attributes. |
nodeAttrs | dict[str, str | int | float | bool] | None | Default Graphviz node attributes. |
edgeAttrs | dict[str, str | int | float | bool] | None | Default Graphviz edge attributes. |
Source code in src/ocelescope/src/ocelescope/visualization/default/graph.py
Graph ¶
Bases: 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 and rendering are performed using Graphviz.
Attributes:
| Name | Type | Description |
|---|---|---|
type | Literal['graph'] | Fixed discriminator |
nodes | list[GraphNode] | List of nodes. |
edges | list[GraphEdge] | List of edges. |
layout_config | GraphvizLayoutConfig | Graphviz layout configuration. |