sentence: for c++ , in the library for c# , at for java , in the library for matlab , in the package for perl , in the module for python , in the networkx library for r , in package see also dijkstra 's algorithm , an algorithm for finding single-source shortest paths in a more restrictive class of inputs , graphs in which all edge weights are non-negative johnson 's algorithm , an algorithm for solving the same problem as the floyd -- warshall algorithm , all pairs shortest paths in graphs with some edge weights negative .