get_degree function

Compute the degree of each nodes in the network