Vertex in- and out- degree calculation