22 lines
529 B
Go
22 lines
529 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"lib/graph"
|
|
)
|
|
|
|
func main() {
|
|
n := &graph.Node{Value: "1"}
|
|
n2 := &graph.Node{Value: "2"}
|
|
n3 := &graph.Node{Value: "3"}
|
|
|
|
n.Connect(n2)
|
|
n.Connect(n3)
|
|
n3.Connect(n.GetConnections()[0])
|
|
//n.Disconnect(&n2)
|
|
//fmt.Println(n.RemovePointerTo(n3))
|
|
fmt.Println("n -> n2: ", n2.IsConnectedTo(n), " n <- n2: ", n.IsConnectedTo(n2))
|
|
fmt.Println("n -> n3: ", n.IsConnectedTo(n3), " n <- n3: ", n3.IsConnectedTo(n))
|
|
fmt.Println("n2 -> n3: ", n2.IsConnectedTo(n3), " n2 <- n3: ", n3.IsConnectedTo(n2))
|
|
}
|