package mrtree
import (
"github.com/d2lang/elk-go/internal/geometry"
"github.com/d2lang/elk-go/internal/graph"
)
type tGraph struct {
nodes []*tNode
edges []*tEdge
padding geometry .Spacing
spacing float64
spacingEdgeNode float64
edgeEndTextureLength float64
aspectRatio float64
separate bool
searchOrder string
weighting string
direction string
edgeRoutingMode string
compaction bool
fixedGraphSize bool
graphMin geometry .Point
graphMax geometry .Point
}
type tNode struct {
id int
origin *graph .NodeID
position geometry .Point
size geometry .Point
props graph .PropertyMap
outgoing []*tEdge
incoming []*tEdge
root, dummy bool
fan, descendants int
leftNeighbor *tNode
rightNeighbor *tNode
leftSibling *tNode
rightSibling *tNode
positionIndex int
prelim, modifier float64
levelHeight float64
treeLevel int
levelMin float64
levelMax float64
compactConstraints []*tNode
compactLevelAscension bool
xCoordinate int
yCoordinate int
}
type tEdge struct {
origin *graph .EdgeID
source *tNode
target *tNode
bendPoints geometry .Chain
dummy bool
}
func (node *tNode ) children () []*tNode {
children := make ([]*tNode , 0 , len (node .outgoing ))
for _ , edge := range node .outgoing {
children = append (children , edge .target )
}
return children
}
func (node *tNode ) parent () *tNode {
if len (node .incoming ) == 0 {
return nil
}
return node .incoming [0 ].source
}
func (node *tNode ) leaf () bool { return len (node .outgoing ) == 0 }
func (g *tGraph ) addDummyChild (parent , child *tNode ) {
edge := &tEdge {source : parent , target : child , dummy : true }
g .edges = append (g .edges , edge )
parent .outgoing = append (parent .outgoing , edge )
child .incoming = append (child .incoming , edge )
}
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 .