I don't understand this. There is one graph, and one only. Each graph has N nodes. And each node has at least one edge.

So what is a vertex in this context?

Also, initializing the distance to the minimum seems dubious. If anything, it should be initialized to the maximum.