title: Sort graph nodes according to their degree
body: <p>I have a graph G in networkx and would like to sort the nodes according to their degree. However, the following code does not work in latest networkx versions:</p>
  
  <pre><code>sorted(set(G.degree().values()))
  </code></pre>
  
  <p>and the following seems a bit clunky as it requires converting the networkx DegreeView to a python list of tuples</p>
  
  <pre><code>degrees = [(node,val) for (node, val) in G.degree()]
  sorted(degrees, key=lambda x: x[1], reverse=True)
  </code></pre>
  
  <p>is there any better way?</p>