Get degree of each nodes in a graph by Networkx in python
You are using version 2.0 of networkx. Which changed from using a dict for G.degree() to using a dict-like (but not dict) DegreeView. See this guide. To have the degrees in a list you can use a list-comprehension: