/// <summary> /// Test a particular enum (file) /// </summary> /// <param name="degreeSequenceEnum">enum (file)</param> /// <returns>report</returns> public StringBuilder Test(DegreeSequenceEnum degreeSequenceEnum) { stringBuilder.Clear(); Testing(degreeSequenceEnum); return(stringBuilder); }
private void Testing(DegreeSequenceEnum degreeSequenceEnum) { try { testPath = ReaderWriter.ReaderWriter.CreateTestFile(testsDictionary[degreeSequenceEnum]); reader = new ReaderWriter.ReaderGraph(testPath, false); graph = reader.ReadFile(); stringBuilder.AppendLine(degreeSequenceEnum.ToString()); stringBuilder.AppendLine("Graph created."); stringBuilder.AppendLine(graph.ToString()); // Sorted List <int> degreeSequenceList = graph.GetGraphProperty().GetDegreeSequenceInt(true); stringBuilder.AppendLine("Degree sequence"); foreach (int degree in degreeSequenceList) { stringBuilder.Append(degree + " "); } stringBuilder.AppendLine(""); stringBuilder.AppendLine("Minimum vertex degree: " + graph.GetGraphProperty().GetMinimumVertexDegree()); stringBuilder.AppendLine("Maximum vertex degree: " + graph.GetGraphProperty().GetMaximumVertexDegree()); stringBuilder.AppendLine("Average vertex degree: " + graph.GetGraphProperty().GetAverageVertexDegree()); stringBuilder.AppendLine("Is graph regular: " + graph.GetGraphProperty().GetIsRegular()); graph.GetGraphProperty().Reset(); // Unsorted degreeSequenceList = graph.GetGraphProperty().GetDegreeSequenceInt(false); stringBuilder.AppendLine("Degree sequence"); foreach (int degree in degreeSequenceList) { stringBuilder.Append(degree + " "); } stringBuilder.AppendLine(""); stringBuilder.AppendLine("Minimum vertex degree: " + graph.GetGraphProperty().GetMinimumVertexDegree()); stringBuilder.AppendLine("Maximum vertex degree: " + graph.GetGraphProperty().GetMaximumVertexDegree()); stringBuilder.AppendLine("Average vertex degree: " + graph.GetGraphProperty().GetAverageVertexDegree()); stringBuilder.AppendLine("Is graph regular: " + graph.GetGraphProperty().GetIsRegular()); } catch (KeyNotFoundException) { throw new MyException.TestsException.TestsMissingTestException(degreeSequenceEnum.ToString()); } catch (MyException.ReaderWriterException.ReaderWriterException e) { stringBuilder.AppendLine(e.Message); } }