Number Representations & States

"how numbers are stored and used in computers"

Minimum Vertex Cover

A vertex cover of an undirected graph is a set of vertices such that each edge of the graph is incident to at least one vertex in the set. The Minimum Vertex Cover (MVC) problem seeks to find a vertex cover of minimum size.

Problem Definition

Given an undirected graph , find a subset of minimum cardinality such that:

  • For every edge , either or (or both)

Complexity

The MVC problem is NP-hard for general graphs. However, it can be solved efficiently for some special classes of graphs:

  • Trees: time
  • Bipartite graphs: Polynomial time using maximum matching
  • Fixed-parameter tractable with respect to solution size

Algorithms

1. Approximation Algorithm

A simple 2-approximation algorithm:

code.py
1def approximate_vertex_cover(graph): 2 cover = set() 3 edges = list(graph.edges()) # Make a copy of edges 4 5 while edges: 6 # Pick any edge (u,v) 7 u, v = edges[0] 8 # Add both endpoints to cover 9 cover.add(u) 10 cover.add(v) 11 # Remove all edges incident to u or v 12 edges = [edge for edge in edges 13 if u not in edge and v not in edge] 14 15 return cover

2. Exact Algorithm for Trees

For trees, we can use dynamic programming:

code.py
1def mvc_tree(tree, root): 2 def dp(node, parent, must_cover): 3 if not tree[node]: 4 return 1 if must_cover else 0 5 6 if must_cover: 7 # Must include this node 8 return 1 + sum(dp(child, node, False) 9 for child in tree[node] if child != parent) 10 else: 11 # Try both including and excluding 12 include = 1 + sum(dp(child, node, False) 13 for child in tree[node] if child != parent) 14 exclude = sum(dp(child, node, True) 15 for child in tree[node] if child != parent) 16 return min(include, exclude) 17 18 return dp(root, None, False)

Integer Linear Programming Formulation

The MVC problem can be formulated as an integer linear program:

Where is 1 if vertex is in the cover, and 0 otherwise.

Applications

  1. Network Security: Monitoring network traffic with minimum number of nodes
  2. Resource Allocation: Covering services with minimal facilities
  3. Biological Networks: Identifying key proteins in protein-protein interaction networks
  4. Circuit Design: Minimizing test points in electronic circuits
  5. Transportation: Optimal placement of emergency services

Relationship to Other Problems

The MVC problem is closely related to several other graph problems:

  1. Maximum Independent Set: The complement of a minimum vertex cover is a maximum independent set
  2. Maximum Matching: In bipartite graphs, the size of a minimum vertex cover equals the size of a maximum matching (König's theorem)
  3. Set Cover: Vertex cover is a special case of the set cover problem

Time and Space Complexity

  1. Exact Solution (Brute Force)

    • Time Complexity:
    • Space Complexity:
  2. 2-Approximation Algorithm

    • Time Complexity:
    • Space Complexity:
  3. Dynamic Programming (Trees)

    • Time Complexity:
    • Space Complexity:

Where is the number of vertices.

Implementation Tips

  1. Graph Representation: Choose appropriate data structures (adjacency list/matrix)
  2. Edge Processing: Efficient edge removal in approximation algorithms
  3. Solution Verification: Check if all edges are covered
  4. Memory Management: Consider space efficiency in large graphs
  5. Parallelization: Possible for large-scale graphs