dot
dot::Box2 An axis-aligned box: top-left corner and extent.
dot::Cluster A cluster (a `subgraph cluster_*`): its id, optional parent cluster, member node ids, the margin kept outside its members, and the header band reserved on the title side.
dot::ClusterBox A laid-out cluster: its id and bounding box.
Inbound
- from dot::Clusters
dot::Clusters Cluster framing: compute each cluster's bounding box bottom-up so a nested cluster's box encloses its children (grown by their margins) and its direct members, with header room on the title side — `dot`'s recursive `rec_bb`.
Scenarios
Clusters nest like `dot`: an outer box strictly contains its inner boxes.
- given a graph with a cluster nested inside another cluster
- when the cluster boxes are computed
- then the outer box encloses the inner box grown by its margin
- and each box frames its members and leaves true externals outside
dot::Dot `crates/pseudoscript-dot`. Runs the four-pass layered pipeline over a `Graph` to produce a `Layout`; also offers the experimental grid placer. The layout authority `emit` drives for C4 diagrams.
Parent
Inbound
- call emit::Layout · gridLayout
- call emit::Layout · runPipeline
Outbound
- call → dot::Engine · layout
- call → dot::Pipeline · run
- call → dot::Grid · gridLayout
dot::Edge An input edge from `tail` to `head`, with its minimum rank span, its layout weight (higher pulls the endpoints into vertical alignment harder), and an optional label size that widens the rank gap to fit.
dot::EdgeRoute A routed edge: the Bézier `spline` and its `polyline` approximation between `tail` and `head`, plus where its label sits.
Inbound
- from dot::Splines
dot::Engine The layered engine: runs the faithful four-pass `dot` pipeline — rank, order, position, splines — then frames the clusters and shifts the whole layout to the origin. Deterministic and panic-free.
Parent
- for dot::Dot
Inbound
- call dot::Dot · layout
Outbound
- call → dot::Rank · assignRanks
- call → dot::Order · order
- call → dot::Position · assignCoords
- call → dot::Splines · route
- call → dot::Clusters · boxes
Scenarios
The pipeline is a faithful four-pass port, run in order.
- given an input graph of sized nodes, edges, and clusters
- when the graph is laid out
- then ranks are assigned, nodes ordered within ranks, x-coordinates placed, and edges routed as splines
- and the passes run in dot's order: rank, then order, then position, then splines
Layout is deterministic and never panics.
- given the same input graph laid out twice
- when the layouts are compared
- then the placements are identical
- and an empty graph yields an empty layout
- but no input — however extreme its rank spans — panics or hangs
dot::Graph The input graph the engine lays out: nodes, edges, clusters, the rank and node separations, the rank direction, and any same-rank constraints.
Inbound
- from emit::Layout
dot::Grid The experimental grid placer: an alternative to the layered pipeline that snaps nodes to a grid, honouring drag-to-pin cells and searching for a placement that minimises crossings, distance, and against-flow edges.
Scenarios
The grid placer honours pinned cells while it searches.
- given a graph and a set of drag-to-pin cells
- when the experimental grid placer runs
- then each pinned node stays in its cell
- and the remaining nodes are placed to minimise crossings, distance, and against-flow edges
dot::GridMeta Grid metadata carried back when the experimental grid placer ran: the grid dimensions, the cell pitch (centre-to-centre), the pixel centre of cell (0,0), and the width of the drag-room frame wrapping the grid — the geometry the IDE reads to map a drag onto a grid cell, recovering the raw cell from `origin` then subtracting `pad`.
dot::GridParams Tunable weights for the experimental grid placer: how strongly it penalises crossings, distance, and against-flow edges, the cell spacing, and how hard it searches.
dot::Layout The layout result: the overall bounding box, the placed nodes, the routed edges, the cluster boxes, and — only when the grid placer ran — its grid metadata.
dot::LayoutState The structure that flows through a pipeline: the (possibly pass-mutated) input graph and its current placement. A pass receives one, returns one, and the framework hands it to the next pass; a re-ranking pass may edit `graph` and re-run the base layout.
Inbound
- from dot::Pipeline
- from dot::Pipeline
dot::Node An input node: its id and its rendered size (the placer reserves this box).
dot::NodePos A placed node: its id, centre point, and reserved size.
Inbound
- from dot::Position
dot::Optimize The `ShortenLongEdges` pass: a bounded, deterministic post-layout refinement. Greedily search for same-rank moves that reduce the sum of squared edge lengths (never merging across a cluster boundary), then re-lay-out with the improving moves applied.
Parent
- for dot::Dot
dot::Oracle The test oracle: lays the same graph out with the real `dot` binary and compares, so the port stays faithful rather than approximate. Skipped when `dot` is not installed.
Parent
- for dot::Dot
Scenarios
Fidelity is checked against the real `dot` binary.
- given the reference dot binary is installed
- when a graph is laid out by both this engine and dot
- then the cluster nesting and placements match dot's
- but the oracle comparison is skipped when dot is not installed
dot::Order Pass 2 — ordering: order nodes within each rank to minimise edge crossings, inserting virtual nodes for long edges so they route through thin lanes.
dot::Pass One stage of the composable post-layout pipeline: same structure in, same structure out, so passes fold freely. `ShortenLongEdges` is the long-edge optimiser; `GridPlacement` wraps the grid placer so it drops into a pipeline. New behaviour is added by writing a pass, not by threading flags through the engine.
dot::Pin A pin fixing a node to a grid cell: the node's index into `graph.nodes` (the caller resolves the FQN) at a row and column. The IDE's drag-to-pin.
dot::Pipeline The composable post-layout pipeline: the base layout produces the starting `LayoutState`; each `Pass` folds it into the next. A pass adjusts geometry directly or edits the input graph (e.g. adds same-rank hints) and re-runs the base layout.
Parent
- for dot::Dot
Inbound
- call dot::Dot · run
Outbound
- from → dot::LayoutState
- from → dot::LayoutState
dot::Position Pass 3 — positioning: assign x-coordinates by network simplex on an auxiliary graph (aligning nodes and straightening long edges), and y-coordinates per rank stacked with `ranksep` plus any label and cluster-header room.
dot::Pt A point in layout coordinates.
dot::Rank Pass 1 — rank assignment: give each node an integer rank by network simplex, banding each cluster onto contiguous ranks and honouring same-rank constraints.
dot::RankDir The rank direction: top-to-bottom (the C4 default) or left-to-right.
dot::SearchMode How the experimental grid placer searches for a placement: pick automatically by size, always the bounded heuristic, or brute-force exhaustive (tiny graphs only).
dot::Size A width/height extent.
dot::Splines Pass 4 — splines: route each edge as a piecewise Bézier through its virtual-node corridor, clipped to the endpoint borders, with a label point at the polyline midpoint.