diff --git a/src/main/java/nl/peterbloem/motive/MotifModel.java b/src/main/java/nl/peterbloem/motive/MotifModel.java index e989067..8b13e6b 100644 --- a/src/main/java/nl/peterbloem/motive/MotifModel.java +++ b/src/main/java/nl/peterbloem/motive/MotifModel.java @@ -847,7 +847,7 @@ public static double sizeEL(DGraph graph, List degrees, DGraph sub, Global.log().info("Number of links rewritten too high (with "+occurrences.size()+" instances). Returning Double.POSTIVE_INFINITY."); return Double.POSITIVE_INFINITY; } - + // * store the template graph (as a simple graph) bits.add("subbed", EdgeListModel.directed(sDegrees, Prior.COMPLETE)); @@ -1346,7 +1346,7 @@ public static List subbedDegrees( subbedDegrees.set(occurrence.get(0), new D(0, 0)); // * convert the rewritten links to new indices, and build a - // frequencymodel + // frequencymodel int size = 0; for(Pair link : rewLinks) { diff --git a/src/main/java/nl/peterbloem/motive/exec/CompareLarge.java b/src/main/java/nl/peterbloem/motive/exec/CompareLarge.java index a8ec476..5b3748a 100644 --- a/src/main/java/nl/peterbloem/motive/exec/CompareLarge.java +++ b/src/main/java/nl/peterbloem/motive/exec/CompareLarge.java @@ -144,10 +144,13 @@ public void main() throws IOException MotifModel.setMaxRW(maxRW); + Global.log().info("Graph size: " + data.size() + " nodes."); + Global.log().info("Graph size: " + data.numLinks() + " links."); + Global.log().info("Computing motif code lengths"); final List degrees = graphLoop ? null : DSequenceEstimator.sequence(data); - + // * Sample for motifs, and collect the results DPlainMotifExtractor ex = new DPlainMotifExtractor( diff --git a/src/test/java/nl/peterbloem/motive/MotifModelTest.java b/src/test/java/nl/peterbloem/motive/MotifModelTest.java index 6d5b7b9..41e9014 100644 --- a/src/test/java/nl/peterbloem/motive/MotifModelTest.java +++ b/src/test/java/nl/peterbloem/motive/MotifModelTest.java @@ -25,6 +25,7 @@ import org.junit.Test; import org.nodes.DGraph; +import org.nodes.DiskDGraph; import org.nodes.Graph; import org.nodes.Graphs; import org.nodes.Link; @@ -46,6 +47,7 @@ import org.nodes.util.bootstrap.LogNormalCI; import nl.peterbloem.kit.BitString; +import nl.peterbloem.kit.FileIO; import nl.peterbloem.kit.FrequencyModel; import nl.peterbloem.kit.Functions; import nl.peterbloem.kit.Global; @@ -835,4 +837,43 @@ public void instanceLoopTestInfinities() } } + @Test + public void diskBasedStressTest() + { + int n = 100; + + for(int i : series(n)) + { + go(new Random().nextInt(10000)); + Functions.dot(i, n); + } + } + + public void go(long seed) + { + Global.setSeed(seed); + DGraph graph = RandomGraphs.randomDirectedFast(1000, 500000); + graph = DiskDGraph.copy(graph, new File("./tmp/")); + + DPlainMotifExtractor ex = new DPlainMotifExtractor<>(graph, 100, 4, 3); + List degrees = DSequenceEstimator.sequence(graph); + + for(DGraph sub : ex.subgraphs()) + { + List> occ = ex.occurrences(sub); + + try + { + MotifSearchModel.sizeELInst(graph, degrees, sub, occ, true, -1); + } catch(RuntimeException e) + { + Global.log().info("seed " + Global.randomSeed()); + throw e; + } + } + + FileIO.rDelete(new File("./tmp")); + + } + }