21 lines
282 B
Go
21 lines
282 B
Go
|
package pov
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func PrintGraph(g *Graph) {
|
||
|
for i := range g.leaves {
|
||
|
PrintNode(&g.leaves[i], 1)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func PrintNode(n *Node, lvl int) {
|
||
|
strings.Repeat(" ", lvl)
|
||
|
fmt.Println(n.label)
|
||
|
for i := range n.leaves {
|
||
|
PrintNode(&n.leaves[i], lvl+1)
|
||
|
}
|
||
|
}
|