Algorithm
Graph traversal methods.
- drug2ways.graph_traversal.compute_all_paths_multitarget(graph: DiGraph, source: Iterable[Any], targets, lmax: int, previous_history: Dict) Tuple[int, List[List[Union[float, int]]]] [source]
Compute all paths to all the targets, separately.
- Parameters
graph – graph
source – source nodes
targets – target nodes
lmax – lmax
previous_history – previous history of visited nodes
- Returns
- drug2ways.graph_traversal.compute_all_paths_multitarget_dict(graph: DiGraph, source, targets, lmax: int, previous_history: Dict, cycle_history: Dict, simple_paths: bool = False) Tuple[int, List[List[Union[float, int]]]] [source]
Compute all paths to all the targets, separately. Uses dict to store target path count instead of array.
- Parameters
graph – graph
source – source node
targets – target nodes
lmax – lmax
previous_history – history of visited nodes
cycle_history – history of cycles
simple_paths – simple paths mode
Alternative methods for path calculations in graphs (depricated and not used in the package).