gaphical implementation of shortest path