sklearn.utils.graph_shortest_path.graph_shortest_path()
Perform a shortestpath graph search on a positive directed or undirected graph.
Parameters: 


Returns: 

As currently implemented, Dijkstra’s algorithm does not work for graphs with directiondependent distances when directed == False. i.e., if dist_matrix[i,j] and dist_matrix[j,i] are not equal and both are nonzero, method=’D’ will not necessarily yield the correct result.
Also, these routines have not been tested for graphs with negative distances. Negative distances can lead to infinite cycles that must be handled by specialized algorithms.
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.utils.graph_shortest_path.graph_shortest_path.html