package layoutgraphimport ()const maxPositionedRoutePoints = 1_000_000// 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.func ( context.Context, string, *Graph, []*Edge) error {// Keep the central topology preflight first. Besides bounding hidden graph // state before candidate allocations, its graph-before-context error order // is part of the direct engine API contract.if := validateEngineGraph(, , ); != nil {return }if == nil {returnfmt.Errorf("TALA %s requires a context", ) }if := .Err(); != nil {returnfmt.Errorf("%s: %w", , ) }if == nil {returnfmt.Errorf("TALA %s requires a graph", ) }iflen(.Nodes) > limits.MaxEngineNodes {returnfmt.Errorf("TALA %s node count exceeds limit %d", , limits.MaxEngineNodes) }iflen(.Edges) > limits.MaxEngineEdges {returnfmt.Errorf("TALA %s edge count exceeds limit %d", , limits.MaxEngineEdges) }iflen() > limits.MaxEngineEdges {returnfmt.Errorf("TALA %s requested edge count exceeds limit %d", , limits.MaxEngineEdges) } := 0 := func() error { ++if %64 != 0 {returnnil }if := .Err(); != nil {returnfmt.Errorf("%s: %w", , ) }returnnil }for , := range .Nodes {if := (); != nil {return }if == nil {returnfmt.Errorf("TALA %s graph node at index %d is nil", , ) }if .TopLeft == nil {returnfmt.Errorf("TALA %s graph node %d has no position", , .ID) }if .Cluster != nil && .Cluster.Vessel == nil {returnfmt.Errorf("TALA %s graph node %d has a cluster without a vessel", , .ID) }if .Sequence != nil && .Sequence.Vessel == nil {returnfmt.Errorf("TALA %s graph node %d has a sequence without a vessel", , .ID) } } := make(map[*Edge]struct{}, len(.Edges)) := make(map[*Edge]struct{}, len()) := make(map[*Edge]struct{}, len(.Edges)+len()) := 0 := func( *Edge, int, string, map[*Edge]struct{}) error {if := (); != nil {return }if == nil {returnfmt.Errorf("TALA %s %s at index %d is nil", , , ) }if , := []; {returnfmt.Errorf("TALA %s %s at index %d repeats edge %d", , , , .entityID()) } [] = struct{}{}if , := []; {returnnil } [] = struct{}{}if .From == nil || .To == nil {returnfmt.Errorf("TALA %s edge %d has missing endpoints", , .entityID()) }iflen(.Points) > maxPositionedRoutePoints- {returnfmt.Errorf("TALA %s route point count exceeds limit %d", , maxPositionedRoutePoints) } += len(.Points)for , := range .Points {if := (); != nil {return }if == nil {returnfmt.Errorf("TALA %s edge %d route point at index %d is nil", , .entityID(), ) } }if (.Label != nil || .SourceArrowheadLabel != nil || .TargetArrowheadLabel != nil) && len(.Points) < 2 {returnfmt.Errorf("TALA %s labeled edge %d requires at least two route points", , .entityID()) }returnnil }for , := range .Edges {if := (, , "graph edge", ); != nil {return } }for , := range {if := (, , "requested edge", ); != nil {return } }if := .Err(); != nil {returnfmt.Errorf("%s: %w", , ) }returnnil}
The pages are generated with Goldsv0.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.