private static void CalcClusterings(string filePath) { var stopWatch = new Stopwatch(); stopWatch.Start(); var lines = File.ReadAllLines(filePath); int verticesCount = int.Parse(lines[0].Split(' ').First()); var vertices = new Dictionary<string, Vertex>(verticesCount); foreach (var line in lines.Skip(1)) { AddDictionaryEdge(vertices, line); } var maxSpaceClustering = new MaxSpaceClustering(); var result = maxSpaceClustering.CalcClusterings(vertices); stopWatch.Stop(); Console.WriteLine("the largest value of k such that there is a k-clustering with spacing at least 3: {0}, elapsed: {1} ms", result, stopWatch.ElapsedMilliseconds); }
public void Assignment2_Case1() { var vertices = new Dictionary<string, Vertex>(10); AddDictionaryEdge(vertices, "0 1 1 0 0 1 1 1"); AddDictionaryEdge(vertices, "1 1 0 0 1 0 1 1"); AddDictionaryEdge(vertices, "1 0 1 1 1 0 0 1"); AddDictionaryEdge(vertices, "1 1 1 1 0 0 1 0"); AddDictionaryEdge(vertices, "0 0 1 1 0 0 1 1"); AddDictionaryEdge(vertices, "0 0 0 1 1 0 1 1"); AddDictionaryEdge(vertices, "1 1 0 0 1 1 1 1"); AddDictionaryEdge(vertices, "1 0 1 1 1 1 1 0"); AddDictionaryEdge(vertices, "1 0 0 0 0 1 1 0"); AddDictionaryEdge(vertices, "0 1 0 0 0 0 1 1"); var maxSpaceClustering = new MaxSpaceClustering(); Assert.AreEqual(6, maxSpaceClustering.CalcClusterings(vertices)); }