code: function calcCutValue(t, g, child) {
    var childLab = t.node(child);
    var parent = childLab.parent;
    // True if the child is on the tail end of the edge in the directed graph
    var childIsTail = true;
    // The graph's view of the tree edge we're inspecting
    var graphEdge = g.edge(child, parent);
    // The accumulated cut value for the edge between this node and its parent
    var cutValue = 0;
  
    if (!graphEdge) {
      childIsTail = false;
      graphEdge = g.edge(parent, child);
    }
  
    cutValue = graphEdge.weight;
  
    _.forEach(g.nodeEdges(child), function(e) {
      var isOutEdge = e.v === child,
        other = isOutEdge ? e.w : e.v;
  
      if (other !== parent) {
        var pointsToHead = isOutEdge === childIsTail,
          otherWeight = g.edge(e).weight;
  
        cutValue += pointsToHead ? otherWeight : -otherWeight;
        if (isTreeEdge(t, child, other)) {
          var otherCutValue = t.edge(child, other).cutvalue;
          cutValue += pointsToHead ? -otherCutValue : otherCutValue;
        }
      }
    });
  
    return cutValue;
  }
docs: /*
  Given the tight tree, its graph, and a child in the graph calculate and
  return the cut value for the edge between the child and its parent.