degree function

Calculates the degree of a list of nodes