code: function objToGraph(obj, containerName) {
      if (!containerName) containerName = 'definitions';
      let graph = [];
  
      for (let p in obj[containerName]) {
          let entry = {};
          entry._id = '#/'+containerName+'/'+p;
          entry.links = [];
          graph.push(entry);
      }
  
      recurse(obj,{identityDetection:true},function(obj,key,state){
          if (isRef(obj,key)) {
              let ptr = obj[key].replace('/$ref','');
              let spath = state.path.replace('/$ref','');
              let target = graph.find(function(e){
                  return e._id === ptr;
              });
              if (target) {
                  target.links.push(ptr);
              }
              else {
                  target = {};
                  target._id = ptr;
                  target.links = [];
                  target.links.push(ptr);
                  graph.push(target);
              }
              let source = graph.find(function(e){
                  return e._id === spath;
              });
              if (source) {
                  //source.links.push(spath);
              }
              else {
                  source = {};
                  source._id = spath
                  source.links = [];
                  graph.push(source);
              }
          }
      });
  
      return graph;
  }
docs: Takes an object and creates a graph of JSON Pointer / References
  @param obj the object to convert
  @param containerName the property containing definitions. Default: definitions
  @return the graph suitable for passing to toposort()