networkcommons.methods.run_sign_consistency
- networkcommons.methods.run_sign_consistency(network, paths, source_dict, target_dict=None)
Calculate the sign consistency between sources and targets. If the target sign is not provided, infer the sign by majority consensus from the paths.
- Parameters:
network (nx.Graph) – The network.
paths (list) – A list containing the shortest paths.
source_dict (dict) – A dictionary containing the sources and sign of perturbation.
target_dict (dict, optional) – A dictionary containing the targets and sign of measurements. If None, infer the target signs by consensus.
- Returns:
The subnetwork containing the sign consistent paths. list: A list containing the sign consistent paths. dict: A dictionary containing the inferred target signs (if target_dict is None).
- Return type:
nx.Graph