Exercise

Deep dive - Twitter network part II

Next, you're going to do an analogous deep dive on betweenness centrality! Just a few hints to help you along: remember that betweenness centrality is computed using nx.betweenness_centrality(G).

Instructions

100 XP
  • Write a function find_node_with_highest_bet_cent(G) that returns the node(s) with the highest betweenness centrality.
    • Compute the betweenness centrality of G.
    • Compute the maximum betweenness centrality using the max() function on list(bet_cent.values()).
    • Iterate over the degree centrality dictionary, bet_cent.items().
    • If the degree centrality value v of the current node k is equal to max_bc, add it to the set of nodes.
  • Use your function to find the node(s) that has the highest betweenness centrality in T.
  • Write an assertion statement that you've got the right node. This has been done for you, so hit 'Submit Answer' to see the result!