final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException {
ser(graphSONGraph, jsonGenerator);
}
private void ser(final GraphSONGraph graphSONGraph, final JsonGenerator jsonGenerator) throws IOException {
final Graph g = graphSONGraph.getGraphToSerialize();
jsonGenerator.writeStartObject();
if (g.features().graph().variables().supportsVariables())
jsonGenerator.writeObjectField(GraphSONTokens.VARIABLES, new HashMap<>(g.variables().asMap()));
jsonGenerator.writeArrayFieldStart(GraphSONTokens.VERTICES);
if (normalize)
g.V().order(Comparators.HELD_VERTEX_COMPARATOR).forEachRemaining(FunctionUtils.wrapConsumer(jsonGenerator::writeObject));
else
g.V().forEachRemaining(FunctionUtils.wrapConsumer(jsonGenerator::writeObject));
jsonGenerator.writeEndArray();
jsonGenerator.writeArrayFieldStart(GraphSONTokens.EDGES);
if (normalize)
g.E().order(Comparators.HELD_EDGE_COMPARATOR).forEachRemaining(FunctionUtils.wrapConsumer(jsonGenerator::writeObject));
else
g.E().forEachRemaining(FunctionUtils.wrapConsumer(jsonGenerator::writeObject));
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
}