public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException {
final Output output = new Output(outputStream);
this.headerWriter.write(kryo, output);
final boolean supportsGraphMemory = g.features().graph().variables().supportsVariables();
output.writeBoolean(supportsGraphMemory);
if (supportsGraphMemory)
kryo.writeObject(output, new HashMap(g.variables().asMap()));
final Iterator<Vertex> vertices = g.V();
final boolean hasSomeVertices = vertices.hasNext();