New simple utility for recompressing graphs
@@ -48,7 +48,7 @@ public class ExtractProperties {
"Extract properties files from a knowledge base.",
new Parameter[] {
new FlaggedOption("min", JSAP.INTEGER_PARSER, "0", JSAP.NOT_REQUIRED, 'm', "min", "Consider only graphs with at least this number of internal nodes."),
- new FlaggedOption("n", JSAP.INTEGER_PARSER, Integer.toString(Integer.MAX_VALUE), JSAP.NOT_REQUIRED, 'n', "n", "Analyze just this number of graphs."),
+ new FlaggedOption("n", JSAP.LONG_PARSER, Long.toString(Long.MAX_VALUE), JSAP.NOT_REQUIRED, 'n', "n", "Analyze just this number of graphs."),
new UnflaggedOption("kb", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The directory of the RocksDB instance containing the knowledge base." ),
new UnflaggedOption("kbmeta", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The file containing the knowledge base metadata." ),
});
@@ -57,7 +57,7 @@ public class ExtractProperties {
if ( jsap.messagePrinted() ) return;
final int minNodes = jsapResult.getInt("min");
- final int n = jsapResult.getInt("n");
+ final long n = jsapResult.getLong("n");
final String kbDir = jsapResult.getString("kb");
if (!new File(kbDir).exists()) throw new IllegalArgumentException("No such directory: " + kbDir);
final String kbMetadataFilename = jsapResult.getString("kbmeta");
@@ -71,7 +71,9 @@ public class ExtractProperties {
pl.itemsName = "graphs";
pl.start("Enumerating graphs");
+ long i = 0;
for(final CallGraph callGraph: kb.callGraphs.values()) {
+ if (i++ >= n) break;
pl.update();
if (callGraph.nInternal < minNodes) continue;
final CallGraphData callGraphData = callGraph.callGraphData();
