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

Exercise

Extract the mean degree centrality day-by-day on the students partition

Here, you're going to see if the mean degree centrality over all nodes is correlated with the number of edges that are plotted over time. There might not necessarily be a strong correlation, and you'll take a look to see if that's the case.

Instructions

100 XP
  • Instantiate a new graph called G_sub containing a subset of edges.
  • Add nodes from G, including the node metadata.
  • Add in edges that fulfill the criteria, using the .add_edges_from() method.
  • Get the students projection G_student_sub from G_sub using the nx.bipartite.projected_graph() function.
  • Compute the degree centrality of the students projection using nx.degree_centrality() (don't use the bipartite version).
  • Append the mean degree centrality to the list mean_dcs. Be sure to convert dc.values() to a list first.
  • Hit 'Submit Answer' to view the plot!