pymatgen.analysis.diffusion.neb.periodic_dijkstra module¶
Dijkstra’s path search on a graph where the nodes are on a periodic graph.
- get_optimal_pathway_rev(path_parent: dict, leaf_node: tuple)[source]¶
Follow a leaf node all the way up to source.
- periodic_dijkstra(G: Graph, sources: set, weight: str = 'weight', max_image: int = 2, target_reached: Callable = <function <lambda>>)[source]¶
Find the lowest cost pathway from a source point in the periodic graph. Since the search can move many cells away without finding the target we have to limit how many cells away from (0,0,0) to search.
- Parameters:
G (Graph) – The graph object with additional “to_jimage” fields to indicate edges across periodic images.
sources (set) – the index of the source node
weight – the weight of the edges.
max_image (int, optional) – Defaults to 3.
target_reached (callable, optional) – A function of (site_index, jimage) used to check for stop iteration. This function is always called on the top of heap so it might miss the optimal path but often can find a “good enough” path very quickly.
- Returns:
a dictionary of the best cost found to periodic node keyed by (site_index, jimage) path_parent: dictionary of optimal path parent for each node given in index-image pairs.
- Return type:
best_ans
- periodic_dijkstra_on_sgraph(sgraph: StructureGraph, sources: set, weight: str = 'weight', max_image: int = 1, target_reached: Callable = <function <lambda>>)[source]¶
Find the lowest cost pathway from a source point in the periodic graph. Since the search can move many cells away without finding the target we have to limit how many cells away from (0,0,0) to search.
- Parameters:
sgraph (Graph) – The StructureGraph object used for path searching
sources (set) – the index of the source node
weight – the weight of the edges.
max_image (int, optional) – Defaults to 3.
target_reached (callable, optional) – A function of (site_index, jimage) used to check for stop iteration. This function is always called on the top of heap so it might miss the optimal path but often can find a “good enough” path very quickly.
- Returns:
a dictionary of the best cost found to periodic node keyed by (site_index, jimage) path_parent: dictionary of optimal path parent for each node given in index-image pairs.
- Return type:
best_ans