add shortest path, some bugs are handled(not final version)