networkcommons.methods.add_pagerank_scores

networkcommons.methods.add_pagerank_scores(network, source_dict, target_dict, alpha=0.85, max_iter=100, tol=1e-06, nstart=None, weight='weight', personalize_for=None)

Add PageRank scores to the nodes of the network.

Parameters:
  • network (nx.Graph) – The network.

  • source_dict (dict) – A dictionary containing the sources and sign of perturbation.

  • target_dict (dict) – A dictionary containing the targets and sign of measurements.

  • percentage (int) – Percentage of nodes to keep.

  • alpha (float) – Damping factor for the PageRank algorithm.

  • max_iter (int) – Maximum number of iterations.

  • tol (float) – Tolerance to determine convergence.

  • nstart (dict) – Starting value of PageRank iteration for all nodes.

  • weight (str) – Edge data key to use as weight.

  • personalize_for (str) – Personalize the PageRank by setting initial probabilities for either sources or targets.

Returns:

Contains nodes above threshold from sources, nodes above

threshold from targets, and overlapping nodes.

Return type:

tuple