25 lines
527 B
Go
25 lines
527 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"lib/graph"
|
|
)
|
|
|
|
func main() {
|
|
n := new(graph.Node)
|
|
n.Value = "1"
|
|
n2 := new(graph.Node)
|
|
n2.Value = "2"
|
|
n3 := new(graph.Node)
|
|
n3.Value = "3"
|
|
|
|
n.Connect(n2)
|
|
n.Connect(n3)
|
|
n2.Connect(n3)
|
|
n.DisconnectAll()
|
|
fmt.Println(n.IsConnectedTo(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))
|
|
}
|