agatha.topic_query.path_util module

agatha.topic_query.path_util.clear_node_attribute(graph, attribute, reinitialize=None)

Replaces the attribute with the reinitialize, or removes the attribute entirely if None specified

Return type

None

agatha.topic_query.path_util.get_element_with_min_criteria(data, criteria)
Return type

Any

agatha.topic_query.path_util.get_nearby_nodes(graph_index, source, max_result_size, max_degree, key_type=None, cached_graph=None, disable_pbar=False)

Returns a collection of entity names corresponding to the nearest neighbors of source. This will extend to multi-hop neighbors. @param db_client: Connection to Redis server. @param source: Source node, must be of graph type. @param max_result_size: only return the closest X neighbors. @param key_type: If supplied, only return nodes of the given type. @return list of graph keys, closest to furthest

Return type

List[str]

agatha.topic_query.path_util.get_shortest_path(graph_index, source, target, max_degree, disable_pbar=False)

Gets the exact shortest path between two nodes in the network. This method runs a bidirectional search with an amortized download. At a high level, we are storing each node’s distance to both the source and target at the same time. Each visit of a node leads us to identify any neighbors with shorter source / target distances. We know we’re done when we uncover a node with a tightened path to both source and target.

Return type

Tuple[Optional[List[str]], Graph]

agatha.topic_query.path_util.recover_shortest_path_from_tight_edges(graph, bridge_node)
Return type

List[str]