I have got an undirected weighted connected graph. If I select one vertex I automatically select all the vertices connected directly with it. What will be the algorithm so that I am able to select all the vertices of the graph using minimum number of tries? In each try I select one vertex. For example for adjacency matrix a[][]={1,1,0,0,0, 1,1,1,1,0 ,0,1,1,0,0
0,1,0,1,1 0,0,0,1,1} I have to either select vertex 2 and 4 or vertex 2 and 5.
I have got an undirected weighted connected graph. If I select one vertex I
Share
As already pointed out by red tuna, this is a type of vertex cover problem. Specifically, it’s a dominating set problem, the main difference being that a dominating set can be much smaller than a correct vertex cover.
You can model this as a set cover problem. Each vertex is represented as a subset containing itself and all adjoining vertices. If you don’t need to guarantee an exact optimal solution (just a very good one), you can then apply the greedy set cover heuristic to achieve an approximation to the optimal set in lg n time.