index.js
function serialize(){
    var serialized = {
      nodes: nodes().map(function (id){
        return { id: id };
      }),
      links: []
    };

    serialized.nodes.forEach(function (node){
      var source = node.id;
      adjacent(source).forEach(function (target){
        serialized.links.push({
          source: source,
          target: target,
          weight: getEdgeWeight(source, target)
        });
      });
    });

    return serialized;
  }
function serialize(){
    var serialized = {
      nodes: nodes().map(function (id){
        return { id: id };
      }),
      links: []
    };

    serialized.nodes.forEach(function (node){
      var source = node.id;
      adjacent(source).forEach(function (target){
        serialized.links.push({
          source: source,
          target: target,
          weight: getEdgeWeight(source, target)
        });
      });
    });

    return serialized;
  }
function serialize ( ) { var serialized = { nodes : nodes ( ) . map ( function ( id ) { return { id : id } ; } ) , links : [ ] } ; serialized . nodes . forEach ( function ( node ) { var source = node . id ; adjacent ( source ) . forEach ( function ( target ) { serialized . links . push ( { source : source , target : target , weight : getEdgeWeight ( source , target ) } ) ; } ) ; } ) ; return serialized ; }
Serializes the graph.
Serializes the graph .