public static void GetSalesman() { var graph = Initializing.CreateGraph(@"./_Third.txt"); var matrix = Initializing.CreateMatrix(@"./_Third.txt"); BnB_matrix brunchAndBound = new BnB_matrix(); var edges = brunchAndBound.BranchAndBound(matrix); System.Console.WriteLine("\n"); ConsolePrint.HeaderPrint("Salesman problem"); ConsolePrint.PrintGraph(graph); ConsolePrint.PrintPath(edges); }
public static void GetChinesePostman() { var graph = Initializing.CreateGraph(@"./_Second.txt"); Graph newGraph = new Graph(); if (!ChinesePostman.IsEvenDegree(graph.Nodes)) { var oddNodes = OddFinder.FindOddNodes(graph.Nodes); newGraph = ChinesePostman.PairingOddVertices(graph, oddNodes); } var eulerianPath = ChinesePostman.FindEulerianPath(newGraph); System.Console.WriteLine("\n"); ConsolePrint.HeaderPrint("Chinese postman problem"); ConsolePrint.PrintGraph(graph); ConsolePrint.ShowAdditionalEdges(graph, newGraph); // ConsolePrint.PrintNodes(graph.Nodes, newGraph.Nodes); ConsolePrint.PrintPath(eulerianPath.ToArray()); }