static void Boruvka() { Graph gr = new Graph("input.txt"); Graph T = gr.BuildSpanningTree(); T.PrintToFile("newnewoutput.txt"); }
public void Merger(Graph gr1, Graph gr2) { var NodeList1 = gr1.GetNodes(); var Nodelist2 = gr2.GetNodes(); foreach (var node in NodeList1) { object temp = null; foreach (var node2 in Nodelist2) { if (Equals(node.Key, node2.Key)) { temp = node2.Key; break; } } if (temp == null) { gr2.AddVertex(node.Key); Nodelist2 = gr2.GetNodes(); temp = node.Key; } foreach (var joint in node.Value) { bool allGood = false; foreach (var joint2 in Nodelist2[temp]) { if (Equals(joint.Key, joint2.Key)) { allGood = true; break; } } if (!allGood) { gr2.AddJoint(temp, joint.Key, joint.Value); Nodelist2 = gr2.GetNodes(); } } } gr2.PrintToFile("output2.txt"); }
static void DemonstrationWorkingWithClass() { Graph Graf = new Graph("input.txt"); object[] Names = { "Techologicheskiy", "Narvskaya" }; int[] Weights = { 120, 120 }; object[] NewStops = { "Sadovaya/Sennaya/Spasskaya" }; //Graf.AddEdgeWeight("Baltiyskaya", Names, Weights); //Graf.AddVertex("Baltiyskaya", "Baltiyskaya"); Graf.AddEdge("Teatralnaya", NewStops); // Graf.AddVertex("Frunzenskaya", Names[0]); Graf.DeleteVertex("Pushkinskaya/Zvenigorovskaya", "Vitebskiy_vokzal"); Graf.PrintToFile("output.txt"); }