D function

Computes the degree operator from the vector of edge weights.