Maximum Independent Set Algorithm
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.
Maximum Independent Set Algorithm
Introduction
In graph theory, an independent set of a graph is a set of vertices no two of which are adjacent. The problem of finding the largest possible independent set, known as a maximum independent set (MIS), is a classic problem in theoretical computer science and combinatorial optimization. Finding an MIS has applications in various fields including network theory, resource allocation, and scheduling.
Formal Definition
Given an undirected graph , where is the set of vertices and is the set of edges, an independent set is a subset such that for every pair of vertices , the edge . A maximum independent set is an independent set of the largest possible size for .
Complexity
The problem of finding a maximum independent set is NP-hard. This means that no polynomial-time algorithm is known to exist for solving this problem in the general case, assuming . Due to this complexity, researchers often focus on approximation algorithms or specialized algorithms for certain classes of graphs (e.g., bipartite graphs, planar graphs).
Algorithms
Exact Algorithms
- Backtracking Algorithm: • A straightforward approach using backtracking where you recursively try including or excluding each vertex. • Time Complexity: , where is the number of vertices.
- Branch and Bound: • An optimization over backtracking, where you explore branches conditionally based on bounds of the remaining problem. • Improved Complexity: Can be reduced below in practice but still exponential.
Approximation Algorithms
Considering MIS is NP-hard, for many practical applications, approximation algorithms are used:
- Greedy Algorithm: • Iteratively choose the vertex with the smallest degree, add it to the independent set, and remove it and its neighbors from the graph. • This algorithm does not guarantee an optimal solution but provides a reasonable approximation in many cases.
- Local Search: • Start with an arbitrary independent set and iteratively attempt to make local improvements by adding vertices and removing neighbors.
Special Cases
Certain graph classes allow for polynomial-time algorithms:
- Bipartite Graphs: • In a bipartite graph, the complement of a maximum independent set is a minimum vertex cover, which can be solved in polynomial time using techniques like maximum matching.
- Interval Graphs: • These graphs have a specific structure that allows efficient detection of maximum independent sets using dynamic programming.
Example
Consider a graph with vertices and edges .
Let's use a greedy algorithm approach:
- Start by selecting vertex (degree = 1).
- Remove and its adjacent vertices, leaving vertices .
- Select vertex (degree = 1), remove and its adjacent vertices, leaving vertex .
- Select vertex (degree = 0).
Final independent set: which is maximum for this particular graph.
Comparison and Summary
The following table summarizes the key characteristics of different approaches for solving the Maximum Independent Set problem:
| Approach | Type | Time Complexity | Comment |
| Backtracking | Exact | Simple but exponential in time. | |
| Branch and Bound | Exact | Improved | Efficient pruning can vastly reduce search space. |
| Greedy | Approximation | Fast but not guaranteed to find maximum. | |
| Local Search | Approximation | Variable | Effective for small or specific input sets. |
| Special Case (Bipartite) | Exact | Polynomial | Utilizes maximum matching techniques. |
• : Number of vertices • : Number of edges
Conclusion
The Maximum Independent Set problem is a pivotal concept in graph theory with significant applications across computer science fields. Although computationally challenging due to its NP-hard nature, a variety of algorithms, both exact and approximate, provide viable paths for finding solutions depending on the specific characteristics of the input graph. Choosing the appropriate algorithm requires balancing the needs for precision and computational resources.
Related reading
- Maximum interval overlaps using an interval tree
- Maximum Product of Three Numbers
- Maximum product subsequence
- Maximum Subarray Divide and Conquer
- Maximum Sum SubArray
- Maximum weighted bipartite matching, constraint ordering of each graph is preserved
- Maximum number of characters using keystrokes A, CtrlA, CtrlC and CtrlV
- Maximum number of records in a MySQL database table

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.