Answers for "networkx - calculate degree per each node"

0

networkx - calculate degree per each node

# Degree
degrees = [val for (node, val) in G.degree()]

# Sorted degree
degrees = [val for (node, val) in sorted(G.degree(), key=lambda pair: pair[0])]
Posted by: Guest on February-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language