If I go through the list of edges one by one and push the two vertices of each edge into a Set, at the end wouldn’t I end up with the minimum number of vertices needed to cover the graph?
Most likely I’m not understanding the problem, would appreciate if someone could clarify.