package layoutgraph

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

Dependency Relation
	imports 19 packages, and imported by 14 packages


Package-Level Type Names (total 34)
/* sort by: | */
Arrowhead is TALA's layout-time arrowhead value. The adapter translates between D2 renderer arrowheads and this owned string type at the engine boundary; layout algorithms only need stable value equality. func (*Edge).ArrowheadTo(node *Node) Arrowhead const NoArrowhead const TriangleArrowhead
Cluster is a group of nodes that - have the same size - are all adjacent to another node in the cluster - are evenly spaced apart from each other - are arranged according to a ClusterArrangement Arrangement ClusterArrangement Container *Node DesiredArrangement ClusterArrangement EdgeAbductions []*EdgeAbduction FixedSize bool Graph *Graph Nodes []*Node Padding float64 Vessel is the node that gets moved around during node placement and encapsulates the cluster nodes ArrangeClusterNodes moves the inner cluster nodes to their respective positions within the cluster This should be called after vessels move This is idempotent -- calling it after it's in the right position results in 0's for movements (*Cluster) DebugID() string (*Cluster) IsActive() bool Resize makes the cluster nodes consistent in size, and sizes the vessel to exact fit of cluster nodes It should be called after any potential resizing, which may happen if a child node is a container and gets resized SyncGeometry resizes the cluster vessel and arranges its visible members. SyncGeometryWithWork resizes the cluster vessel and arranges its visible members through caller-owned cancellation and movement operations. func IsActiveClusterForSerialization(cluster *Cluster) bool func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.AddCluster(graph *Graph, cluster *Cluster) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.AssignArrangement(cluster *Cluster, isConnectedToSequence bool, random *rand.Rand) ClusterArrangement func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.CreateVessel(cluster *Cluster, vesselID EntityID) *Node func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.PaddingBetween(cluster *Cluster, considerPositions bool) float64
( ClusterArrangement) Flip() ClusterArrangement func ClusterArrangement.Flip() ClusterArrangement func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.AssignArrangement(cluster *Cluster, isConnectedToSequence bool, random *rand.Rand) ClusterArrangement const Column const Row
ClusterGeometryWork is the mutation contract used while synchronizing cluster geometry. Layoutgraph owns the geometry; callers that need guarded descendant movement provide the operations on top of the shared work budget. ( ClusterGeometryWork) Finish() error ( ClusterGeometryWork) MoveNodeWithChildren(node *Node, dx, dy float64) error ( ClusterGeometryWork) PositionContainerChildren(node *Node) error ( ClusterGeometryWork) Step() error ClusterGeometryWork : SharedWorkStepper ClusterGeometryWork : github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.WorkStepper func (*Cluster).SyncGeometryWithWork(work ClusterGeometryWork) error
CrossingSegment is an oriented line segment used by crossing scoring. End geo.Point Start geo.Point func CountSegmentCrossings(segments []CrossingSegment) int64 func CountSegmentCrossingsContext(ctx context.Context, segments []CrossingSegment) (int64, error)
D2ID *string From *Node edges between SQL Table shapes ID EntityID IsCurve bool IsInvisible bool Label *Label LabelPercentage float64 MinHeight int MinWidth int Points []*geo.Point SourceArrowhead Arrowhead SourceArrowheadLabel *Label Style EdgeStyle TargetArrowhead Arrowhead TargetArrowheadLabel *Label To *Node ToTableColumnIndex *int (*Edge) ArrowheadTo(node *Node) Arrowhead (*Edge) BoundingBox() (*geo.Point, *geo.Point) (*Edge) BoundingBoxValues() (geo.Point, geo.Point) (*Edge) DebugID() string (*Edge) DirectedEndpoints() (from, to *Node, ok bool) (*Edge) EquivalentStyles(e2 *Edge) bool (*Edge) EuclideanDistance() float64 (*Edge) FacingTablePortValues(from, to *Node) (geo.Point, geo.Point, bool, bool, geo.Orientation) (*Edge) HasArrowTo(node *Node) bool (*Edge) HasDuplicateIn(edges []*Edge) bool (*Edge) HasLargeArrowheadLabel() bool (*Edge) HasOverlappingEnd() bool (*Edge) HasSourceArrow() bool (*Edge) HasTableColumn() bool (*Edge) HasTargetArrow() bool HierarchyRankWeight returns the authored-edge multiplicity represented by a temporary hierarchy DAG edge. Ordinary graph edges have implicit weight 1. (*Edge) IDValue() EntityID (*Edge) IsAxisAligned() bool (*Edge) IsBetweenTableColumns() bool (*Edge) IsBidirectional() bool IsClusterEdge reports whether either endpoint is currently represented by a cluster grouping. (*Edge) IsDirected() bool (*Edge) IsDuplicateOf(other *Edge) bool (*Edge) IsLoop() bool (*Edge) IsStraight() bool (*Edge) IsTargetedTo(node *Node) bool (*Edge) IsTreeEdge() bool (*Edge) IsUndirected() bool LabelTopLeft returns the top-left point for a label of the given size and position on edge. (*Edge) Length() float64 (*Edge) MatchingArrowheads(other *Edge) bool (*Edge) NumSegments() int (*Edge) OwnArrowheadsMatch() bool (*Edge) Reconnect(node *Node, to bool) SetHierarchyRankWeight records temporary hierarchy DAG metadata. It is kept out of graph serialization and reset by ordinary graph cloning. (*Edge) SourcePort() *geo.Point (*Edge) TargetPort() *geo.Point func NewEdge(from, to *Node) *Edge func Edges.PortEdges(node *Node) map[geo.Point][]*Edge func (*EdgeSegment).Owner() *Edge func (*Graph).Connect(nodeA, nodeB *Node) *Edge func (*Graph).TreeEdgeMap() map[*Edge]bool func (*Node).ConnectionTo(other *Node) *Edge func github.com/pancsta/d2/d2layouts/d2talalayout/internal/loops.Route(n *Node) []*Edge func AddDecodedEdge(node *Node, edge *Edge) func NewEdgeSegment(start, end *geo.Point, edge *Edge) *EdgeSegment func ValidatePositionedGraphSelection(ctx context.Context, operation string, graph *Graph, extraEdges []*Edge) error func (*Edge).EquivalentStyles(e2 *Edge) bool func (*Edge).HasDuplicateIn(edges []*Edge) bool func (*Edge).IsDuplicateOf(other *Edge) bool func (*Edge).MatchingArrowheads(other *Edge) bool func (*Graph).AddEdge(edge *Edge) func (*Graph).AddIsolatedTreeEdges(edges map[*Edge]bool) func (*Graph).Disconnect(edge *Edge) func (*Graph).ReplaceEdgesUnchecked(edges []*Edge) func (*Node).AddIncidentEdgeUnchecked(edge *Edge) func (*Node).Adjacent(edge *Edge) *Node func Nodes.IntersectsNode(edge *Edge) bool func (*Sequence).AbductedNodeByEdge(edge *Edge) *Node func github.com/pancsta/d2/d2layouts/d2talalayout/internal/labeling.PlaceNewEdges(ctx context.Context, graph *Graph, edges []*Edge) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/labeling.PositionArrowheadLabel(edge *Edge, isTarget bool, route geo.Route) *labeling.PositionedArrowheadLabel func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.RouteEdges(ctx context.Context, g *Graph, edges []*Edge) error
EdgeAbduction represents the temporary transfer of an edge from a descendant container to the ancestor child so node placement can operate on containers. CurrentFrom *Node CurrentTo *Node Edge *Edge OriginallyFrom *Node OriginallyTo *Node func (*Graph).AbductEdges(container *Node, toGraph *Graph) []*EdgeAbduction func (*Graph).RestoreEdgeAbductions(edgeAbductions []*EdgeAbduction) []*EdgeAbduction func (*Graph).ApplyEdgeAbductions(abductions []*EdgeAbduction) func (*Graph).RestoreEdgeAbductions(edgeAbductions []*EdgeAbduction) []*EdgeAbduction func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.PlaceChildrenOrder(ctx context.Context, nodes []*Node, edgeAbductions []*EdgeAbduction) ([]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.ColumnCrossingCost(ctx context.Context, node *Node, edgeAbductions []*EdgeAbduction) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NodesSymmetry(ctx context.Context, nodes Nodes, edgeAbductions []*EdgeAbduction) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NodeSymmetry(ctx context.Context, node *Node, edgeAbductions []*EdgeAbduction) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AssignHerds(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AssignNears(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error)
( Edges) PortEdges(node *Node) map[geo.Point][]*Edge
Segment geo.Segment Segment.End *geo.Point Segment.Start *geo.Point getBounds takes a segment and returns the floor and ceil of where it can shift to If there is no floor or ceiling, negative or positive infinity is used, respectively The direction is inferred, e.g. b/c the passed in segment is vertical, it's inferred we want horizontal bounds buffer says how close the segment can be, on both axes, to other segments given . │ │ . │ │ . │ │ . │ │ . │ non-overlap . │ . │ . │ . │ segment . │ │ . │ │ ceil . │ │ │ . │ │ . floor │ │ . │ . │ . │ . │ NOTE: the assumption is that all segments given are orthogonal ( EdgeSegment) Intersections(otherSegment geo.Segment) []*geo.Point ( EdgeSegment) Intersects(otherSegment geo.Segment) bool ( EdgeSegment) Length() float64 ( EdgeSegment) Overlaps(otherS geo.Segment, isHorizontal bool, buffer float64) bool (*EdgeSegment) Owner() *Edge ( EdgeSegment) ToString() string ( EdgeSegment) ToVector() geo.Vector EdgeSegment : github.com/pancsta/d2/lib/geo.Intersectable func NewEdgeSegment(start, end *geo.Point, edge *Edge) *EdgeSegment
EdgeStyle is the complete style record carried through TALA's layout graph. Routing currently compares only a subset of these fields, but every value must survive cloning and fixture round-trips unchanged. Animated *StyleScalar Bold *StyleScalar BorderRadius *StyleScalar DoubleBorder *StyleScalar Fill *StyleScalar FillPattern *StyleScalar Filled *StyleScalar Font *StyleScalar FontColor *StyleScalar FontSize *StyleScalar Italic *StyleScalar Multiple *StyleScalar Opacity *StyleScalar Shadow *StyleScalar Stroke *StyleScalar StrokeDash *StyleScalar StrokeWidth *StyleScalar TextTransform *StyleScalar ThreeDee *StyleScalar Underline *StyleScalar
EntityID identifies a node or edge independently of the host architecture. TALA IDs are serialized and participate in deterministic ordering, so their width must not depend on whether the engine is running natively or in WASM.
CellSize float64 -- Clusters are nodes which should stick together and can be reoriented and resized ---- They can be oriented vertically or horizontally depending on where its connections are ---- They can be resized to be all the same dimensions ---- These are inferred CommonUncleSiblings map[*Node]Nodes -- Containers are nodes which have nodes enclosed inside them ---- They can be nested ---- The top level is considered a container of nil ---- These are inferred -- Directions is used to lookup the direction the edges should point towards within each container e.g. Bottom means the edges should primarily go from Top to Bottom Edges []*Edge Hubs map[*Node][]*Node Unfortunate, but because we represent root as nil, we need to indicate root hierarchy as a field in graph NodeToTree map[*Node]*Tree Nodes []*Node Sequences map[*Node]*Sequence -- Trees are nodes which are in a tree structure (i.e. any non-cyclic subgraph) ---- They are oriented in one of 4 directions, depending on where its root node ends up ---- These are inferred ---- Trees are pruned from the graph, then after node placement, they are reattached and placed as trees (*Graph) AbductEdges(container *Node, toGraph *Graph) []*EdgeAbduction (*Graph) AddEdge(edge *Edge) (*Graph) AddIsolatedTreeEdges(edges map[*Edge]bool) (*Graph) AddNewNodeToContainer(container, node *Node) (*Graph) AddNode(node *Node) *Node (*Graph) AddNodeToContainer(container, node *Node) For example, we want to mirror the two outer nodes, but do not want to mirror the contents of the container . ┌─────────┐ . │ │ . │ ┌──┐ │ . │ │ │ │ . │ └─┬┘ │ . │ │ │ . │ ┌─▼┐ │ . │ └──┘ │ . │ │ . └────▲────┘ . │ . │ . ┌───┴───┐ . │ │ . └───────┘ Currently used by container child over container center (*Graph) AllDescendantNodes(node *Node, includeClusterNodes bool) []*Node (*Graph) AllDescendantNodesWithWorkGuard(node *Node, includeClusterNodes bool, guard *limits.WorkGuard) ([]*Node, error) (*Graph) ApplyEdgeAbductions(abductions []*EdgeAbduction) Area returns the area of the graph's unrounded bounding box, including routed edges and positioned labels. (*Graph) BoundingBox() (*geo.Point, *geo.Point) ClusterOrder returns cluster vessels in stable ID order. ClusterRDFSOrder returns cluster vessels in reverse depth-first container order. (*Graph) ComputeCellSize() routes is provided when graph is still undergoing edge routing and the edges don't have points locked in yet. (*Graph) Connect(nodeA, nodeB *Node) *Edge (*Graph) ContainerFixedOrigin(container *Node) *geo.Point (*Graph) ContainerPadding(container *Node, considerChildren bool) Spacing ContainerRDFSOrder returns nested containers from innermost to outermost while charging the supplied request work budget. (*Graph) ContainerRDFSOrderUnbounded(root *Node) []*Node (*Graph) CopyEntitiesFrom(other *Graph) (*Graph) CrossingCost() float64 Direction reports the layout direction assigned to container. (*Graph) Disconnect(edge *Edge) EdgeLengthCacheEntries reports the size of the graph-owned placement cache. (*Graph) FixedNodes() []*Node (*Graph) HalveTurnCost() (*Graph) HasFixedNode() bool HubOrder returns hub sentinels in stable ID order. (*Graph) IsBadStateWithWorkGuard(node *Node, graphState *GraphState, ignoreContainerEscape bool, guard *limits.WorkGuard) (bool, error) (*Graph) IsSequenceVessel(node *Node) bool (*Graph) IsTreeSentinel(node *Node) bool LookupEdgeLengthCost reads one entry from the graph-owned placement cache while holding the graph's cost read lock. NewRequestTransaction creates a request-scoped placement transaction. Tree trials share the same transaction accounting and rollback semantics as the rest of the engine. (*Graph) NewRequestTransactionWithWorkGuard(ctx context.Context, guard *limits.WorkGuard, options TransactionOptions) (*Transaction, error) (*Graph) NonCenterPortCost() float64 (*Graph) RemoveNode(node *Node) ReplaceEdgesUnchecked replaces graph edge ownership and rebuilds both endpoint incidence lists. The caller is responsible for supplying valid graph-owned endpoints. ResetPlacementCosts clears route-derived scoring state without replacing the graph's cache map or changing whether caching is enabled. (*Graph) ResetTurnCost() (*Graph) RestoreEdgeAbductions(edgeAbductions []*EdgeAbduction) []*EdgeAbduction (*Graph) RestoreRoutingCosts(state RoutingCostState) (*Graph) RoutingCosts() RoutingCostState SequenceOrder returns sequence vessels in stable ID order. SnapshotPlacementCosts copies graph-owned scoring state. The placement domain charges its own work budget before requesting this bounded copy. SplitSubgraphs partitions the graph into sets of mutually reachable nodes. SplitSubgraphsTracked splits a graph while returning the exact ownership journal needed by callers that keep the temporary subgraphs alive during a larger atomic operation. StoreEdgeLengthCost writes one entry while holding the graph's cost lock. It is a no-op when this graph has disabled placement caching. SyncClusters synchronizes every active cluster in nested graph order. (*Graph) SyncNestedGeometry() SyncSequences synchronizes every active sequence in nested graph order. (*Graph) TreeEdgeMap() map[*Edge]bool TreeOrder returns tree sentinels in stable ID order. (*Graph) TurnCost() float64 WouldOverlapWithWorkGuard reports whether placing node at point overlaps an unexcepted graph node while charging the complete comparison. func Clone(ctx context.Context, source *Graph) (*Graph, error) func NewGraph() *Graph func (*Graph).SplitSubgraphs(ctx context.Context, options SplitOptions) ([]*Graph, error) func (*Graph).SplitSubgraphsTracked(ctx context.Context, options SplitOptions, work SharedWorkStepper) ([]*Graph, NodeGraphOwnershipJournal, error) func NodeGraphOwnershipJournal.OriginalGraph(node *Node) (*Graph, bool) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/engine.CompoundCandidate(ctx context.Context, graph *Graph) (*Graph, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/engine.Layout(ctx context.Context, graph *Graph, options engine.LayoutOptions) (*Graph, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/engine.PreserveCompoundRoutes(ctx context.Context, before, selected *Graph) (*Graph, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/packing.CombineSubgraphs(ctx context.Context, masterGraph *Graph, graphs []*Graph, ancestorObstacles []geo.Box) (_ *Graph, err error) func Clone(ctx context.Context, source *Graph) (*Graph, error) func ContainerOrderForSerialization(graph *Graph, guard *limits.WorkGuard) ([]*Node, error) func CostsForSerialization(graph *Graph) (crossing, turn, nonCenterPort float64) func PublishDeserializedGraph(destination, staged *Graph, crossing, turn, nonCenterPort float64) func RestoreGraphState(graph *Graph, state *GraphState) func SnapshotNodeGraphOwnership(ctx context.Context, graph *Graph) (NodeGraphOwnershipSnapshot, error) func Validate(ctx context.Context, operation string, g *Graph) error func ValidateForSerialization(ctx context.Context, graph *Graph) error func ValidatePositionedGraph(ctx context.Context, operation string, graph *Graph) error func ValidatePositionedGraphSelection(ctx context.Context, operation string, graph *Graph, extraEdges []*Edge) error func ValidateSubgraphCombination(ctx context.Context, graphs []*Graph) error func (*Graph).AbductEdges(container *Node, toGraph *Graph) []*EdgeAbduction func (*Graph).CopyEntitiesFrom(other *Graph) func (*GraphState).OwnedNodes(g *Graph, guard *limits.WorkGuard) (map[*Node]struct{}, error) func (*GraphState).UpdateWithWorkGuard(g *Graph, guard *limits.WorkGuard) error func (*Node).ConnectedNodes(excluded []*Node, graph *Graph) []*Node func (*Node).ConnectedNodeSet(excludedNodes []*Node, graph *Graph) []*Node func (*Node).FitToGraph(graph *Graph, padding Spacing) func Nodes.SetGraphReference(g *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/engine.CompoundCandidate(ctx context.Context, graph *Graph) (*Graph, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/engine.Layout(ctx context.Context, graph *Graph, options engine.LayoutOptions) (*Graph, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/engine.PreserveCompoundRoutes(ctx context.Context, before, selected *Graph) (*Graph, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.AddCluster(graph *Graph, cluster *Cluster) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.AddClusters(ctx context.Context, graph *Graph, randomSeed int64, random *rand.Rand) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.AddSequences(ctx context.Context, graph *Graph, random *rand.Rand) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.Cleanup(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.JoinDistancedClusters(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.ResetClusters(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.SequenceDefiningEdges(ctx context.Context, graph *Graph) (map[EntityID]struct{}, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Assign(ctx context.Context, g *Graph, root *Node, hierarchicalNodes map[*Node]struct{}) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Candidates(graph *Graph) map[*Node]struct{} func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Place(ctx context.Context, g *Graph, root *Node, randGenerator *rand.Rand) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.PlaceCompound(ctx context.Context, g *Graph, random *rand.Rand) (changed bool, err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.RemoveIsolatedMemberships(g *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/labeling.Initialize(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/labeling.Place(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/labeling.PlaceNewEdges(ctx context.Context, graph *Graph, edges []*Edge) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/loops.ComputeOffsets(g *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/packing.CombineSubgraphs(ctx context.Context, masterGraph *Graph, graphs []*Graph, ancestorObstacles []geo.Box) (_ *Graph, err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/packing.CombineSubgraphs(ctx context.Context, masterGraph *Graph, graphs []*Graph, ancestorObstacles []geo.Box) (_ *Graph, err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/packing.Pack(ctx context.Context, g *Graph, root *Node) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Align(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.BalanceSymmetry(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Dejitter(ctx context.Context, g *Graph) (bool, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Equidistance(ctx context.Context, g *Graph) (bool, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Normalize(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.NormalizeGaps(ctx context.Context, graph *Graph) (bool, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.OptimizeClusters(ctx context.Context, g *Graph) (bool, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Pad(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Place(ctx context.Context, graph *Graph, seed int64) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Prepare(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Prescale(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.Swap(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.TransposeAll(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.ContainerAlignmentCost(ctx context.Context, graph *Graph) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.EdgeLength(ctx context.Context, graph *Graph, options placementcost.EdgeLengthOptions) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.GraphEdgeCrossings(ctx context.Context, graph *Graph) (int64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AddHubs(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AssignHerds(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AssignNears(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.CommonUncleSiblings(graph *Graph) map[*Node]Nodes func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.SyncHerdFences(graph *Graph) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/quality.Evaluate(ctx context.Context, graph *Graph) (quality.Score, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/quality.EvaluateWithArea(ctx context.Context, graph *Graph) (float64, float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/quality.Inspect(ctx context.Context, graph *Graph) (quality.Metrics, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.BalanceEdgeSegments(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.Crosshatch(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.FixClusterEdgeBranching(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.NudgeEdgeChannels(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.ReorderDuplicates(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.RouteEdges(ctx context.Context, g *Graph, edges []*Edge) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.RouteGraph(ctx context.Context, graph *Graph, options routing.GraphRouteOptions) (bool, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.RouteGraphWithWorkLimit(ctx context.Context, graph *Graph, options routing.GraphRouteOptions, workLimit uint64) (routingComplete bool, err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.ShortcutEdgeRoutes(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.SimplifyEdgeRoutes(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.StraightEdgesFallback(ctx context.Context, g *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.SwapAllEdgePorts(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.TraceEdgesToShapeBorder(ctx context.Context, graph *Graph) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/trees.Place(ctx context.Context, g *Graph, container *Node) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/trees.Preprocess(ctx context.Context, g *Graph) error
OwnedNodes returns every node whose state is owned by g, including graph nodes temporarily removed by tree or sequence preprocessing. It charges the same work units in the same traversal order as the former hierarchy code. (*GraphState) TracksNode(node *Node) bool (*GraphState) UpdateWithWorkGuard(g *Graph, guard *limits.WorkGuard) error func NewGraphStateSnapshot(options GraphStateSnapshotOptions) *GraphState func (*Transaction).PreservePriorGraphState() *GraphState func RestoreGraphState(graph *Graph, state *GraphState) func (*Graph).IsBadStateWithWorkGuard(node *Node, graphState *GraphState, ignoreContainerEscape bool, guard *limits.WorkGuard) (bool, error)
GraphStateSnapshotOptions selects the topology and route identity captured by a rollback snapshot. CaptureEdgeRoutes bool CaptureTopology bool func NewGraphStateSnapshot(options GraphStateSnapshotOptions) *GraphState
HerdAssignment records the side of a container toward which a node should be placed, together with the uncles paired on the same and opposite sides. The proximity package owns the algorithms that produce and synchronize these assignments. Orientation is the side to herd to: TOP, LEFT, BOTTOM, or RIGHT. Val is the y-axis coordinate for TOP/BOTTOM and the x-axis coordinate for LEFT/RIGHT. (*HerdAssignment) Copy() *HerdAssignment (*HerdAssignment) OppositeSidePairCount() int (*HerdAssignment) PairOppositeSide(node *Node) (*HerdAssignment) PairSameSide(node *Node) (*HerdAssignment) SameSidePairCount() int func NewHerdAssignment() *HerdAssignment func (*HerdAssignment).Copy() *HerdAssignment
Hierarchy records the level assigned to each member of a directed, layered subgraph together with the discovery facts used by later layout stages. Discovery and placement live in the sibling hierarchy package; this type remains here because nodes own their hierarchy membership as graph state. LevelCount int Levels returns the hierarchy's node-to-level mapping. The hierarchy algorithms mutate this map while assigning and replacing memberships. ReplaceLevels atomically replaces the node-to-level mapping. func NewDecodedHierarchy(levels map[*Node]int) *Hierarchy func NewHierarchy() *Hierarchy func HierarchyLevelsForSerialization(hierarchy *Hierarchy) map[*Node]int
Icon is the icon-placement state attached to a layout node. Position label.Position FixPosition marks Position as supplied by the caller. PositionFixed reports whether Position was supplied by the caller and must be preserved by automatic icon placement.
Label is the label state attached to a layout node or edge. Height float64 Position label.Position Text string Width float64 FixPosition marks Position as supplied by the caller. PositionFixed reports whether Position was supplied by the caller and must be preserved by automatic label placement.
LongDistanceNeighborRequirements records the space a node needs to expose its parallel edges to a distant neighbor. EdgeCount int MaxHeight int MaxWidth int
Node positions and dimensions for shapes should always be whole numbers When used in OVGs for edge routing, they can take decimal values Box geo.Box Box.Height float64 Box.TopLeft *geo.Point Box.Width float64 Cluster *Cluster Container *Node D2ID *string DesiredHeight *float64 The node should be be these dimensions, but containers can still grow to fit their children Edges []*Edge FixedTopLeft *geo.Point FontSize *int ForceHierarchy bool Graph *Graph HerdAssignment *HerdAssignment Hierarchy *Hierarchy ID EntityID Icon *Icon to adjust where connections are for 3d/multiple styles Connections can go through invisible nodes. For example, opacity 0 grid cells used for spacing IsMultiple bool Label *Label LongDistanceNeighborRequirements records optimizer-derived parallel-edge spacing by adjacent node. LoopOffsets contains the distance (offset) from the node bounding box to loop borders as shown in the example below. For diagonals, take the max of the coordinates: TopLeft=max(Top, Left) left |----| right ┬ ┌─────────┐ |--------| top | │ ┌───────┤ ┌────┐ ┴ │ │ ┌────▼─────┴──┐ a label │ │ │ ◄─┘ └─┴──┤ node │ │ │ ┌──► │ │ │ │ bottom ┬ │ └──┬──────────┘ ┴ └─────┘ Nears is a list of nodes which this node wants to position itself close to one of They're different from edges that have additional heuristics like alignment, symmetry, tree/cluster-formation, etc And we don't reward being closer to all of them Sequence *Sequence This defines the snap points AddIncidentEdgeUnchecked restores an already graph-owned edge to a node's incidence list. Tree preprocessing validates ownership before calling it. (*Node) AddNear(otherN *Node) (*Node) Adjacent(edge *Edge) *Node (*Node) AllReachableNodesContext(includeContainers, includeNears, traverseTrees bool, ignore map[*Node]struct{}, guard *limits.WorkGuard) ([]*Node, error) AncestryParent returns the parent relation used by layout ancestry checks. Unlike EffectiveContainer, active cluster and sequence ancestry follows the vessel itself. Area returns a node's rectangular area. ( Node) AspectRatio1() bool (*Node) BoundingBox(allNodes Nodes) (*geo.Point, *geo.Point) ( Node) CanContain() bool (*Node) Center() *geo.Point CenterPortIndex returns the center port for an orientation, or -1 if the shape does not expose one. CenterPortIndices returns the center port on each side. (*Node) CenterPorts() []geo.Point ConnectedNodeSet returns the same reachable set as ConnectedNodes, with no traversal-order guarantee. Use it only when all members are treated equally; order-sensitive nearest-node tie breaking must continue using ConnectedNodes. (*Node) ConnectedNodes(excluded []*Node, graph *Graph) []*Node (*Node) ConnectionTo(other *Node) *Edge ContainerDirection reports the layout direction of n's owning container. (*Node) ContainerLevel() int (*Node) Contains(p *geo.Point) bool (*Node) ContainsPoint(point *geo.Point, padding float64) bool (*Node) ContainsPointOnBox(point *geo.Point) bool (*Node) Copy() *geo.Box . ┌────────────────┐ . │ ┌───┐ │ . │ A │ B │ │ . │ └───┘ │ . │ ┌─────────────┼──┐ . └──┼───────C─────┘ │ . └────────────────┘ A covers B but not C, B does not cover A (*Node) DebugID() string (*Node) DeltaTo(other *Node, at *geo.Point) int (*Node) DistanceTo(other *Node, includeSizes bool) float64 (*Node) DoesOverlap(other *Node) bool (*Node) DoesOverlapAt(other *Node, point *geo.Point) bool DoesOverlapExact reports whether node boxes overlap without clearance padding. EffectiveContainer returns the node's active layout container. Active cluster and sequence vessels replace the node's direct container while those grouping algorithms are running. (*Node) FitToBoundingBox(topLeft, bottomRight *geo.Point, padding Spacing) (*Node) FitToGraph(graph *Graph, padding Spacing) FixedOrigin returns the fixed-position origin inherited through a node's descendants. Tree placement uses it to preserve D2 position constraints. ( Node) GetBox() *geo.Box ( Node) GetDefaultPadding() (paddingX, paddingY float64) ( Node) GetDimensionsToFit(width, height, paddingX, paddingY float64) (float64, float64) ( Node) GetInnerBox() *geo.Box cloud shape has different innerBoxes depending on content's aspect ratio placing a rectangle of the given size and padding inside the shape, return the position relative to the shape's TopLeft ( Node) GetSVGPathData() []string ( Node) GetType() string HasLeakyEdge checks if 1. node is a container 2. a descendant has an edge going outside the container HierarchyLevel returns n's assigned level. Callers must only use it for a node with non-nil Hierarchy membership. (*Node) IDValue() EntityID IconSize returns the icon size appropriate for iconPosition on n. (*Node) InitIcon() InnerBox returns n's rounded content box. InsidePlacement returns the top-left point at which content of the given size and padding fits inside n. (*Node) Intersections(s geo.Segment) []*geo.Point Intersects returns true if the segment comes within buffer of the box ( Node) Is(shape string) bool (*Node) IsAdjacentTo(other *Node, includeSizes bool) bool (*Node) IsBlocked(nodeA, nodeB *Node, includeSizes, isHorizontal bool) bool (*Node) IsClass() bool (*Node) IsClusterVessel() bool (*Node) IsContainer() bool (*Node) IsDescendantOf(ancestor *Node) bool IsImage reports whether the node uses the image shape. Image nodes do not render their icon as a separately positioned object. (*Node) IsMajorityTarget() bool (*Node) IsPointNear(point *geo.Point) bool ( Node) IsRectangular() bool (*Node) IsSequenceStep() bool (*Node) IsTable() bool (*Node) IsWithinBounds(topLeft, bottomRight *geo.Point) bool LabelBoxesOverlap reports whether two node boxes overlap with the requested padding. LabelOverlapArea returns the rectangular overlap area. Callers must first prove that the nodes overlap. LabelPositionPreferences returns the positions in a preference tier. LabelTopLeft returns the top-left point for a label of the given size and position relative to node. (*Node) Level() int (*Node) Mirror(x, y bool) MirroredPortIndices maps each port index to its reflected counterpart. (*Node) MirroredPorts() map[geo.Point]geo.Point (*Node) ModifierElementAdjustments() (dx, dy float64) (*Node) MoveAbsWithChildren(x, y float64) (*Node) MoveWithChildren(dx, dy float64) (*Node) NearestSharedAncestor(other *Node) *Node NodeOverlapCount reports how many nodes overlap node within delta. NumColumns reports the number of columns in a table-shaped node. (*Node) OrderedNears() []*Node (*Node) Orientation(other *Node) geo.Orientation (*Node) OrthogonalDistanceTo(other *Node) (float64, float64) (*Node) OverlappingPorts(other *Node) map[geo.Point]bool ( Node) Overlaps(b2 geo.Box) bool (*Node) OverlapsAlongDimension(other *Node, horizontal, includeSizes bool) bool (*Node) OverlapsLine(start, end *geo.Point, delta float64) bool OwningContainer resolves the active cluster or sequence vessel before falling back to the node's direct container. PadLabelCandidate expands (or shrinks, for a negative value) a temporary node box by the same amount on every side. (*Node) PassesThrough(first, second *geo.Point) bool Perimeter returns a slice of geo.Intersectables that together constitute the shape border (*Node) PointPastFixedOrigin(x, y float64, includeSizes bool) bool PortIndices returns the ports available for an orientation. (*Node) PortOrientation(point *geo.Point) geo.Orientation (*Node) Ports() []geo.Point (*Node) PortsByOrientation(orientation geo.Orientation) []geo.Point (*Node) PositionContainerChildren(withPadding bool) (*Node) ReachableNodesContext(shouldVisit func(*Node) bool, includeContainers, includeNears, traverseTrees bool, ignore map[*Node]struct{}, guard *limits.WorkGuard) ([]*Node, error) (*Node) SameShape(other *Node) bool (*Node) SetClusterVessel(value bool) (*Node) SetContainer(value bool) ( Node) SetInnerBoxAspectRatio(aspectRatio float64) (*Node) SetNumColumns(numColumns int) (*Node) SetShape(shapeType string) ShapeType reports the node's canonical shape type. SnapPointPercentages returns port groups in top, left, bottom, and right order. (*Node) SpillsOutOf(container *Node) bool (*Node) Surrounds(other *Node, withPadding float64) bool (*Node) ToString() string (*Node) Translate(dx, dy float64) (*Node) Transpose() (*Node) UnmarkClusterVessel() (*Node) UpdateSpacing() (*Node) VisibilityGraphCandidate(horizontal, checkSide, includeSizes bool, other *Node, padding float64) bool (*Node) WalkRDFS(apply func(*Node)) (*Node) WrapChildren() Node : github.com/pancsta/d2/d2layouts/d2talalayout/internal/nodeshape.Shape *Node : github.com/pancsta/d2/lib/geo.Intersectable Node : github.com/pancsta/d2/lib/shape.Shape func BuildNodeToTreeForDeserialization(trees map[*Node][]*Tree, guard *limits.WorkGuard) (map[*Node]*Tree, error) func ContainerOrderForSerialization(graph *Graph, guard *limits.WorkGuard) ([]*Node, error) func HierarchyLevelsForSerialization(hierarchy *Hierarchy) map[*Node]int func NewNode(id EntityID, width, height float64) *Node func OrderedNearsForSerialization(node *Node) []*Node func (*Edge).DirectedEndpoints() (from, to *Node, ok bool) func (*Graph).AddNode(node *Node) *Node func (*Graph).AllDescendantNodes(node *Node, includeClusterNodes bool) []*Node func (*Graph).AllDescendantNodesWithWorkGuard(node *Node, includeClusterNodes bool, guard *limits.WorkGuard) ([]*Node, error) func (*Graph).ClusterOrder() []*Node func (*Graph).ClusterRDFSOrder() []*Node func (*Graph).ContainerRDFSOrder(root *Node, guard *limits.WorkGuard) ([]*Node, error) func (*Graph).ContainerRDFSOrderUnbounded(root *Node) []*Node func (*Graph).FixedNodes() []*Node func (*Graph).HubOrder() []*Node func (*Graph).SequenceOrder() []*Node func (*Graph).TreeOrder() []*Node func (*GraphState).OwnedNodes(g *Graph, guard *limits.WorkGuard) (map[*Node]struct{}, error) func (*Hierarchy).Levels() map[*Node]int func (*Node).Adjacent(edge *Edge) *Node func (*Node).AllReachableNodesContext(includeContainers, includeNears, traverseTrees bool, ignore map[*Node]struct{}, guard *limits.WorkGuard) ([]*Node, error) func (*Node).AncestryParent() *Node func (*Node).ConnectedNodes(excluded []*Node, graph *Graph) []*Node func (*Node).ConnectedNodeSet(excludedNodes []*Node, graph *Graph) []*Node func (*Node).EffectiveContainer() *Node func (*Node).NearestSharedAncestor(other *Node) *Node func (*Node).OrderedNears() []*Node func (*Node).OwningContainer() *Node func (*Node).ReachableNodesContext(shouldVisit func(*Node) bool, includeContainers, includeNears, traverseTrees bool, ignore map[*Node]struct{}, guard *limits.WorkGuard) ([]*Node, error) func Nodes.DistanceClusters(threshold float64) [][]*Node func Nodes.DistanceClustersWithWorkGuard(threshold float64, guard *limits.WorkGuard) ([][]*Node, error) func Nodes.FixedNodes() []*Node func (*Sequence).AbductedNodeByEdge(edge *Edge) *Node func (*Sequence).First() *Node func (*Sequence).Last() *Node func (*Tree).SentinelNode() *Node func github.com/pancsta/d2/d2layouts/d2talalayout/internal/grouping.CreateVessel(cluster *Cluster, vesselID EntityID) *Node func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Candidates(graph *Graph) map[*Node]struct{} func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.PlaceChildrenOrder(ctx context.Context, nodes []*Node, edgeAbductions []*EdgeAbduction) ([]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.CommonUncleSiblings(graph *Graph) map[*Node]Nodes func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func AddDecodedEdge(node *Node, edge *Edge) func BuildNodeToTreeForDeserialization(trees map[*Node][]*Tree, guard *limits.WorkGuard) (map[*Node]*Tree, error) func MarkDecodedClusterVessel(node *Node) func MarkDecodedContainer(node *Node) func NewDecodedHierarchy(levels map[*Node]int) *Hierarchy func NewEdge(from, to *Node) *Edge func NewTree(node *Node) *Tree func NodeIDForSerialization(node *Node) EntityID func OrderedNearsForSerialization(node *Node) []*Node func SortNodesByID(nodes []*Node) func (*Cluster).Resize(vessel *Node) func ClusterGeometryWork.MoveNodeWithChildren(node *Node, dx, dy float64) error func ClusterGeometryWork.PositionContainerChildren(node *Node) error func (*Edge).ArrowheadTo(node *Node) Arrowhead func (*Edge).FacingTablePortValues(from, to *Node) (geo.Point, geo.Point, bool, bool, geo.Orientation) func (*Edge).HasArrowTo(node *Node) bool func (*Edge).IsTargetedTo(node *Node) bool func (*Edge).Reconnect(node *Node, to bool) func Edges.PortEdges(node *Node) map[geo.Point][]*Edge func (*Graph).AbductEdges(container *Node, toGraph *Graph) []*EdgeAbduction func (*Graph).AddNewNodeToContainer(container, node *Node) func (*Graph).AddNode(node *Node) *Node func (*Graph).AddNodeToContainer(container, node *Node) func (*Graph).AddNodeUnchecked(node *Node) func (*Graph).AllDescendantNodes(node *Node, includeClusterNodes bool) []*Node func (*Graph).AllDescendantNodesWithWorkGuard(node *Node, includeClusterNodes bool, guard *limits.WorkGuard) ([]*Node, error) func (*Graph).Connect(nodeA, nodeB *Node) *Edge func (*Graph).ContainerFixedOrigin(container *Node) *geo.Point func (*Graph).ContainerPadding(container *Node, considerChildren bool) Spacing func (*Graph).ContainerRDFSOrder(root *Node, guard *limits.WorkGuard) ([]*Node, error) func (*Graph).ContainerRDFSOrderUnbounded(root *Node) []*Node func (*Graph).Direction(container *Node) geo.Orientation func (*Graph).IsBadStateWithWorkGuard(node *Node, graphState *GraphState, ignoreContainerEscape bool, guard *limits.WorkGuard) (bool, error) func (*Graph).IsSequenceVessel(node *Node) bool func (*Graph).IsTreeSentinel(node *Node) bool func (*Graph).RemoveNode(node *Node) func (*Graph).WouldOverlapWithWorkGuard(node *Node, point *geo.Point, exceptions []*Node, pairwiseExceptions map[*Node]map[*Node]struct{}, guard *limits.WorkGuard) (bool, error) func (*Graph).WouldOverlapWithWorkGuard(node *Node, point *geo.Point, exceptions []*Node, pairwiseExceptions map[*Node]map[*Node]struct{}, guard *limits.WorkGuard) (bool, error) func (*Graph).WouldOverlapWithWorkGuard(node *Node, point *geo.Point, exceptions []*Node, pairwiseExceptions map[*Node]map[*Node]struct{}, guard *limits.WorkGuard) (bool, error) func (*Graph).WouldOverlapWithWorkGuard(node *Node, point *geo.Point, exceptions []*Node, pairwiseExceptions map[*Node]map[*Node]struct{}, guard *limits.WorkGuard) (bool, error) func (*GraphState).TracksNode(node *Node) bool func (*HerdAssignment).PairOppositeSide(node *Node) func (*HerdAssignment).PairSameSide(node *Node) func (*Hierarchy).ReplaceLevels(levels map[*Node]int) func (*Node).AddNear(otherN *Node) func (*Node).AllReachableNodesContext(includeContainers, includeNears, traverseTrees bool, ignore map[*Node]struct{}, guard *limits.WorkGuard) ([]*Node, error) func (*Node).ConnectedNodes(excluded []*Node, graph *Graph) []*Node func (*Node).ConnectedNodeSet(excludedNodes []*Node, graph *Graph) []*Node func (*Node).ConnectionTo(other *Node) *Edge func (*Node).Covers(n2 *Node) bool func (*Node).DeltaTo(other *Node, at *geo.Point) int func (*Node).DistanceTo(other *Node, includeSizes bool) float64 func (*Node).DoesOverlap(other *Node) bool func (*Node).DoesOverlapAt(other *Node, point *geo.Point) bool func (*Node).DoesOverlapExact(n2 *Node) bool func (*Node).IsAdjacentTo(other *Node, includeSizes bool) bool func (*Node).IsBlocked(nodeA, nodeB *Node, includeSizes, isHorizontal bool) bool func (*Node).IsDescendantOf(ancestor *Node) bool func (*Node).LabelBoxesOverlap(other *Node, padding float64) bool func (*Node).LabelOverlapArea(other *Node) float64 func (*Node).NearestSharedAncestor(other *Node) *Node func (*Node).Orientation(other *Node) geo.Orientation func (*Node).OrthogonalDistanceTo(other *Node) (float64, float64) func (*Node).OverlappingPorts(other *Node) map[geo.Point]bool func (*Node).OverlapsAlongDimension(other *Node, horizontal, includeSizes bool) bool func (*Node).ReachableNodesContext(shouldVisit func(*Node) bool, includeContainers, includeNears, traverseTrees bool, ignore map[*Node]struct{}, guard *limits.WorkGuard) ([]*Node, error) func (*Node).SameShape(other *Node) bool func (*Node).SpillsOutOf(container *Node) bool func (*Node).Surrounds(other *Node, withPadding float64) bool func (*Node).VisibilityGraphCandidate(horizontal, checkSide, includeSizes bool, other *Node, padding float64) bool func NodeGraphOwnershipJournal.OriginalGraph(node *Node) (*Graph, bool) func Nodes.Bottommost(node *Node) bool func Nodes.Leftmost(node *Node) bool func Nodes.Rightmost(node *Node) bool func Nodes.Topmost(node *Node) bool func (*Transaction).OriginalDimensions(node *Node) (width, height float64) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.NodeBoundingBox(node *Node, allNodes Nodes, guard graphbounds.WorkStepper) (*geo.Point, *geo.Point, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Assign(ctx context.Context, g *Graph, root *Node, hierarchicalNodes map[*Node]struct{}) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Assign(ctx context.Context, g *Graph, root *Node, hierarchicalNodes map[*Node]struct{}) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.IsHorizontal(nodes []*Node) bool func github.com/pancsta/d2/d2layouts/d2talalayout/internal/hierarchy.Place(ctx context.Context, g *Graph, root *Node, randGenerator *rand.Rand) (err error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/loops.Route(n *Node) []*Edge func github.com/pancsta/d2/d2layouts/d2talalayout/internal/loops.UpdateOffsets(node *Node) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/packing.Pack(ctx context.Context, g *Graph, root *Node) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placement.PlaceChildrenOrder(ctx context.Context, nodes []*Node, edgeAbductions []*EdgeAbduction) ([]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.ColumnCrossingCost(ctx context.Context, node *Node, edgeAbductions []*EdgeAbduction) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NewNodeEdgeLengthScorer(node *Node, options placementcost.EdgeLengthOptions) placementcost.NodeEdgeLengthScorer func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NodeEdgeLength(ctx context.Context, node *Node, options placementcost.EdgeLengthOptions) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NodeSymmetry(ctx context.Context, node *Node, edgeAbductions []*EdgeAbduction) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.ApplyVirally(ctx context.Context, herdOrder []*Node, herds map[*Node][]*Node) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.ApplyVirally(ctx context.Context, herdOrder []*Node, herds map[*Node][]*Node) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.ApplyVirally(ctx context.Context, herdOrder []*Node, herds map[*Node][]*Node) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AssignHerds(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.AssignNears(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) error func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.CanUseBothSides(node *Node, orientation geo.Orientation) bool func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.GroupSheep(ctx context.Context, graph *Graph, root *Node, abductions []*EdgeAbduction) (map[*Node][]*Node, map[*Node]map[*Node][]*Node, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.NewOVG(nodesInsideBoundingBox []*Node) *routing.OVG func github.com/pancsta/d2/d2layouts/d2talalayout/internal/routing.NewTunnelEntry(node *Node, ovgNode *routing.OVGNode) *routing.TunnelEntry func github.com/pancsta/d2/d2layouts/d2talalayout/internal/trees.Place(ctx context.Context, g *Graph, container *Node) error
NodeGraphOwnershipJournal records the graph pointer owned by each node before a subgraph split temporarily redirects it. OriginalGraph reports the graph pointer captured for node by the split. Restore restores every graph pointer captured by the split. func (*Graph).SplitSubgraphsTracked(ctx context.Context, options SplitOptions, work SharedWorkStepper) ([]*Graph, NodeGraphOwnershipJournal, error)
NodeGraphOwnershipSnapshot is a read-only capture of every pre-existing node owner reachable from a graph's runtime topology. Restore restores every graph pointer captured by the snapshot. func SnapshotNodeGraphOwnership(ctx context.Context, graph *Graph) (NodeGraphOwnershipSnapshot, error)
( Nodes) Bottommost(node *Node) bool ( Nodes) BoundingBox() (*geo.Point, *geo.Point) ( Nodes) BoundingBoxWithWorkGuard(guard *limits.WorkGuard) (*geo.Point, *geo.Point, error) ( Nodes) Center() *geo.Point ( Nodes) CenterWithWorkGuard(guard *limits.WorkGuard) (*geo.Point, error) ( Nodes) DebugID() string ( Nodes) DistanceClusters(threshold float64) [][]*Node ( Nodes) DistanceClustersWithWorkGuard(threshold float64, guard *limits.WorkGuard) ([][]*Node, error) ( Nodes) FixedBoundingBox() (*geo.Point, *geo.Point) ( Nodes) FixedNodes() []*Node ( Nodes) HasFixedNode() bool ( Nodes) IntersectsNode(edge *Edge) bool ( Nodes) Leftmost(node *Node) bool ( Nodes) NumAdjacent() int ( Nodes) Rightmost(node *Node) bool ( Nodes) SetGraphReference(g *Graph) ( Nodes) Topmost(node *Node) bool func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.CommonUncleSiblings(graph *Graph) map[*Node]Nodes func (*Node).BoundingBox(allNodes Nodes) (*geo.Point, *geo.Point) func (*Node).NodeOverlapCount(nodes Nodes, delta float64) int func github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.BoundingBox(nodes Nodes, guard graphbounds.WorkStepper) (*geo.Point, *geo.Point, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.FixedBoundingBox(nodes Nodes, guard graphbounds.WorkStepper) (*geo.Point, *geo.Point, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.NodeBoundingBox(node *Node, allNodes Nodes, guard graphbounds.WorkStepper) (*geo.Point, *geo.Point, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.AxisScore(nodes Nodes) float64 func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NodesEdgeLength(ctx context.Context, nodes Nodes, options placementcost.EdgeLengthOptions) (float64, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/placementcost.NodesSymmetry(ctx context.Context, nodes Nodes, edgeAbductions []*EdgeAbduction) (float64, error)
PlacementCostSnapshot is an opaque copy of graph-owned placement scoring state used to roll back a rejected optimizer candidate. Restore reinstates the captured costs and the exact cache map owned by the graph when the state was captured. func (*Graph).SnapshotPlacementCosts() *PlacementCostSnapshot
RoutingCostState is the cached routing-cost state that an atomic routing stage must restore on failure. Crossing float64 NonCenterPort float64 Turn float64 func (*Graph).RoutingCosts() RoutingCostState func (*Graph).RestoreRoutingCosts(state RoutingCostState)
Container *Node EdgeAbductions []*EdgeAbduction Graph *Graph Nodes []*Node Vessel *Node (*Sequence) AbductedNodeByEdge(edge *Edge) *Node ArrangeSteps places visible sequence steps relative to the vessel. (*Sequence) DebugID() string First and Last expose the endpoints needed by sequence-aware routing. (*Sequence) IsActive() bool (*Sequence) Last() *Node PlaceVessel positions the sequence vessel at the top-left of its steps. SyncGeometry resizes the sequence vessel and arranges its visible steps. SyncGeometryWithWork resizes the sequence vessel and arranges its visible steps through caller-owned cancellation and movement operations. func IsActiveSequenceForSerialization(sequence *Sequence) bool
SharedWorkStepper is the narrow accounting boundary used when a sibling layout domain supplies the aggregate work budget for graph traversal. ( SharedWorkStepper) Finish() error ( SharedWorkStepper) Step() error ClusterGeometryWork (interface) github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.WorkStepper (interface) *github.com/pancsta/d2/d2layouts/d2talalayout/internal/limits.OptimizationWorkGuard *github.com/pancsta/d2/d2layouts/d2talalayout/internal/limits.WorkGuard SharedWorkStepper : github.com/pancsta/d2/d2layouts/d2talalayout/internal/graphbounds.WorkStepper func (*Graph).SplitSubgraphsTracked(ctx context.Context, options SplitOptions, work SharedWorkStepper) ([]*Graph, NodeGraphOwnershipJournal, error) func (*Sequence).SyncGeometryWithWork(work SharedWorkStepper) error
( Spacing) Bottom() float64 ( Spacing) Left() float64 ( Spacing) Right() float64 ( Spacing) Top() float64 func UniformSpacing(value float64) Spacing func (*Graph).ContainerPadding(container *Node, considerChildren bool) Spacing func (*Node).FitToBoundingBox(topLeft, bottomRight *geo.Point, padding Spacing) func (*Node).FitToGraph(graph *Graph, padding Spacing) func (*Node).InsidePlacement(width, height float64, padding Spacing) geo.Point
SplitOptions controls which relationships connect nodes while splitting a graph into subgraphs. IncludeContainers bool IncludeNears bool TraverseTrees bool func (*Graph).SplitSubgraphs(ctx context.Context, options SplitOptions) ([]*Graph, error) func (*Graph).SplitSubgraphsTracked(ctx context.Context, options SplitOptions, work SharedWorkStepper) ([]*Graph, NodeGraphOwnershipJournal, error)
StyleScalar carries the value of one edge style attribute. Parser provenance belongs to the D2 adapter and must not enter the layout engine. Value string
Graph *Graph Ops []func() error PriorGraphState *GraphState (*Transaction) AddOp(fn func() error) CapturePlacementCosts attaches an optional stage-owned cost rollback point to this transaction. Ordinary Transaction.Rollback deliberately ignores it: speculative rejections retain memoized costs, while the enclosing stage decides whether to restore them. Clear only needs to be called if transaction will be reused CloneGeometryContext creates a nested speculative transaction that may only move geometry. GraphState snapshots are immutable for such trials, so sharing the rollback point avoids cloning every node map and overlap-exception set. UpdateState detaches on the first accepted candidate before recycling state. (*Transaction) Commit(ctx context.Context) (err error) (*Transaction) OriginalDimensions(node *Node) (width, height float64) PreservePriorGraphState pins the current rollback point so a later UpdateState cannot recycle it as scratch. Callers may retain the returned state for a larger atomic operation that spans multiple transaction commits. RestorePlacementCosts restores a captured placement-cost rollback point and reports whether one was present. (*Transaction) Rollback() (*Transaction) UpdateState() error func (*Graph).NewRequestTransaction(ctx context.Context, options TransactionOptions) (*Transaction, error) func (*Graph).NewRequestTransactionWithWorkGuard(ctx context.Context, guard *limits.WorkGuard, options TransactionOptions) (*Transaction, error) func (*Transaction).CloneGeometryContext() (*Transaction, error)
AffectContainers bool AffectEdgeRoutes records route slice and point identity for operations that move already-routed edges together with nodes. IgnoreContainerEscape bool func (*Graph).NewRequestTransaction(ctx context.Context, options TransactionOptions) (*Transaction, error) func (*Graph).NewRequestTransactionWithWorkGuard(ctx context.Context, guard *limits.WorkGuard, options TransactionOptions) (*Transaction, error)
Children []*Tree Node *Node Orientation geo.Orientation Parent *Tree SentinelEdge *Edge (*Tree) SentinelNode() *Node func BuildNodeToTreeForDeserialization(trees map[*Node][]*Tree, guard *limits.WorkGuard) (map[*Node]*Tree, error) func NewTree(node *Node) *Tree func github.com/pancsta/d2/d2layouts/d2talalayout/internal/trees.Descendants(root *Tree) []*Tree func BuildNodeToTreeForDeserialization(trees map[*Node][]*Tree, guard *limits.WorkGuard) (map[*Node]*Tree, error) func github.com/pancsta/d2/d2layouts/d2talalayout/internal/trees.Descendants(root *Tree) []*Tree
type Trees ([])
Package-Level Functions (total 41)
func AddDecodedEdge(node *Node, edge *Edge)
BuildNodeToTreeForDeserialization derives the auxiliary tree index under the decoder's shared work budget.
Clone returns the layout graph projection used for an independent layout attempt. It deliberately copies the stable graph state, not transient optimizer state: derived caches, herd assignments, long-distance placement requirements, route diagnostics, and fixed-label bookkeeping are reset. The returned graph is published only after the complete bounded copy has succeeded. Every graph-owned node, cluster, and sequence is rebound to the returned graph; inactive cluster and sequence vessels remain detached.
ContainerOrderForSerialization returns the stable reverse-DFS fixture order while charging the caller's shared serialization work budget.
ContextWithTransactionWorkGuard lets a layout domain share one aggregate request budget with every speculative graph transaction it creates.
func CostsForSerialization(graph *Graph) (crossing, turn, nonCenterPort float64)
CountSegmentCrossings counts intersections between segments while ignoring pairs with equal starts or equal ends. It is the common geometric kernel used by layout cost evaluation and hierarchy rank optimization.
CountSegmentCrossingsContext is CountSegmentCrossings with the layout engine's bounded cancellation checks.
func Covers(outer, inner *geo.Box) bool
ExistingTransactionWorkGuard checks and returns the request's aggregate transaction guard without allocating a derived context or standalone budget.
IsCandidateRejection reports whether err rejects only the current speculative candidate. Callers must propagate every other error.
LabelBoxFits reports whether outer completely contains inner.
func NewEdge(from, to *Node) *Edge
func NewEdgeSegment(start, end *geo.Point, edge *Edge) *EdgeSegment
func NewGraph() *Graph
NewGraphStateSnapshot creates an empty rollback snapshot with the requested capture scope.
NewHierarchy creates an empty hierarchy record.
func NewNode(id EntityID, width, height float64) *Node
func NewTree(node *Node) *Tree
NodeIDForSerialization represents a nil root with the fixture ID zero.
PublishDeserializedGraph atomically replaces graph-owned state while retaining the destination graph's mutex identity.
func RestoreGraphState(graph *Graph, state *GraphState)
SegmentsCross reports whether two finite segments intersect. Parallel and overlapping segments do not count as crossings.
SequenceAdvance is the horizontal distance from one step's top-left to the next. The rendered Step shape clamps its wedge to half of the width when the requested width is at most STEP_WEDGE_WIDTH, so fixed-size narrow steps must use the same geometry instead of always overlapping by the full wedge.
SnapshotNodeGraphOwnership captures every node reachable through the graph's runtime topology, including nodes referenced only by grouping, tree, proximity, hub, or hierarchy state. It does not mutate the graph.
SortNodesByID gives sibling layout domains the engine's stable node order.
func Validate(ctx context.Context, operation string, g *Graph) error
ValidateForSerialization performs the layout graph's complete bounded topology preflight before graphjson starts encoding references.
ValidatePositionedGraph checks the structural and positioned geometry invariants required by algorithms that inspect labels and routed edges.
ValidatePositionedGraphSelection checks the topology and positioned route geometry consumed by label placement and completed-layout evaluation. extraEdges may repeat graph edges once (the normal route-only selection), but neither input list may contain aliases within itself.
ValidateSubgraphCombination validates node-owned topology across a set of aliased graph views after each distinct graph-owned map identity has passed Validate.
Package-Level Variables (total 2)
ErrInvalidCandidate rejects a speculative layout candidate whose geometry cannot be committed.
ErrNonImprovingCandidate rejects a valid candidate that does not improve the current layout.
Package-Level Constants (total 21)
AxisAlignmentTolerance is the maximum coordinate difference still treated as axis-aligned.
const Column ClusterArrangement = "Column"
ConnectedNodeGap is the minimum gap between connected nodes.
ContainerPadding is the ordinary padding on each side of a container.
CrossingCostWeight is the shared penalty for one edge crossing.
MaxIconSize caps positioned icon geometry.
const MaxRoutePoints int64 = 1000000
These limits are exported for sibling graph codecs. They are part of the engine's resource-safety contract, not configurable layout policy.
These limits are exported for sibling graph codecs. They are part of the engine's resource-safety contract, not configurable layout policy.
These limits are exported for sibling graph codecs. They are part of the engine's resource-safety contract, not configurable layout policy.
MaxTopologyDepth is the maximum supported depth for layout ownership and ancestry relations.
const MaxTopologyReferences int64 = 1000000
MinArrowheadClearance is the minimum route length needed to fit an arrowhead.
MinPortClearance keeps the first route bend away from its port.
MinRouteNodeClearance keeps visibility-graph points away from node bounds.
const NoArrowhead Arrowhead = "none"
NodeGap is the minimum gap between unconnected nodes.
const Row ClusterArrangement = "Row"
TableNodeGap leaves enough room for table-edge routing.
TreeParentSpacing is the fixed gap used to place and route tree levels.
const TriangleArrowhead Arrowhead = "triangle"