We do not save anymore the GID2LID map
@@ -519,9 +519,8 @@ public class KnowledgeBase implements Serializable, Closeable {
kryo.writeObject(bbo, graphProperties);
kryo.writeObject(bbo, transposeProperties);
- // Write out maps
+ // Write out LID2GID info
kryo.writeObject(bbo, LID2GID);
- kryo.writeObject(bbo, GID2LID);
bbo.flush();
@@ -552,7 +551,13 @@ public class KnowledgeBase implements Serializable, Closeable {
final var graphs = new ImmutableGraph[] { kryo.readObject(input, BVGraph.class), kryo.readObject(input, BVGraph.class) };
final Properties[] properties = new Properties[] { kryo.readObject(input, Properties.class), kryo.readObject(input, Properties.class) };
final long[] LID2GID = kryo.readObject(input, long[].class);
- final Long2IntOpenHashMap GID2LID = kryo.readObject(input, Long2IntOpenHashMap.class);
+
+ // Rebuild GID2LID from LID2GID
+ final int n = LID2GID.length;
+ final Long2IntOpenHashMap GID2LID = new Long2IntOpenHashMap(n);
+ GID2LID.defaultReturnValue(-1);
+ for (int i = 0; i < n; i++) GID2LID.put(LID2GID[i], i);
+
final CallGraphData callGraphData = new CallGraphData(graphs[0], graphs[1], properties[0], properties[1], LID2GID, GID2LID, nInternal, buffer.length);
this.callGraphData = new SoftReference<>(callGraphData);
return callGraphData;
@@ -631,7 +636,6 @@ public class KnowledgeBase implements Serializable, Closeable {
kryo.register(MutableString.class, new FieldSerializer<>(kryo, MutableString.class));
kryo.register(Properties.class);
kryo.register(long[].class);
- kryo.register(Long2IntOpenHashMap.class);
}
/**
