networkcommons.methods.run_shortest_paths

networkcommons.methods.run_shortest_paths(network, source_dict, target_dict, verbose=False)

Calculate the shortest paths between sources and targets.

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.

  • verbose (bool) – If True, print warnings when no path is found to a given target.

Returns:

The subnetwork containing the shortest paths. list: A list containing the shortest paths.

Return type:

nx.Graph