created graph for dijkstra