Implementation of a graph that also implements Dijkstra algorithm