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: alphabet | popularity */
type Edge (struct)
Fields (total 18 )
D2ID *string
From *Node
FromTableColumnIndex *int
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
Methods (total 37 )
(*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
(*Edge) HierarchyRankWeight () int
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
(*Edge) IsClusterEdge () 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
(*Edge) LabelTopLeft (labelPosition label .Position , width, height float64 ) *geo .Point
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 )
(*Edge) SetHierarchyRankWeight (weight int )
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
As Outputs Of (at least 7 )
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
As Inputs Of (at least 18 )
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
type EdgeAbduction (struct)
EdgeAbduction represents the temporary transfer of an edge from a descendant
container to the ancestor child so node placement can operate on containers.
Fields (total 5 )
CurrentFrom *Node
CurrentTo *Node
Edge *Edge
OriginallyFrom *Node
OriginallyTo *Node
As Outputs Of (at least 2 )
func (*Graph ).AbductEdges (container *Node , toGraph *Graph ) []*EdgeAbduction
func (*Graph ).RestoreEdgeAbductions (edgeAbductions []*EdgeAbduction ) []*EdgeAbduction
As Inputs Of (at least 9 )
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 )
type EdgeSegment (struct)
Fields (total 3 )
Segment geo .Segment
Segment .End *geo .Point
Segment .Start *geo .Point
Methods (total 8 )
(*EdgeSegment) GetBounds (segments []*geo .Segment , buffer float64 ) (float64 , float64 )
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
Implements (at least one exported )
EdgeSegment : github.com/pancsta/d2/lib/geo.Intersectable
As Outputs Of (at least one exported )
func NewEdgeSegment (start, end *geo .Point , edge *Edge ) *EdgeSegment
type Graph (struct)
Fields (total 12 )
CellSize float64
Clusters map[*Node ]*Cluster
-- 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 map[*Node ][]*Node
-- 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 map[*Node ]geo .Orientation
-- 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
IsRootHierarchy bool
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 map[*Node ][]*Tree
-- 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
Methods (total 56 )
(*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 )
(*Graph) AddNodeUnchecked (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 )
(*Graph) Area () float64
Area returns the area of the graph's unrounded bounding box, including
routed edges and positioned labels.
(*Graph) BoundingBox () (*geo .Point , *geo .Point )
(*Graph) ClusterOrder () []*Node
ClusterOrder returns cluster vessels in stable ID order.
(*Graph) ClusterRDFSOrder () []*Node
ClusterRDFSOrder returns cluster vessels in reverse depth-first container order.
(*Graph) ComputeCellSize ()
(*Graph) ComputeNodeSpacing ()
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
(*Graph) ContainerRDFSOrder (root *Node , guard *limits .WorkGuard ) ([]*Node , error )
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
(*Graph) Direction (container *Node ) geo .Orientation
Direction reports the layout direction assigned to container.
(*Graph) Disconnect (edge *Edge )
(*Graph) EdgeLengthCacheEntries () int
EdgeLengthCacheEntries reports the size of the graph-owned placement cache.
(*Graph) FixedNodes () []*Node
(*Graph) HalveTurnCost ()
(*Graph) HasFixedNode () bool
(*Graph) HubOrder () []*Node
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
(*Graph) LookupEdgeLengthCost (state uint64 ) (float64 , bool )
LookupEdgeLengthCost reads one entry from the graph-owned placement cache
while holding the graph's cost read lock.
(*Graph) NewRequestTransaction (ctx context .Context , options TransactionOptions ) (*Transaction , error )
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 )
(*Graph) ReplaceEdgesUnchecked (edges []*Edge )
ReplaceEdgesUnchecked replaces graph edge ownership and rebuilds both
endpoint incidence lists. The caller is responsible for supplying valid
graph-owned endpoints.
(*Graph) ResetPlacementCosts ()
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
(*Graph) SequenceOrder () []*Node
SequenceOrder returns sequence vessels in stable ID order.
(*Graph) SnapshotPlacementCosts () *PlacementCostSnapshot
SnapshotPlacementCosts copies graph-owned scoring state. The placement
domain charges its own work budget before requesting this bounded copy.
(*Graph) SplitSubgraphs (ctx context .Context , options SplitOptions ) ([]*Graph , error )
SplitSubgraphs partitions the graph into sets of mutually reachable nodes.
(*Graph) SplitSubgraphsTracked (ctx context .Context , options SplitOptions , work SharedWorkStepper ) ([]*Graph , NodeGraphOwnershipJournal , error )
SplitSubgraphsTracked splits a graph while returning the exact ownership
journal needed by callers that keep the temporary subgraphs alive during a
larger atomic operation.
(*Graph) StoreEdgeLengthCost (state uint64 , cost float64 )
StoreEdgeLengthCost writes one entry while holding the graph's cost lock. It
is a no-op when this graph has disabled placement caching.
(*Graph) SyncClusters ()
SyncClusters synchronizes every active cluster in nested graph order.
(*Graph) SyncNestedGeometry ()
(*Graph) SyncSequences ()
SyncSequences synchronizes every active sequence in nested graph order.
(*Graph) TreeEdgeMap () map[*Edge ]bool
(*Graph) TreeOrder () []*Node
TreeOrder returns tree sentinels in stable ID order.
(*Graph) TurnCost () float64
(*Graph) WouldOverlapWithWorkGuard (node *Node , point *geo .Point , exceptions []*Node , pairwiseExceptions map[*Node ]map[*Node ]struct{}, guard *limits .WorkGuard ) (bool , error )
WouldOverlapWithWorkGuard reports whether placing node at point overlaps an
unexcepted graph node while charging the complete comparison.
As Outputs Of (at least 9 )
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 )
As Inputs Of (at least 81 )
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
type Node (struct)
Node positions and dimensions for shapes should always be whole numbers
When used in OVGs for edge routing, they can take decimal values
Fields (total 27 )
Box geo .Box
Box .Height float64
Box .TopLeft *geo .Point
Box .Width float64
Cluster *Cluster
Container *Node
D2ID *string
DesiredHeight *float64
DesiredWidth *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
Is3D bool
to adjust where connections are for 3d/multiple styles
IsInvisible bool
Connections can go through invisible nodes.
For example, opacity 0 grid cells used for spacing
IsMultiple bool
Label *Label
LongDistanceNeighborRequirements map[*Node ]LongDistanceNeighborRequirements
LongDistanceNeighborRequirements records optimizer-derived parallel-edge
spacing by adjacent node.
LoopOffsets map[geo .Orientation ]float64
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 map[*Node ]struct{}
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
Shape nodeshape .Shape
This defines the snap points
Methods (total 114 )
(*Node) AddIncidentEdgeUnchecked (edge *Edge )
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 )
(*Node) AncestryParent () *Node
AncestryParent returns the parent relation used by layout ancestry checks.
Unlike EffectiveContainer, active cluster and sequence ancestry follows the
vessel itself.
(*Node) Area () float64
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
( Node) CenterPortIndex (orientation geo .Orientation ) int
CenterPortIndex returns the center port for an orientation, or -1 if the
shape does not expose one.
( Node) CenterPortIndices () []int
CenterPortIndices returns the center port on each side.
(*Node) CenterPorts () []geo .Point
(*Node) ConnectedNodeSet (excludedNodes []*Node , graph *Graph ) []*Node
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
(*Node) ContainerDirection () geo .Orientation
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
(*Node) Covers (n2 *Node ) bool
. ┌────────────────┐
. │ ┌───┐ │
. │ 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
(*Node) DoesOverlapExact (n2 *Node ) bool
DoesOverlapExact reports whether node boxes overlap without clearance padding.
(*Node) EffectiveContainer () *Node
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 )
(*Node) FixedOrigin () *geo .Point
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
( Node) GetInnerBoxForContent (width, height float64 ) *geo .Box
cloud shape has different innerBoxes depending on content's aspect ratio
( Node) GetInsidePlacement (width, height, paddingX, paddingY float64 ) geo .Point
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
(*Node) HasLeakyEdge () bool
HasLeakyEdge checks if
1. node is a container
2. a descendant has an edge going outside the container
(*Node) HierarchyLevel () int
HierarchyLevel returns n's assigned level. Callers must only use it for a
node with non-nil Hierarchy membership.
(*Node) IDValue () EntityID
(*Node) IconSize (iconPosition label .Position ) float64
IconSize returns the icon size appropriate for iconPosition on n.
(*Node) InitIcon ()
(*Node) InnerBox () *geo .Box
InnerBox returns n's rounded content box.
(*Node) InsidePlacement (width, height float64 , padding Spacing ) geo .Point
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
(*Node) Intersects (s geo .Segment , buffer float64 ) bool
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
(*Node) IsImage () 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
(*Node) LabelBoxesOverlap (other *Node , padding float64 ) bool
LabelBoxesOverlap reports whether two node boxes overlap with the requested
padding.
(*Node) LabelOverlapArea (other *Node ) float64
LabelOverlapArea returns the rectangular overlap area. Callers must first prove
that the nodes overlap.
( Node) LabelPositionPreferences (tier nodeshape .LabelTier ) map[label .Position ]struct{}
LabelPositionPreferences returns the positions in a preference tier.
(*Node) LabelTopLeft (labelPosition label .Position , width, height float64 ) *geo .Point
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 )
( Node) MirroredPortIndices () map[int ]int
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
(*Node) NodeOverlapCount (nodes Nodes , delta float64 ) int
NodeOverlapCount reports how many nodes overlap node within delta.
(*Node) NumColumns () int
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
(*Node) OwningContainer () *Node
OwningContainer resolves the active cluster or sequence vessel before
falling back to the node's direct container.
(*Node) PadLabelCandidate (padding int )
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
( Node) Perimeter () []geo .Intersectable
Perimeter returns a slice of geo.Intersectables that together constitute the shape border
(*Node) PointPastFixedOrigin (x, y float64 , includeSizes bool ) bool
( Node) PortIndices (orientation geo .Orientation ) []int
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 )
(*Node) ShapeType () string
ShapeType reports the node's canonical shape type.
( Node) SnapPointPercentages () [][]*geo .RelativePoint
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 ()
Implements (at least 3 )
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
As Outputs Of (at least 45 )
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 )
As Inputs Of (at least 99 )
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
type Nodes ([])
Methods (total 17 )
( 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
As Outputs Of (at least one exported )
func github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity.CommonUncleSiblings (graph *Graph ) map[*Node ]Nodes
As Inputs Of (at least 8 )
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 )
type Transaction (struct)
Fields (total 3 )
Graph *Graph
Ops []func() error
PriorGraphState *GraphState
Methods (total 10 )
(*Transaction) AddOp (fn func() error )
(*Transaction) CapturePlacementCosts (location string ) 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.
(*Transaction) Clear ()
Clear only needs to be called if transaction will be reused
(*Transaction) CloneGeometryContext () (*Transaction , error )
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 )
(*Transaction) PreservePriorGraphState () *GraphState
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.
(*Transaction) RestorePlacementCosts () bool
RestorePlacementCosts restores a captured placement-cost rollback point and
reports whether one was present.
(*Transaction) Rollback ()
(*Transaction) UpdateState () error
As Outputs Of (at least 3 )
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 )
Package-Level Functions (total 41)
Package-Level Variables (total 2)
Package-Level Constants (total 21)
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .