Graph graph = new Graph(); // Create a new graph object graph.AddVertex("v0"); graph.AddVertex("v1"); // Add vertices to the graph graph.AddVertex("v2"); graph.AddVertex("v3"); graph.AddVertex("v4"); graph.AddVertex("v5"); graph.AddEdge(0, 1, 2); graph.AddEdge(0, 2, 3); // Add edges to the graph graph.AddEdge(1, 2, 2); graph.AddEdge(1, 3, 1); graph.AddEdge(1, 4, 3); graph.AddEdge(1, 5, 2); graph.AddEdge(2, 4, 1); graph.AddEdge(3, 4, 2); graph.AddEdge(3, 5, 1); graph.AddEdge(4, 5, 2);
U -> V: 0 -> 1 wt 1U -> V: 0 -> 2 wt 4U -> V: 0 -> 3 wt 0U -> V: 0 -> 4 wt 0U -> V: 0 -> 5 wt 0