Source File
hubs.go
Belonging Package
github.com/pancsta/d2/d2layouts/d2talalayout/internal/proximity
// Package proximity discovers layout relationships between nearby nodes.package proximityimport ()// AddHubs discovers nodes that have both a leaf spoke and another connection// within the same containing layout group.func ( context.Context, *layoutgraph.Graph) error {if := layoutgraph.Validate(, "AddHubs", ); != nil {return}, := limits.NewWorkGuard(, "AddHubs", limits.MaxEngineWorkUnits)if != nil {return}:= make(map[*layoutgraph.Node][]*layoutgraph.Node)for , := range .Nodes {if := .Step(); != nil {return}:= falsevar []*layoutgraph.Nodefor , := range .Edges {if := .Step(); != nil {return}:= .Adjacent()if .OwningContainer() != .OwningContainer() {continue}if len(.Edges) == 1 {= append(, )} else {= true}}if && len() > 0 {[] =}}if := .Finish(); != nil {return}.Hubs =return nil}
![]() |
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. |