You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: distance.go
    path of file: ./repos/gonum/graph/network
    
    the code of the file until where you have to start completion: // Copyright ©2015 The Gonum Authors. All rights reserved.
// Use of 
    
func Residual(g graph.Graph, p path.AllShortest) map[int64]float64 {
	nodes := graph.NodesOf(g.Nodes())
	r := make(map[int64]float64, len(nodes))
	for i, u := range nodes {
		uid := u.ID()
		var sum float64
		for j, v := range nodes {
			vid := v.ID()
			// The ordering here is not relevant for
			// undirected graphs, but we make sure we
			// are counting incoming paths.
			d := p.Weight(vid, uid)
			if math.IsInf(d, 0) {
				continue
			}
			if i != j {
				sum += math.Exp2(-d)
			}
		}
		r[u.ID()] = sum
	}
	return r
}