680 likes | 870 Vues
Parameterized algorithms and their applications Juris Viksna Riga, IMCS, 09.06.2011. Approaches to NP-hard problems. Branch-and-bound algorithms Heuristic methods Approximation algorithms Probabilistic algorithms Pseudo-polynomial algorithms Parameterized algorithms.
E N D
Parameterized algorithms and their applications JurisViksna Riga, IMCS, 09.06.2011
Approaches to NP-hard problems • Branch-and-bound algorithms • Heuristic methods • Approximation algorithms • Probabilistic algorithms • Pseudo-polynomial algorithms • Parameterized algorithms
Parameterized complexity Combinatorial "explosion" for NP-hard problems. Parameterized complexity attempts to confine combinatorial "explosion“. [Adapted from R.Downey and M.Fellows]
Parameterized complexity - Definitions Definition (FPT) A parameterized problemL ** is Fixed Parameter Tractable if there is an algorithm that for input (x,y) ** with |x| = k and |y| = n decides whether (x,y) L in time f(k) n, where f is an arbitrary function and is a constant (independent of k). Definition does not changeif f(k) nis replaced by f(k) + n(!!!) [Adapted from R.Downey and M.Fellows]
Parameterized complexity - Definitions • Mkfor every n solves the problem in timef(k) n • For each k there is a constant ck, such that • f(k) n < n + 1 for n ck • M'k: - simulates Mk for n ck • - looks up value from the table for n ck • M'k solves the problem in time (f'(k) = ck ) + na+1
Some parameterized problems VERTEX COVER Instance: A graph G=(V,E) Parameter: A positive integer k Question: Is there a subset SV, such that |S|=k and for all {x,y}E eitherxS or yS? • NP-complete • simple 2-approximation algorithm • 2-(1/(log n)1/2)-approximation algorithm is known • there is O(1.2738kn) parameterized algorithm (this could be practical for values of k up to 80–90) [Adapted from R.Downey and M.Fellows]
Algorithms for Vertex Cover • O(f(k) n3) [Fellows, Langston, 1986] • O(f(k) n2) [Johnson, 1987] • O(2k n) (polynomial for k=O(log n)) [Fellows, 1988] • O(kn + 2k k2k+2) [Buss, 1989] • O(kn + 2k k2) [Balasubramanianet al,1992] • O(3k n) [Papadimitriu, 1993] • O(kn + (4/3)k k2) [Balasubramanianet al,1996] • O(1.2738kn) [Dinur, Safra, 2005]
Some parameterized problems VERTEX COVER Instance: A graph G=(V,E) Parameter: A positive integer k Question: Is there a subset SV, such that |S|=k and for all {x,y}E eitherxS or yS? [Adapted from R.Downey and M.Fellows]
Some parameterized problems GRAPH GENUS Instance: A graph G=(V,E) Parameter: A positive integer k Question: Does graph G have genus k? [Adapted from R.Downey and M.Fellows]
Some parameterized problems GRAPH LINKING NUMBER Instance: A graph G=(V,E) Parameter: A positive integer k Question: Can G be embedded in 3-space such that the maximum size of a collection of topologically linked disjoint cycles is bounded by k? [Adapted from R.Downey and M.Fellows]
Some parameterized problems • VERTEX COVER: • A single algorithm G running in time 2k |G| for each k • [Downey and Fellows 1992] • GRAPH GENUS: • A single algorithm F, which for each fixed k determines • whether graph G has genus k in time O(|G|3) • [Fellows and Langston 1988] • GRAPH LINKING NUMBER: • For each k there is an algorithm k, which determines • whether graph G has linking number k in time O(|G|3) • [Fellows and Langston 1988] [Adapted from R.Downey and M.Fellows]
How to construct a parameterized algorithm? • Bounded Search Tree methods • Construct a search space (tree), such that the size search space depends only from parameter k. • Run some relatively efficient algorithm (say DFS) to traverse the tree. • Kernel methods • Reduce a problem instance I to an equivalent instance I', where the size of I' is bounded by some function of the parameter k. • Use exhaustive search to solve instance I', then lift a solution for I' to a solution to I.
Bounded search tree methods – Vertex Cover , G {u1,v1} {u1}, G-{u1} {v1}, G-{v1} k+1 {u2,v2} {v1,u2}, G-{v1,u2} {v1,v2}, G-{v1,v2} By considering only graphs with vertices of degree 3 or higher, it is possible to shrink search space from 2k to (51/4)k [Balasubramanian et al 1997] Theorem [Downey and Fellows 1992] VERTEX COVER is solvable in time O(2k |V(G)|).
Kernel methods – Vertex Cover Theorem [Buss 1989] VERTEX COVER is solvable in time O((2k)k + k |V(G)|). Observation Any vertex of degree greater than k must belong to every k-element vertex cover. Step 1 Locate all vertices in G of degree greater than k; let p equal the number of such vertices. If k< p, there is no k-vertex cover. Otherwise let k' = p – k. Step 2 Discard all vertices found in step 1 and the edges incident to them. If the resulting graph G' has more than k'(k+1) vertices, reject.
Kernel methods – Vertex Cover Observation Any vertex of degree greater than k must belong to every k-element vertex cover. Step 1 Locate all vertices in G of degree greater than k; let p equal the number of such vertices. If k< p, there is no k-vertex cover. Otherwise let k' = p – k. Step 2 Discard all vertices found in step 1 and the edges incident to them. If the resulting graph G' has more than k'(k+1) vertices, reject. Step 3 If G' has no k'-vertex cover, reject. Otherwise, any k'-vertex cover of G' plus the p vertices from step 1 constitutes a k-vertex cover for G. Graph with k' vertex cover and vertex degree bounded by k has up to k'(k+1) vertices Doable in O((2k)k) time
Algorithms for Vertex Cover Search tree method O(2kn) O((51/4)kn) Kernel method O((2k)k + k n) If we use reduction to problem kernel first, andthen apply search tree method to problem kernel, we improve additive bounds to: O(kn + 2kk2) [Balasubramanianet al 1992] O(kn + ((51/4)kk2) [Balasubramanianet al 1992]
Quasi orderings • Let S be a set and a binary relation defined on set S. • S,is quasi ordering, if for all x,y,zS: • xx(reflexivity) • xy and yz xz (transitivity)
Quasi orderings - terminology Let S, be a quasi ordering. Let a0,a1,... be a sequence of elements of S. a0,a1,... is chainif ij ai aj a0,a1,... is antichainif ij ai| aj a0,a1,... is infinite decreasing sequence if ij ai>aj (i.e. aiajand aiaj)
Quasi orderings - terminology S' S - filter if xS' and yx yS' F(A)={yS | xA: xy} - filter generated by A S' S - ideal if xS' and yx yS' I(A)={yS | xA: xy} - ideal generated by A If F is a filter then S–F is an ideal and vice versa A filterS'is finitely generated if S'=F(A) for a finite set A S. S,has a finite basis property if F(A) is finitely generated for all AS.
WQO (Well-quasi ordering) • A quasi ordering S,is well-quasi ordering(WQO) if any of the following holds: • every infinite sequence x1,x2,... of S contains an infinite chain; • for every infinite sequence x1,x2,... of S there are indices i and j such that i < j and xi xj; [simplest to verify] • there are no infinite antichains or infinite decreasing sequences; • S,has a finite basis property. [most useful]
Examples of WQO N, is WQO under usual order relation . For each x1,x2,... i,j: i < j and xi xj S, is WQO for each finite set and equality relation . Each infinite sequence x1,x2,... will contain at least one repeated element xi Other examples?
Higman’s Lemma Higman’s Lemma Let S be a finite set and S* be a set of all finite sequences of elements of S. Let be defined on set S* as follows: v wv is a subsequence of w. Then S*, is WQO.
Higman’s Lemma • Higman's Lemma - the idea of proof: • assume (S*,) is not WQO • let w1,w2,... be the smallest infinite antichain • there is aS, such that infinite number ofwi's starts with a • let the sequence of these wi's be wi1,wi2,... • denote wij with the first symbol a removed by w'ij • then w1,...,wi1-1,w'i1,w'i2,... is antichain and smaller than the smallestone (!!!)
Ordering relations on graphs Subgraph relation: A graph H=(V1,E1) is a subgraph of G=(V2,E2) if there is an injective mapping : V1 E1, such that {x,y}E1 {(x), (y)}E2. H SG H is a subgraph of G. S S
Ordering relations on graphs Topological embedding relation: For a graph G let P(G) denote a set of all simple paths in G. A graph H=(V1,E1) is topologically embedded in G=(V2,E2) if there is an mapping : E1 P(G), such that for all pairs of distinct edges e1,e2E1 the corresponding paths (e1)and (e2) are vertex-disjoint. H TG there is a topological embedding of H in G. Kuratowski Theorem Graph G is planar K5TG and K3,3TG.
Ordering relations on graphs Graph minor relation: A graph H=(V1,E1) is a minor of G=(V2,E2) if H is a subgraph of graph G' obtained from G by a sequence of edge contractions. H MG H is minor of G. Edge contraction K4 M K3,3 Edge contraction
Ordering relations on graphs Graph immersion relation: A graph H=(V1,E1) is immersion in G=(V2,E2) if there is an mapping : E1 P(G), such that for all pairs of distinct edges e1,e2E1 the corresponding paths (e1)and (e2) are edge-disjoint. H IG H is immersion in G. I
Ordering relations on graphs • Are any of these orderings WQO? • subgraph relation Sis not WQO • topological embedding Tis not WQO ...... ......
Ordering relations on graphs • graph minor relation M is WQO • graph immersion relation Iis WQO • Theorem [N.Robertson, P.Seymour] • Every infinite set of graphs contains two graphs such that one is a minor of another. • Theorem [N.Robertson, P.Seymour] • Every infinite set of graphs contains two graphs such that one is immersed in another. The proof is spread over 23 articles published in Journal of Algorithms from 1983 to 2009
Testing graph minor and immersion properties MINOR ORDER TEST is FPT-solvable in time O(n3) [Robertson and Seymour 1995] IMMERSION ORDER TEST is FPT-solvable in polynomial time poly(n) [Fellows and Langston 1988]
WQO and graph planarity GRAPH PLANARITY Instance: Graph G=(V,E) Question: Is G planar? Observation If G is planar and HMG, then H is planar. Conversely: Gis non-planar, GMH H is non-planar. Thus a set N of non-planar graphs is a filter and since M is WQO, N has a finite basis B. To show that graph G is planar it suffices to show HMG that for all GB. Graph planarity is in P However, Graph Minor Theorem is intrinsically nonconstructive– there is no algorithm, which for a given filter computes its basis...
WQO and graph planarity GRAPH PLANARITY Instance: Graph G=(V,E) Question: Is G planar? Kuratowski theorem {K3,3, K5} is an obstruction set for the ideal of planar graphs under Mordering. This already gives a concrete P-time algorithm for graph planarity problem [Adapted from R.Downey and M.Fellows]
WQO and Graph Genus For fixed k GRAPH GENUS is in P GRAPH GENUSFPT GRAPH GENUS Instance: A graph G=(V,E) Parameter: A positive integer k Question: Does graph G have genus k? A set of graphs Sk with genus > k is a filter with respect to ordering M Skhas finite basis for each k we have polynomial algorithm to check Skmembership
WQO and Vertex Cover VERTEX COVER Instance: A graph G=(V,E) Parameter: A positive integer k Question: Is there a subset SV, such that |S|=k and for all {x,y}E eitherxS or yS? If G has vertex cover of size k and HMG,thenH has vertex cover of size k. Thus a set of graphs having vertex cover of size > k is a filter. For fixed k VERTEX COVER is in P VERTEX COVERFPT
Self reduction HAMILTONICITY Instance: A graph G=(V,E) Question: Does graph Ghas a Hamiltonian cycle? Assuming we have an efficient oracle which for a given graph answers yes/no to the above decision problem, if the answer is yes we can also efficiently find a Hamiltonian cycle as follows: for each eE: if G with e removed still has Hamiltonian cycle, remove e from G The edges that will be left in E will form a Hamiltonian cycle.
Self reduction Assume that to prove the existence of a parameterized algorithm for deciding membership to Fwe have used WQO method – i.e. we know that there exists a finite basis B for F complement. In certain cases this still allows us to obtain a concrete algorithm! For given input x: start with B= check whether there exists yB with y x if such y exists the answer is no otherwise try to self-reduce, if solution is found the answer is yes if solution isn’t found, generate the next element from complement of F that doesn’t have a minor in B, add it to B and go to Step 1.
Thus we can use the fact that M is WQO to prove the existence of parameterized algorithms Can other WQO relations also be used for this?
Some known WQO relations H S G H T G H TG H M G not comparable H TG H I G WQO on sequences? S*, WQO (the one we used in Higman’s lemma) WQO on directed graphs? - problem seems to be even much more complicated than for M or I - some alternative “minor” relations can be defined - few results about WQO for special classes of digraphs – e.g. class of all tournaments (complete directed graphs) is WQO [M.Chudnovsky, R.Seymour, 2010]
WQO and Closest String CLOSEST STRING Instance:A set of strings s1,..,sk over finite alphabet of length n each Parameter: Positive integers k and d Question:Find a string s such that d(s,si)d for all i=1,...,k Can be solved in time O(kn +kdd+1) (simple kernel algorithm [Gramm et al]) There is a parameterized algorithm deciding whether such string s exist due to (slightly generalized) Higman’s lemma
Graph treewidth • Definition • The class of k-trees is the smallest set of graphs satisfying the following conditions: • Kk+1 is a k-tree; • if G is a k-tree and H is a subgraph of G isomorphic to Kk, then the graph G' constructed from G by first adding a new vertex v to G and then adding edges to make H{v} a copy of Kk+1, is a k-tree. • Definition • If G is a subgraph of k-tree, and isn’t a subgraph of k1-tree then G is called a partial k-tree.
Examples of k-trees [Adapted from R.Downey and M.Fellows]
Graph treewidth • Definition • A tree-decomposition of a graph G=(V,E) is a tree T each vertex x of which is labeled by a set Tx V and the following conditions hold: • for every {v,w}E there is x with v,wTx. • for every vV and every x,y: vTx and v Tythere is a path between x and y in T. • Definition • A treewidthtw(G) of graph G is the smallest k for which there exists a tree decomposition T of G with |Tx| k+1 for every x. tw(G) is defined equal to kand not k+1 with the purpose to have tw(G) = 1 for trees.
Graph treewidth Tree decomposition - example [Adapted from J.Blum and M.Grohe]
Graph treewidth Theorem G is a partial k-tree tw(G)=k. Tree Clique Grid tw = 1 tw= ktw = k
Computing graph treewidth p(k) = 32k3Although the algorithm is simple and constructive, it is still non-practicaland exhaustive search nk methods work better. Theorem Each tree decomposition T of graph G=(V,E) can be transformed into a tree decomposition T' with at most |V| vertices in time O(|V|). [Adapted from J.Blum and M.Grohe]
tw(G) as a parameter 3-COLOURABILITY Instance: A graph G=(V,E) Parameter: tw(G) Question:Can vertices of Gbe coloured in 3 colours in such a way that all adjacent vertices have different colours? DP on tree decompositions Do exhaustive search to find all colourings compatible with vertex and both of its children Do exhaustive search to find all compatible colourings of leaves Do exhaustive search to find all compatible colourings of leaves
tw(G) as a parameter HAMILTONICITY Instance: A graph G=(V,E) Parameter: tw(G) Question:Does G have a Hamiltonian cycle? Can also by solved in time O(f(tw(G)) n) by dynamic programming on tree decomposition of G.
Myhill-Nerode theorem – a finite set; L – language over * Definition (right congruence) (v L w) (for all z *: vzL vzL) Definition L has finite index, if it has only a finite number of equivalence classes with respect to L. Myhill-Nerode Theorem L is finite state L has finite index. L={anbn: n>1} is not regular since an L am for mn.
Myhill-Nerode theorem U – a set of t-boundary graphs with tw = t. FU. Definition (right congruence) (G1F G2) (for all HU: G1 HF G2 H F) Definition F has finite index, if it has only a finite number of equivalence classes with respect to F. Analog of Myhill-Nerode Theorem for treewidtht graphs F is t-finite state F has finite index. 1 2 t The fact that F is t-finite state here is not a property of graphs, but of so called parse-trees. There exists a tree-automata that decides whether a graph for which a parse tree is given belongs to F. This implies that there is O(f(t) n) algorithm for deciding F membership (!!!)