code: function buildLayerMatrix(g) {
    var layering = _.map(_.range(maxRank(g) + 1), function() { return []; });
    _.forEach(g.nodes(), function(v) {
      var node = g.node(v);
      var rank = node.rank;
      if (!_.isUndefined(rank)) {
        layering[rank][node.order] = v;
      }
    });
    return layering;
  }
docs: /*
  Given a DAG with each node assigned "rank" and "order" properties, this
  function will produce a matrix with the ids of each node.