Brian Buller
42d8211402
Since that's what they actually want, even though the exercise says it's a tree
21 lines
308 B
Go
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")
|
|
}
|