public IEnumerator <object[]> GetEnumerator() { for (int i = LowerBound; i < UpperBound; ++i) { string testCase = i.ToString("D2", CultureInfo.InvariantCulture); using TextReader textReader = IndexedGraphs.GetTextReader(testCase); if (textReader == TextReader.Null) { continue; } var edges = IndexedEdgeListParser.ParseEdges(textReader).ToList(); int vertexCount = edges.Count == 0 ? 0 : edges.Select(e => Math.Max(e.Tail, e.Head)).Max() + 1; string description = $"{{{nameof(testCase)}: {testCase}}}"; GraphDefinitionParameter parameter = new(vertexCount, edges, description); yield return(new object[] { parameter }); } for (int i = 1; i < 7; ++i) { double power = 0.5 * i; int vertexCount = (int)Math.Ceiling(Math.Pow(10.0, power)); foreach (double densityPower in s_densityPowers) { List <Endpoints> edges = new(); GraphHelpers.GenerateEdges(vertexCount, densityPower, edges); string description = $"{{{nameof(vertexCount)}: {vertexCount.ToString(F)}, {nameof(densityPower)}: {densityPower.ToString(F)}}}"; GraphDefinitionParameter parameter = new(vertexCount, edges, description); yield return(new object[] { parameter }); } } }
public IEnumerator <object[]> GetEnumerator() { for (int i = LowerBound; i < UpperBound; ++i) { string testCase = i.ToString("D2", CultureInfo.InvariantCulture); TGraphBuilder builder = CreateGraphBuilder(0); using (TextReader textReader = IndexedGraphs.GetTextReader(testCase)) { if (textReader == TextReader.Null) { continue; } IEnumerable <Endpoints> edges = IndexedEdgeListParser.ParseEdges(textReader); foreach (Endpoints edge in edges) { builder.TryAdd(edge.Tail, edge.Head, out _); } } TGraph graph = builder.ToGraph(); string description = $"{{{nameof(testCase)}: {testCase}}}"; var graphParameter = GraphParameter.Create(graph, description); yield return(new object[] { graphParameter }); } { const int vertexCount = 1; const double densityPower = 1.0; TGraphBuilder builder = CreateGraphBuilder(1); GraphHelpers.PopulateIncidenceGraphBuilder <TGraph, TEdge, TEdges, TGraphBuilder>( builder, vertexCount, densityPower); TGraph graph = builder.ToGraph(); string description = $"{{{nameof(vertexCount)}: {vertexCount.ToString(F)}, {nameof(densityPower)}: {densityPower.ToString(F)}}}"; var graphParameter = GraphParameter.Create(graph, description); yield return(new object[] { graphParameter }); } for (int i = 1; i < 7; ++i) { double power = 0.5 * i; int vertexCount = (int)Math.Ceiling(Math.Pow(10.0, power)); foreach (double densityPower in GraphHelpers.DensityPowers) { TGraphBuilder builder = CreateGraphBuilder(1); GraphHelpers.PopulateIncidenceGraphBuilder <TGraph, TEdge, TEdges, TGraphBuilder>( builder, vertexCount, densityPower); TGraph graph = builder.ToGraph(); string description = $"{{{nameof(vertexCount)}: {vertexCount.ToString(F)}, {nameof(densityPower)}: {densityPower.ToString(F)}}}"; var graphParameter = GraphParameter.Create(graph, description); yield return(new object[] { graphParameter }); } } }