1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Network Analysis in Python

Exercise

ArcPlot

Next up, let's use the ArcPlot to visualize the network. You're going to practice sorting the nodes in the graph as well.

Note: this exercise may take about 4-7 seconds to execute if done correctly.

Instructions

100 XP
  • Make an ArcPlot of the GitHub collaboration network, with authors sorted by degree. To do this:
    • Iterate over all the nodes in G, including the metadata (by specifying data=True).
    • In each iteration of the loop, calculate the degree of each node n with nx.degree() and set its 'degree' attribute. nx.degree() accepts two arguments: A graph and a node.
    • Create the ArcPlot object a by specifying two parameters: the graph, which is G, and the node_order, which is 'degree', so that the nodes are sorted.
    • Draw the ArcPlot object to the screen.