Floyd and Dijkstr methods solve the shortest path