170 likes | 235 Views
Explore vertex cover, clique, matching, and more in graph theory optimization, including approximation algorithms and exact solutions for NP-hard problems. Learn how to find maximal matchings, minimum vertex covers, and analyze combinatorial counting techniques.
E N D
336C, March 7 2012 Tandy Warnow
Topics for today • Reviewing Exam 2 • Writing mathematics • Graph theory
Graph Theory • Vertex Cover: a subset X of vertices so that every edge has at least one of its endpoints in X • Clique: a subset X of vertices that are pairwise adjacent • Independent Set: a subset X of vertices that have no edges between them • Vertex Coloring: an assignment of colors to the vertices so that no two adjacent vertices are assigned the same color • Matching: a subset E’ of the edges so that no two edges in E’ share an endpoint
Optimization problems • Min Vertex Cover: Finding a smallest vertex cover • Max Clique: Finding a largest clique • Max Independent Set: Finding a largest independent set • Min Vertex Coloring: Finding the smallest number of colors that suffices to vertex-color a graph • Maximum Matching: Finding a largest matching
Optimization problems, cont • All of these problems are NP-hard for the general case. • Some special cases (problems on trees, for example) can be solved in polynomial time. • These problems are often related to each other (e.g., for any graph G, the complement of a vertex cover is an independent set)
Approximation algorithms • An approximation algorithm is used to find a solution that may not be optimal, but whose “score” is within some factor of optimal. • For example, a 2-approximation algorithm for Minimum Vertex Cover would produce a vertex cover with at most twice the number of vertices of a smallest vertex cover
Minimum vertex cover • How do matchings and vertex covers relate to each other? • Think: if a graph has a matching of size k, then what can you say about the size of a minimum vertex cover?
Maximal matching • A maximal matching is a matching E’ (subset of the edge set) that cannot be enlarged by adding more edges to it • Note: maximal is not the same as maximum!
Finding maximal matching • Greedy algorithm is just fine! • Start with any edge in the graph • Keep adding edges until you run out of edges to add
Maximal matchings and vertex cover • Let G be a graph and let E’ be a maximal matching. Suppose |E’|=k. • What can you say about the size of a minimum vertex cover?
Maximal matching and minimum vertex cover • If E’ has k edges, then any vertex cover has to have at least one endpoint of each of these edges. • Hence the minimum vertex cover size is at least k. • Algorithm: Given maximal matching, take one endpoint from each edge. Is this a vertex cover?
Maximal matching and minimum vertex cover • The size of a minimum vertex cover can be larger than k (the number of edges in a maximal matching), so this is not an algorithm to solve minimum vertex cover!
Finding a vertex cover • What happens if we take both endpoints from each edge in a maximal matching?
How big is this vertex cover? • Note: if you take both endpoints from each edge of a maximal matching, you get a vertex cover. • How bad an approximation ratio is this?
2-approximating Min Vertex-Cover • Input: graph G=(V,E) • Output: vertex cover V’ (subset of V) that has at most twice as many vertices as a min vertex cover • Algorithm: • Find a maximal matching E’. • Take both endpoints from each edge in E’.
Exact algorithms • Solving any NP-hard problem exactly isn’t all that easy. • Exhaustive search is reliable • Heuristics may not be reliable • Let’s analyze exhaustive search algorithms!
Combinatorial counting • How many subsets of size k in a set of n elements? • How many permutations of a set of n elements? • Techniques for counting