fix shortest_path, need new init interface

Please don't merge this pull request until the new interface is done.