example java code for graph single source shortest paths problem, with application to bridge-and-flashlight puzzle