Source: https://courses.engr.illinois.edu/cs225/fa2017/lectures/handouts/cs225fa17-40-Dijkstra-handout.pdf