exercism/go/pov/cmd/main.go

27 lines
528 B
Go

package main
import (
"fmt"
pov ".."
)
func main() {
g := pov.New()
g.AddNode("parent")
g.AddArc("parent", "x")
g.AddArc("x", "sib-2")
g.AddArc("x", "sib-3")
g.AddArc("x", "sib-4")
g.AddArc("parent", "sibling")
g.AddArc("sibling", "child-1")
g.AddArc("sibling", "child-2")
g.AddArc("sibling", "child-3")
g.AddArc("child-3", "grandchild-1")
g.AddArc("grandchild-1", "greatgrandchild-1")
pov.PrintGraph(g)
fmt.Println("== Change Root to child-3 ==")
n := g.ChangeRoot("parent", "child-3")
pov.PrintGraph(n)
}