anchor.diff:  ----
   final Graph graph = TinkerFactory.createModern();
   try (final OutputStream os = new FileOutputStream("tinkerpop-modern.xml")) {
  -    graph.io().graphMLWriter().normalize(true).create().writeGraph(os);
  +    graph.io().graphMLWriter().normalize(true).create().writeGraph(os, graph);
   }
   
   final Graph newGraph = TinkerGraph.open();
   try (final InputStream stream = new FileInputStream("tinkerpop-modern.xml")) {
  -    newGraph.io().graphMLReader().vertexIdKey("name").create().readGraph(stream);
  +    newGraph.io().graphMLReader().vertexIdKey("name").create().readGraph(stream, newGraph);
   }
   ----
   
  
positive.code: final Graph graph = TinkerFactory.createModern();
  try (final OutputStream os = new FileOutputStream("tinkerpop-modern.json")) {
      final GraphSONMapper mapper = graph.io().graphSONMapper().normalize(true).create()
      graph.io().graphSONWriter().mapper(mapper).create().writeGraph(os, g)
  }
  
  final Graph newGraph = TinkerGraph.open();
  try (final InputStream stream = new FileInputStream("tinkerpop-modern.json")) {
      newGraph.io().graphSONReader().vertexIdKey("name").create().readGraph(stream);
  }
  ----
  
  One of the important configuration options of the `GraphSONReader` and `GraphSONWriter` is the ability to embed type information into the output.  By embedding the types, it becomes possible to serialize a graph without losing type information that might be important when being consumed by another source.  The importance of this concept is demonstrated in the following example where a single `Vertex` is written to GraphSON using the Gremlin Console:
  
  [source,groovy]
  ----
  gremlin> graph = TinkerFactory.createModern()
  ==>tinkergraph[vertices:6 edges:6]
  gremlin> f = new FileOutputStream("vertex-1.json")
  ==>java.io.FileOutputStream@3bbf9027
  gremlin> graph.io().graphSONWriter().create().writeVertex(f, g.V(1).next(), BOTH)
  ==>null
  gremlin> f.close()
  ==>null
  ----
  
  The following GraphSON example shows the output of `GraphSonWriter.writeVertex()` with associated edges:
  
negative.code: 
  With a minor change to the construction of the `GraphSONWriter` the lossy nature of GraphSON can be avoided:
  
  [gremlin-groovy]
  ----
  graph = TinkerFactory.createModern()
  g = graph.traversal()
  f = new FileOutputStream("vertex-1.json")
  mapper = graph.io().graphSONMapper().embedTypes(true).create()
  graph.io().graphSONWriter().mapper(mapper).create().writeVertex(f, g.V(1).next(), BOTH)
  f.close()
  ----
  
  In the above code, the `embedTypes` option is set to `true` and the output below shows the difference in the output:
  