JSONStringer stringer = (JSONStringer)(new JSONStringer().object());
int offset = 1;
for (Integer partition : sorted) {
stringer.key(Integer.toString(partition)).value(offset++);
} // FOR
out.write((stringer.endObject().toString() + "\n").getBytes());
// Now roll through each id and create a single JSONObject on each line
for (Integer partition : sorted) {
MarkovGraphsContainer markov = markovs.get(partition);
assert(markov != null) : "Null MarkovGraphsContainer for partition #" + partition;