Exemple #1
0
        /// <summary>
        /// Read a file with a graph and construct it
        /// </summary>
        private void Testing()
        {
            try
            {
                stringBuilder.AppendLine("Reading file: " + reader.GetPath());

                graph = reader.ReadFile();

                stringBuilder.AppendLine("Graph created.");
                stringBuilder.AppendLine(graph.ToString());
            }
            catch (Exception e)
            {
                stringBuilder.AppendLine(e.Message);
            }
        }
Exemple #2
0
        private void Testing(ConverterGraphToDotEnum converterGraphToDotEnum)
        {
            try
            {
                // Variable
                ConvertGraphToDot convertGraphToDot;

                testPath = ReaderWriter.ReaderWriter.CreateTestFile(testsDictionary[converterGraphToDotEnum]);

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

                List <Graph.IGraphInterface> graphList = graph.GetGraphProperty().GetComponents();

                stringBuilder.AppendLine(converterGraphToDotEnum.ToString());
                stringBuilder.AppendLine(graph.ToString());

                stringBuilder.AppendLine("Standard graph");
                convertGraphToDot = new ConvertGraphToDot(graphList, false, true, true, true, true);
                stringBuilder.AppendLine(convertGraphToDot.Convert());

                stringBuilder.AppendLine("Uncolored schedule");
                convertGraphToDot = new ConvertGraphToDot(graphList, true, true, true, true, true);
                stringBuilder.AppendLine(convertGraphToDot.Convert());

                GraphColoringAlgorithm.SequenceAlgorithm.LargestFirstSequence.LargestFirstSequence largestFirstSequence;
                foreach (Graph.IGraphInterface graph in graphList)
                {
                    largestFirstSequence = new GraphColoringAlgorithm.SequenceAlgorithm.LargestFirstSequence.LargestFirstSequence(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithInterchangeEnum.none);
                    largestFirstSequence.Color();
                }

                stringBuilder.AppendLine("Colored schedule");
                convertGraphToDot = new ConvertGraphToDot(graphList, true, true, true, true, true);
                stringBuilder.AppendLine(convertGraphToDot.Convert());
            }
            catch (KeyNotFoundException)
            {
                throw new MyException.TestsException.TestsMissingTestException(converterGraphToDotEnum.ToString());
            }
            catch (MyException.ReaderWriterException.ReaderWriterException e)
            {
                stringBuilder.AppendLine(e.Message);
            }
        }