/*
Reset the ranks of all nodes based on the current spanning tree.
The rank of the tree's root remains unchanged, while all other
nodes are set to the sum of minimum length constraints along
the path from the root.
function adjustRanks(graph, tree) {
  function dfs(p) {
    var children = tree.successors(p);
    children.forEach(function(c) {
      var minLen = minimumLength(graph, p, c);
      graph.node(c).rank = graph.node(p).rank + minLen;
      dfs(c);
    });
  }

  dfs(tree.graph().root);
}