// // Second Case Initialization private static void _initializeSecondCaseGraph(ref IGraph <string> graph) { // Clear the graph graph.Clear(); // // Add vertices var verticesSet = new string[] { "a", "b", "c", "d", "e", "f", "s", "v", "x", "y", "z" }; graph.AddVertices(verticesSet); // // Add edges // Connected Component #1 // the vertex "e" won't be connected to any other vertex // Connected Component #2 graph.AddEdge("a", "s"); graph.AddEdge("a", "d"); graph.AddEdge("s", "x"); graph.AddEdge("s", "a"); graph.AddEdge("x", "d"); // Connected Component #3 graph.AddEdge("b", "c"); graph.AddEdge("b", "v"); graph.AddEdge("c", "f"); graph.AddEdge("c", "v"); graph.AddEdge("f", "b"); // Connected Component #4 graph.AddEdge("y", "z"); }
// // Second Case Initialization private static void _initializeFirstCaseGraph(ref IGraph <string> graph) { // Clear the graph graph.Clear(); // // Add vertices var verticesSet = new string[] { "a", "b", "c" }; graph.AddVertices(verticesSet); // // Add Edges graph.AddEdge("a", "b"); graph.AddEdge("b", "c"); graph.AddEdge("c", "a"); }
// // Second Case Initialization private static void _initializeSecondCaseGraph(ref IGraph <string> graph, ref string result) { // Clear the graph graph.Clear(); // // Add vertices var verticesSet = new string[] { "a", "b", "c", "d", "e", "f", "s", "v", "x", "y", "z" }; graph.AddVertices(verticesSet); result = result + "Initial Verrtices: 'a', 'b', 'c', 'd', 'e', 'f', 's', 'v', 'x', 'y', 'z' " + "\n\n"; // // Add edges // Connected Component #1 // the vertex "e" won't be connected to any other vertex // Connected Component #2 graph.AddEdge("a", "s"); graph.AddEdge("a", "d"); graph.AddEdge("s", "x"); graph.AddEdge("s", "a"); graph.AddEdge("x", "d"); // Connected Component #3 graph.AddEdge("b", "c"); graph.AddEdge("b", "v"); graph.AddEdge("c", "f"); //graph.AddEdge("c", "v"); //graph.AddEdge("f", "b"); // Connected Component #4 graph.AddEdge("y", "z"); result = result + "Graph representation:"; result = result + graph.ToReadable() + "\r\n\n"; }
// // Second Case Initialization private static void _initializeSecondCaseGraph(ref IGraph<string> graph) { // Clear the graph graph.Clear(); // // Add vertices var verticesSet = new string[] { "a", "b", "c", "d", "e", "f", "s", "v", "x", "y", "z" }; graph.AddVertices (verticesSet); // // Add edges // Connected Component #1 // the vertex "e" won't be connected to any other vertex // Connected Component #2 graph.AddEdge("a", "s"); graph.AddEdge("a", "d"); graph.AddEdge("s", "x"); graph.AddEdge("s", "a"); graph.AddEdge("x", "d"); // Connected Component #3 graph.AddEdge("b", "c"); graph.AddEdge("b", "v"); graph.AddEdge("c", "f"); graph.AddEdge("c", "v"); graph.AddEdge("f", "b"); // Connected Component #4 graph.AddEdge("y", "z"); }
// // Second Case Initialization private static void _initializeFirstCaseGraph(ref IGraph<string> graph) { // Clear the graph graph.Clear(); // // Add vertices var verticesSet = new string[] { "a", "b", "c" }; graph.AddVertices (verticesSet); // // Add Edges graph.AddEdge("a", "b"); graph.AddEdge("b", "c"); graph.AddEdge("c", "a"); }