private void Ex3() { Console.WriteLine("Exercise 3"); const int measures = 20; Graphics.Graph ex3Plot = new Graphics.Graph("Returning arcs", "Number of elements", "Number of returning arcs"); for (int j = 0; j < 2; j++) { float d = j == 0 ? 0.2f : 0.4f; Console.WriteLine("Density: " + d); Graph g = new NextListGraph(); Graphics.Graph.Data ex3Data = new Graphics.Graph.Data("Density " + d); for (int i = 0; i < measures; i++) { int n = (i + 1) * 200; bool[,] data = GenerateGraph(n, d); g.Initialize(data); g.VSort(); int arcCount = g.GetReturnArcs().Count; ex3Data.AddPoint(n, (float)(arcCount)); Console.WriteLine("Completed " + (i + 1) + "/" + measures); } ex3Plot.AddData(ex3Data); } ex3Plot.StartWithNewThread(); ex3Plot.WriteToFile(outputPath); }
private void Ex2() { Console.WriteLine("Exercise 2"); const int measures = 20; Graphics.Graph ex2Plot = new Graphics.Graph("Sorting Time", "Number of elements", "Time"); for (int j = 0; j < 2; j++) { float d = j == 0 ? 0.2f : 0.4f; Console.WriteLine("Density: " + d); Graphics.Graph.Data ex2Data = new Graphics.Graph.Data("Density " + d); for (int i = 0; i < measures; i++) { int n = (i + 1) * 200; bool[,] data = GenerateGraph(n, d); Graph g = new NextListGraph(data); double time = Profile(g.VSort); ex2Data.AddPoint(n, (float)(time)); Console.WriteLine("Completed " + (i + 1) + "/" + measures); } ex2Plot.AddData(ex2Data); } ex2Plot.StartWithNewThread(); ex2Plot.WriteToFile(outputPath); }