finding shortest path from the source

finding shortest path from the source