exercism/go/pov/cmd/main.go
Brian Buller 42d8211402 Changing it into a graph
Since that's what they actually want, even though the exercise says it's
a tree
2017-08-24 11:16:04 -05:00

21 lines
308 B
Go

package main
import (
"fmt"
pov ".."
)
func main() {
g := pov.New()
g.AddNode("sibling")
g.AddNode("x")
g.AddArc("parent", "sibling")
g.AddArc("parent", "x")
fmt.Println("== Change Root to child-3 ==")
g.Print("parent")
n := g.ChangeRoot("parent", "x")
fmt.Println(n.ArcList())
g.Print("x")
}