third_party/d3/sankey.js
function computeNodeLinks() {
    nodes.forEach(function(node) {
      node.sourceLinks = [];
      node.targetLinks = [];
    });
    links.forEach(function(link) {
      var source = link.source,
          target = link.target;
      if (typeof source === "number") source = link.source = nodes[link.source];
      if (typeof target === "number") target = link.target = nodes[link.target];
      source.sourceLinks.push(link);
      target.targetLinks.push(link);
    });
  }
function computeNodeLinks() {
    nodes.forEach(function(node) {
      node.sourceLinks = [];
      node.targetLinks = [];
    });
    links.forEach(function(link) {
      var source = link.source,
          target = link.target;
      if (typeof source === "number") source = link.source = nodes[link.source];
      if (typeof target === "number") target = link.target = nodes[link.target];
      source.sourceLinks.push(link);
      target.targetLinks.push(link);
    });
  }
function computeNodeLinks ( ) { nodes . forEach ( function ( node ) { node . sourceLinks = [ ] ; node . targetLinks = [ ] ; } ) ; links . forEach ( function ( link ) { var source = link . source , target = link . target ; if ( typeof source === "number" ) source = link . source = nodes [ link . source ] ; if ( typeof target === "number" ) target = link . target = nodes [ link . target ] ; source . sourceLinks . push ( link ) ; target . targetLinks . push ( link ) ; } ) ; }
Populate the sourceLinks and targetLinks for each node. Also, if the source and target are not objects, assume they are indices.
Populate the sourceLinks and targetLinks for each node . Also if the source and target are not objects assume they are indices .