code: func (g *Graph) RemoveRedundantEdges() {
  	// Walk the nodes and outgoing edges in reverse order to prefer
  	// removing edges with the lowest weight.
  	for i := len(g.Nodes); i > 0; i-- {
  		n := g.Nodes[i-1]
  		in := n.In.Sort()
  		for j := len(in); j > 0; j-- {
  			e := in[j-1]
  			if !e.Residual {
  				// Do not remove edges heavier than a non-residual edge, to
  				// avoid potential confusion.
  				break
  			}
  			if isRedundantEdge(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.