docs: function(graph, opt) {
  
          opt = opt || {};
  
          var glGraphType = _.pick(opt, 'directed', 'compound', 'multigraph');
          var glGraph = new graphlib.Graph(glGraphType);
          var setNodeLabel = opt.setNodeLabel || _.noop;
          var setEdgeLabel = opt.setEdgeLabel || _.noop;
          var setEdgeName = opt.setEdgeName || _.noop;
  
          graph.get('cells').each(function(cell) {
  
              if (cell.isLink()) {
  
                  var source = cell.get('source');
                  var target = cell.get('target');
  
                  // Links that end at a point are ignored.
                  if (!source.id || !target.id) return;
  
                  // Note that if we are creating a multigraph we can name the edges. If
                  // we try to name edges on a non-multigraph an exception is thrown.
                  glGraph.setEdge(source.id, target.id, setEdgeLabel(cell), setEdgeName(cell));
  
              } else {
  
                  glGraph.setNode(cell.id, setNodeLabel(cell));
  
                  // For the compound graphs we have to take embeds into account.
                  if (glGraph.isCompound() && cell.has('parent')) {
                      glGraph.setParent(cell.id, cell.get('parent'));
                  }
              }
          });
  
          return glGraph;
      }