CalcuDgree algorithm implementation: for each edge (u, v) in graph // calculate du degree degree(v) += 1