Source: https://sedgewick.io/wp-content/uploads/2022/04/Algs15-ShortestPaths.pdf