exercism/go/pov/pov_helper.go
2017-08-15 17:06:46 -05:00

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)
}
}