ComenzarEmpieza gratis

Finding important collaborators

Almost there! You'll now look at important nodes once more. Here, you'll make use of the degree_centrality() and betweenness_centrality() functions in NetworkX to compute each of the respective centrality scores, and then use that information to find the "important nodes". In other words, your job in this exercise is to find the user(s) that have collaborated with the most number of users.

Este ejercicio forma parte del curso

Introduction to Network Analysis in Python

Ver curso

Instrucciones del ejercicio

  • Compute the degree centralities of G. Store the result as deg_cent.
  • Compute the maximum degree centrality. Since deg_cent is a dictionary, you'll have to use the .values() method to get a list of its values before computing the maximum degree centrality with max().
  • Identify the most prolific collaborators using a list comprehension:
    • Iterate over the degree centrality dictionary deg_cent that was computed earlier using its .items() method. What condition should be satisfied if you are seeking to find user(s) that have collaborated with the most number of users? Hint: It has do to with the maximum degree centrality.
  • Hit 'Submit Answer' to see who the most prolific collaborator(s) is/are!

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Compute the degree centralities of G: deg_cent
deg_cent = ____

# Compute the maximum degree centrality: max_dc
max_dc = ____

# Find the user(s) that have collaborated the most: prolific_collaborators
prolific_collaborators = [n for n, dc in ____ if ____ == ____]

# Print the most prolific collaborator(s)
print(prolific_collaborators)
Editar y ejecutar código