Added the shortest path code

I deleted the input method code because it is also in this file.