Add Degree method for undirected graph