2017-08-15 22:06:46 +00:00
|
|
|
package main
|
|
|
|
|
2017-08-17 18:12:16 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
pov ".."
|
|
|
|
)
|
2017-08-15 22:06:46 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
g := pov.New()
|
2017-08-24 16:16:04 +00:00
|
|
|
g.AddNode("sibling")
|
|
|
|
g.AddNode("x")
|
2017-08-17 18:12:16 +00:00
|
|
|
g.AddArc("parent", "sibling")
|
2017-08-24 16:16:04 +00:00
|
|
|
g.AddArc("parent", "x")
|
2017-08-17 18:12:16 +00:00
|
|
|
fmt.Println("== Change Root to child-3 ==")
|
2017-08-24 16:16:04 +00:00
|
|
|
g.Print("parent")
|
|
|
|
n := g.ChangeRoot("parent", "x")
|
|
|
|
fmt.Println(n.ArcList())
|
|
|
|
g.Print("x")
|
2017-08-15 22:06:46 +00:00
|
|
|
}
|