Implemented shortest path algorithm in Graphs class