private MinAvgMax RunFolderDynamicGraph(string folder, IDynamicGraph alg) { var values = new List<long>(); var sw = new Stopwatch(); foreach (var file in Directory.EnumerateFiles(folder)) { var graph = readFile(file); alg.ResetAll(graph.n, graph.m); for(int i = 0; i < graph.n; i++) alg.AddVertex(); sw.Reset(); //force gc GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); sw.Start(); foreach (var edge in graph.edges) { alg.AddEdge(edge.from, edge.to); } var top = alg.Topology(); sw.Stop(); values.Add(sw.ElapsedTicks); } return new MinAvgMax(values.Min(), (long)values.Average(), values.Max()); }