code: func removeRedundantEdges(ns nodes) {
  	// Walk the nodes and outgoing edges in reverse order to prefer
  	// removing edges with the lowest weight.
  	for i := len(ns); i > 0; i-- {
  		n := ns[i-1]
  		in := sortedEdges(n.in)
  		for j := len(in); j > 0; j-- {
  			if e := in[j-1]; e.residual && isRedundant(e) {
  				delete(e.src.out, e.dest)
  				delete(e.dest.in, e.src)
  			}
  		}
  	}
  }
docs: // removeRedundantEdges removes residual edges if the destination can
  // be reached through another path. This is done to simplify the graph
  // while preserving connectivity.