import ( "github.com/openshift/origin/pkg/api/graph" ) // create a new graph object g := graph.New() // add two nodes, A and B nodeA := graph.NewNode("A") nodeB := graph.NewNode("B") g.AddNode(nodeA) g.AddNode(nodeB) // add an edge from A to B g.AddEdge(nodeA, nodeB)
import ( "github.com/openshift/origin/pkg/api/graph" ) // create a new graph object with several nodes g := graph.New() nodeA := graph.NewNode("A") nodeB := graph.NewNode("B") nodeC := graph.NewNode("C") g.AddNode(nodeA) g.AddNode(nodeB) g.AddNode(nodeC) // add several edges g.AddEdge(nodeA, nodeB) g.AddEdge(nodeB, nodeC) g.AddEdge(nodeC, nodeA)In this example, we create a new graph object with three nodes, "A", "B", and "C", using "NewNode" and add them to the graph using "AddNode". Then, we add three edges between the nodes using "AddEdge".