Finding shortest path within a undirected graph