In order to fully understand the algorithm, we'll look at an example implementation in Python.
If you are more familiar with Java, you can find an example implementation with Java using the Neo4j API for graph representation at https://github.com/stellasia/neoplus/blob/master/src/main/java/neoplus/ShortestPath.java.