VOOZH about

URL: https://www.geeksforgeeks.org/dsa/dominant-set-of-a-graph/

⇱ Dominant Set of a Graph - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Dominant Set of a Graph

Last Updated : 26 Oct, 2023

In graph theory, a dominating set for a graph G = (V, E) is a subset D of V such that every vertex not in D is adjacent to at least one member of D. The domination number is the number of vertices in a smallest dominating set for G. 

👁 Image

Examples:

Input : A graph with 4 vertex and 4 edges 
Output : The Dominant Set S= { a, b } or { a, d } or { a, c } and more.


👁 Image
 
Input : A graph with 6 vertex and 7 edges 
Output : The Dominant Set S= { a, d, f } or { e, c } and more.
👁 Image
 

It is believed that there may be no efficient algorithm that finds a smallest dominating set for all graphs, but there are efficient approximation algorithms. 

Algorithm :

  • First we have to initialize a set 'S' as empty
  • Take any edge 'e' of the graph connecting the vertices ( say A and B )
  • Add one vertex between A and B ( let say A ) to our set S
  • Delete all the edges in the graph connected to A
  • Go back to step 2 and repeat, if some edge is still left in the graph
  • The final set S is a Dominant Set of the graph

Implementation:


Output
The Dominant Set is : { 1 3 5 }
Comment
Article Tags: