package routing

Import Path
	github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing (on go.dev)

Dependency Relation
	imports 25 packages, and imported by 2 packages


Package-Level Type Names (total 15)
/* sort by: | */
GraphRouteOptions describes the route state owned by the pipeline around a whole-graph routing pass. CompletionObserver RouteCompletionObserver ForceReroute bool Observer SubgraphRouteObserver RoutesPreviouslyCompleted bool func RouteGraph(ctx context.Context, graph *layoutgraph.Graph, options GraphRouteOptions) (bool, error) func RouteGraphWithWorkLimit(ctx context.Context, graph *layoutgraph.Graph, options GraphRouteOptions, workLimit uint64) (routingComplete bool, err error)
Orthogonal Visibility Graph Centers map[*layoutgraph.Node]*OVGNode Edges []*OVGEdge HorizontalEdges map[float64][]*OVGEdge Nodes []*OVGNode NodesInsideBoundingBox []*layoutgraph.Node OccupiedPoints map[geo.Point]*OVGNode Ports map[*layoutgraph.Node][]*OVGNode VerticalEdges map[float64][]*OVGEdge (*OVG) AddNode(node *OVGNode) *OVGNode (*OVG) AddNodeUnchecked(node *OVGNode) (*OVG) Connect(nodeA, nodeB *OVGNode) *OVGEdge (*OVG) MarshalJSON() ([]byte, error) (*OVG) UnmarshalJSON(content []byte) error *OVG : github.com/goccy/go-json.Marshaler *OVG : github.com/goccy/go-json.Unmarshaler *OVG : encoding/json/v2.Marshaler *OVG : encoding/json/v2.Unmarshaler func NewOVG(nodesInsideBoundingBox []*layoutgraph.Node) *OVG func SubgraphRouteObserver.SubgraphRouted(*OVG) error
Distance float64 From *OVGNode To *OVGNode func NewOVGEdge(from, to *OVGNode) *OVGEdge func (*OVG).Connect(nodeA, nodeB *OVGNode) *OVGEdge func (*OVGNode).Adjacent(edge *OVGEdge) *OVGNode
Container *layoutgraph.Node // 24 bytes // 8 bytes // 8 bytes // 1 byte // 1 byte // 8 bytes Point.X float64 Point.Y float64 Moves the given point by Vector (*OVGNode) Adjacent(edge *OVGEdge) *OVGNode ( OVGNode) Compare(p2 *geo.Point) int ( OVGNode) Copy() *geo.Point https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment ( OVGNode) Equals(p2 *geo.Point) bool ( OVGNode) FormattedCoordinates() string GetOrientation gets orientation of pFrom to pTo E.g. pFrom ---> pTo, here, pFrom is to the left of pTo, so Left would be returned point t% of the way between a and b returns true if point p is on orthogonal segment between points a and b ( OVGNode) ToString() string Creates a Vector pointing to point ( OVGNode) Transpose() ( OVGNode) TruncateDecimals() ( OVGNode) TruncateFloat32() Creates a Vector of the size between start and endpoint, pointing to endpoint func NewOVGNode(p *geo.Point) *OVGNode func (*OVG).AddNode(node *OVGNode) *OVGNode func (*OVGNode).Adjacent(edge *OVGEdge) *OVGNode func NewOVGEdge(from, to *OVGNode) *OVGEdge func NewTunnelEntry(node *layoutgraph.Node, ovgNode *OVGNode) *TunnelEntry func (*OVG).AddNode(node *OVGNode) *OVGNode func (*OVG).AddNodeUnchecked(node *OVGNode) func (*OVG).Connect(nodeA, nodeB *OVGNode) *OVGEdge
type Range (struct)
FromPort geo.Point GEdge *layoutgraph.Edge OVGNodes []*OVGNode ToPort geo.Point
type RouteChecker (struct)
RouteCompletionObserver observes the route-complete transition inside the atomic routing stage. The engine retains pipeline-status ownership while the routing guard can still observe cancellation before commit. ( RouteCompletionObserver) RoutingCompleted()
const Default const LongestToShortest const ShortestToLongest const TopDownLeftRight
SearchTelemetry collects per-flavor work samples for routing diagnostics and calibration. It is safe to share across concurrent route workers. WorkSamples returns a stable copy of the recorded per-flavor work totals. func WithSearchTelemetry(ctx context.Context, telemetry *SearchTelemetry) context.Context
SubgraphRouteObserver observes each completed subgraph route at the exact point where its OVG and the graph's current route state agree. Snapshot serialization belongs to the engine orchestrator and can be implemented by this optional observer without making routing depend on engine. ( SubgraphRouteObserver) SubgraphRouted(*OVG) error
EntryA *TunnelEntry EntryB *TunnelEntry func NewTunnel(entryA, entryB *TunnelEntry) *Tunnel
Node *layoutgraph.Node OVGNode *OVGNode func NewTunnelEntry(node *layoutgraph.Node, ovgNode *OVGNode) *TunnelEntry func NewTunnel(entryA, entryB *TunnelEntry) *Tunnel
Package-Level Functions (total 19)
FixClusterEdgeBranching resolves route branching at cluster boundaries.
func NewOVG(nodesInsideBoundingBox []*layoutgraph.Node) *OVG
func NewOVGEdge(from, to *OVGNode) *OVGEdge
func NewTunnel(entryA, entryB *TunnelEntry) *Tunnel
RouteGraph runs the complete graph-routing stage. The returned boolean is the updated value of RoutesPreviouslyCompleted; on error the caller must retain its prior value.
RouteGraphWithWorkLimit is RouteGraph with an explicit aggregate budget. It exists for deterministic resource-boundary testing inside TALA.
ShortcutEdgeRoutes is a bounded bend-reduction postpass with fixed boxes and ports. WueOrtho's routing step chooses bend-minimal shortest paths (https://arxiv.org/html/2309.01671v2#S2), motivating this local adaptation: replace a subchain by either rectilinear L, retaining only strict bend wins. It is not a shortest-path solver and does not change the routing grid.
simplifyEdgeRoutes post-processes edge routes to remove unnecessary bending caused by the constraint that routes have to go through OVG nodes It identifies unnecessary bends in routes and eliminates them when possible.
SwapAllEdgePorts applies port swapping to every node under one atomic route-stage budget and rollback boundary.
TraceEdgesToShapeBorder trims every route endpoint to the rendered shape.
WithSearchTelemetry attaches route-search diagnostics to a routing context.
Package-Level Constants (total 5)
const Default RouteGenerationFlavor = "Default"
const LongestToShortest RouteGenerationFlavor = "LongestToShortest"
MaxSearchWorkUnits is the calibrated per-flavor route-search budget.
const ShortestToLongest RouteGenerationFlavor = "ShortestToLongest"
const TopDownLeftRight RouteGenerationFlavor = "TopDownLeftRight"