diff options
Diffstat (limited to 'src/CS340.Plotter/Program.cs')
-rw-r--r-- | src/CS340.Plotter/Program.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/CS340.Plotter/Program.cs b/src/CS340.Plotter/Program.cs index 0205767..497ac32 100644 --- a/src/CS340.Plotter/Program.cs +++ b/src/CS340.Plotter/Program.cs @@ -1,11 +1,17 @@ +using Graph; +using Graph.IO; using System; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using TSP; namespace Plotter { + using Map = Graph<Vertex<Edge<double>, double>, Edge<double>, double>; static class Program { /// <summary> @@ -17,7 +23,33 @@ namespace Plotter Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + Run(); Application.Run(new Plot()); } + + static void Run() + { + foreach (string file in Directory.GetFiles("graphs/")) + { + Map graph = GraphFile.Read(new FileReader(file)); + // Graph mst = graph.MST(0); + // GraphFile.Print(mst, new ConsoleWriter()); + // Console.WriteLine( + // graph.Vertices.Sum(vertex => + // vertex.Edges.FirstOrDefault(edge => edge.V == vertex.Parent).Weight)); + + Tour bruteForce = TSP.TSP.BruteForce(graph, 0); + Debug.WriteLine(bruteForce); + // mst.Vertices.ForEach(vertex => + // { + // Console.Write($"{vertex.Id}"); + // vertex.Edges.ForEach(edge => Console.Write($" {edge.V} {edge.Weight.ToString("F1")}")); + // Console.WriteLine(); + // }); + // Console.WriteLine(mst.Vertices + // .Sum(vertex => vertex.Edges + // .FirstOrDefault(edge => edge.V == vertex.Parent).Weight)); + } + } } } |