コード例 #1
0
ファイル: SubGraphTest.cs プロジェクト: Illner/GraphColoring
        private void Testing(SubGraphEnum subGraphEnum)
        {
            try
            {
                testPath      = ReaderWriter.ReaderWriter.CreateTestFile(testsDictionary[subGraphEnum].Item1);
                countVertices = testsDictionary[subGraphEnum].Item2;

                reader = new ReaderWriter.ReaderGraph(testPath, false);
                graph  = reader.ReadFile();

                stringBuilder.AppendLine(subGraphEnum.ToString());
                stringBuilder.AppendLine("Graph created.");
                stringBuilder.AppendLine(graph.ToString());

                IGraphInterface subGraph = GraphOperation.SubGraph(graph, graph.AllVertices().Take(countVertices).ToList());

                stringBuilder.AppendLine("Subgraph created.");
                stringBuilder.AppendLine(subGraph.ToString());
            }
            catch (KeyNotFoundException)
            {
                throw new MyException.TestsException.TestsMissingTestException(subGraphEnum.ToString());
            }
            catch (MyException.ReaderWriterException.ReaderWriterException e)
            {
                stringBuilder.AppendLine(e.Message);
            }
        }
コード例 #2
0
ファイル: SubGraphTest.cs プロジェクト: Illner/GraphColoring
        /// <summary>
        /// Test a particular enum (file)
        /// </summary>
        /// <param name="subGraphEnum">enum (file)</param>
        /// <returns>report</returns>
        public StringBuilder Test(SubGraphEnum subGraphEnum)
        {
            stringBuilder.Clear();

            Testing(subGraphEnum);

            return(stringBuilder);
        }