Added method for retreiving the previous array in the Dijkstra