Graph – Creating a Directed Graph
•
Example:
Graph<string> directedGraph = new Graph<string>(GraphType.Directed);
GraphVertex<string> u = directedGraph.CreateVertex("u");
GraphVertex<string> v = directedGraph.CreateVertex("v");
GraphVertex<string> w = directedGraph.CreateVertex("w");
GraphVertex<string> x = directedGraph.CreateVertex("x");
GraphVertex<string> y = directedGraph.CreateVertex("y");
GraphVertex<string> z = directedGraph.CreateVertex("z");
directedGraph.AddEdge(u, v);
directedGraph.AddEdge(u, x);
directedGraph.AddEdge(x, v);
directedGraph.AddEdge(v, y);
directedGraph.AddEdge(y, x);
directedGraph.AddEdge(w, y);
directedGraph.AddEdge(w, z);
directedGraph.AddEdge(z, z);