Example #1
0
func buildEdges(bldrs set.OrderedSet, nm map[*Node]*dotnode, del string) []*dotedge {
	edges := make([]*dotedge, 0, bldrs.Count())

	bldrs.Visit(func(e interface{}) {
		bldr := e.(*Edge)
		if bldr.Src != nil && bldr.Dst != nil {
			edges = append(edges, bldr.build(nm, del))
		}
	})
	return edges
}
Example #2
0
func buildNodes(bldrs set.OrderedSet) ([]*dotnode, map[*Node]*dotnode) {
	nodes := make([]*dotnode, 0, bldrs.Count())
	nodemap := make(map[*Node]*dotnode)

	id := 0
	bldrs.Visit(func(e interface{}) {
		bldr := e.(*Node)
		node := bldr.build(id)
		nodes = append(nodes, node)
		nodemap[bldr] = node
		id++
	})

	return nodes, nodemap
}