I have a graph, and I want to determine the largest possible set (or partition) of nodes such that no two nodes within this set have an edge between them. I am looking for an efficient algorithm to solve this problem.
For instance, given the following graph:
1: [2] 2: [1, 3, 5, 6, 4] 3: [2, 4] 4: [3, 5, 6, 2] 5: [4, 2] 6: [4, 2] The largest partition of non-connected nodes would be {1, 3, 5, 6}.
My current approach is brute-force: I generate all combinations of nodes and then verify if any of the nodes within a combination share an edge. This method, however, is not efficient for larger graphs.
Graphically, I intuitively group unconnected nodes together, and as I add nodes to this group, I can easily identify the largest possible set of non-connected nodes. Is there a way to replicate this intuition algorithmically?