degree function

Node degree calculation