예제 #1
0
        private DegeneracyResult AnalyzeDegeneracy(string file)
        {
            var graph = new UndirectedGraph <int, Edge <int> >();

            this.rowByRow(file, row =>
            {
                var split = row.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                int v;
                int u;

                if (split.Length != 2 || !int.TryParse(split[0], out v) || !int.TryParse(split[1], out u))
                {
                    return;
                }

                graph.AddVerticesAndEdge(new Edge <int>(u, v));
            });

            return(graph.CoreDecomposition());
        }