package tree import ( "fmt" ) func DebugPrintTree(root *Node) { debugPrintTreeR(root, 0) } func debugPrintTreeR(node *Node, level int) { for i := 0; i < level; i++ { fmt.Printf(" ") } DebugPrintNode(node) for _, child := range node.Children { debugPrintTreeR(child, level+1) } } func DebugPrintNode(node *Node) { fmt.Printf("%c @ %p. Children: ", node.Name, node) for _, child := range node.Children { fmt.Printf("%c ", child.Name) } fmt.Printf("Parents: ") for _, parent := range node.Parents { fmt.Printf("%c ", parent.Name) } fmt.Printf("\n") }