Determine the independent sets of size 2 of G

506 Views Asked by At

So lets say I have a graph..

enter image description here

and I want to find the independent sets of size 2. I'm a little confused on how to go about this.

I know that a Independent set if there are no edges between vertices in s. So would my independent sets just be {D,C} and {B,D}. Or since I can reach D from B going through A would that not be one? How does the size k work? I guess it would be in NP? Is there a good algorithmic approach to solve this problem?

1

There are 1 best solutions below

0
On

In an undirected graph $G$, an independent set of size $2$ is just a pair of vertices that are not connected by an edge in $G$. Finding the set of all such pairs just involves looping through all the pairs of vertices and discarding the pairs that are connected by an edge in $G$. This is a polynomial-time algorithm if you use the usual representation of this kind of problem.