Added return of trace of shortest path. Added some error checking. Added some test cases.