28 lines
528 B
Go
28 lines
528 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"lib/graph"
|
|
)
|
|
|
|
func main() {
|
|
n := &graph.Node{Value: "1"}
|
|
n2 := new(graph.Node)
|
|
n2.Value = "2"
|
|
n3 := new(graph.Node)
|
|
n3.Value = "3"
|
|
|
|
n.SetPointTo(n2)
|
|
n.SetPointTo(n3)
|
|
n2.SetPointTo(n3)
|
|
|
|
n2.SetPointTo(n)
|
|
n3.SetPointTo(n)
|
|
|
|
n.DisconnectAll()
|
|
|
|
fmt.Println("n -> n2: ", n.IsPointingTo(n2), " n <- n2: ", n2.IsPointingTo(n))
|
|
fmt.Println("n -> n3: ", n.IsPointingTo(n3), " n <- n3: ", n3.IsPointingTo(n))
|
|
fmt.Println("n2 -> n3: ", n2.IsPointingTo(n3), " n2 <- n3: ", n3.IsPointingTo(n2))
|
|
}
|