diff --git a/MODA.Impl/ModaAlgorithms.2.Modified.cs b/MODA.Impl/ModaAlgorithms.2.Modified.cs index 4de5acb..e57c0a4 100644 --- a/MODA.Impl/ModaAlgorithms.2.Modified.cs +++ b/MODA.Impl/ModaAlgorithms.2.Modified.cs @@ -28,7 +28,7 @@ private List Algorithm2_Modified(UndirectedGraph> var h_ = queryGraph.Vertices.First(); // var queryGraphVertices = queryGraph.Vertices.ToList(); var degSeq = inputGraph.GetDegreeSequence(); var tasks = new List(); - List[] chunks = new List[numberOfSamples < 20 ? 1 : numberOfSamples / 20]; + List[] chunks = new List[numberOfSamples < 20 ? 1 : Math.Min(numberOfSamples / 20, 25)]; for (int i = 0; i < chunks.Length; i++) { chunks[i] = new List(); @@ -284,6 +284,7 @@ private bool IsNeighbourIncompatible(UndirectedGraph> input // return false; // } //} + neighborsOfM = null; neighboursOfN = null; return false; @@ -325,15 +326,15 @@ private HashSet ChooseNeighboursOfRange(string[] used_range, UndirectedG try { local.Remove(local[j - counter]); - if (local.Count == 0) - { - break; - } counter++; } catch (Exception ex) { - throw new ArgumentOutOfRangeException(string.Format("ERROR in 'ChooseNeighboursOfRange' trying to remove from local:\n\t in Index (j - counter) = {0}; j = {1}; counter = {2}; local.Count = {3}.", (j - counter), j, counter, local.Count), ex); + //throw new ArgumentOutOfRangeException(string.Format("ERROR in 'ChooseNeighboursOfRange' trying to remove from local:\n\t in Index (j - counter) = {0}; j = {1}; counter = {2}; local.Count = {3}.", (j - counter), j, counter, local.Count), ex); + } + if (local.Count == 0) + { + break; } } } @@ -401,15 +402,15 @@ private string GetMostConstrainedNeighbour(string[] domain, UndirectedGraph> queryGraph, string //So, deg(g) >= deg(h). //2. Based on the degree of their neighbors - var gNeighbors = inputGraph.GetNeighbors(node_G); + var gNeighbors = inputGraph.GetNeighbors(node_G); var hNeighbors = queryGraph.GetNeighbors(node_H); for (int i = 0; i < hNeighbors.Count; i++) { diff --git a/MODA.Impl/ModaAlgorithms.3.cs b/MODA.Impl/ModaAlgorithms.3.cs index d823053..4cccad1 100644 --- a/MODA.Impl/ModaAlgorithms.3.cs +++ b/MODA.Impl/ModaAlgorithms.3.cs @@ -46,7 +46,7 @@ private List Algorithm3(UndirectedGraph> queryGrap var theMappings = new List(); var tasks = new List(); - List[] chunks = new List[mappings.Count < 40 ? 1 : mappings.Count / 40]; + List[] chunks = new List[mappings.Count < 40 ? 1 : Math.Min(mappings.Count / 40, 25)]; for (int i = 0; i < chunks.Length; i++) { chunks[i] = new List();