Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fabrizio Frati Dipartimento di Informatica e Automazione Università degli Studi Roma Tre Tecniche Algoritmiche per Grafi e Reti.

Similar presentations


Presentation on theme: "Fabrizio Frati Dipartimento di Informatica e Automazione Università degli Studi Roma Tre Tecniche Algoritmiche per Grafi e Reti."— Presentation transcript:

1 Fabrizio Frati Dipartimento di Informatica e Automazione Università degli Studi Roma Tre Tecniche Algoritmiche per Grafi e Reti

2 3 CREDITI I° periodo: Lunedì 9:45-11:15 aula N13 Contatti: {angelini,gdb,frati,ratm} @dia.uniroma3.it Ricevimento: mercoledì dalle 17 alle 19 II° periodo: Venerdì 8:00-9:45 aula N7

3 Struttura del Corso ~ 8 seminari algoritmi, strutture dati, combinatorica, graph drawing… progetti a gruppi di 2 - 4 persone problema di ricerca Materiale Didattico slides G. Di Battista, P. Eades, R. Tamassia, I. G. Tollis, Graph Drawing: Algorithms for the Visualization of Graphs, 1999. Prentice Hall.

4 ACM Computing Classification System A.General Literature B.Hardware C.Computer System Organization D.Software E.Data F.Theory of Computation G.Mathematics of Computing H.Information Systems I.Computing Methodologies J.Computer Applications

5 ACM Computing Classification System C. Computer System Organization 1.Processor Architectures 2.Computer-Communication Networks 3.Application-Based Systems 4.Performance of Systems 5.Computer System Implementations

6 ACM Computing Classification System C. Computer System Organization 2. Computer-Communication Networks 2.1 Network Architectures 2.2 Network Protocols 2.3 Network Operations 2.4 Distributed Systems 2.5 LAN & WAN 2.6 Internetworking

7 ACM Computing Classification System A.General Literature B.Hardware C.Computer System Organization D.Software E.Data F.Theory of Computation G.Mathematics of Computing H.Information Systems I.Computing Methodologies J.Computer Applications

8 ACM Computing Classification System E. Data 1.Data Structures 2.Data Storage Representations 3.Data Encryption 4.Coding and Information Theory 5.Files

9 ACM Computing Classification System E. Data 1. Data Structures 1.1 Arrays 1.2 Distributed Data Structures 1.3 Graphs and Networks 1.4 Lists, Stacks, and Queues 1.5 Records 1.6 Tables 1.7 Trees

10 ACM Computing Classification System A.General Literature B.Hardware C.Computer System Organization D.Software E.Data F.Theory of Computation G.Mathematics of Computing H.Information Systems I.Computing Methodologies J.Computer Applications

11 ACM Computing Classification System F. Theory of Computation 1.Computation by Abstract Devices 2.Analysis of Algorithms and Problem Complexity 3.Logics and Meanings of Programs 4.Mathematical Logic and Formal Languages

12 ACM Computing Classification System F. Theory of Computation 1. Computation by Abstract Devices 1.1 Models of Computation 1.2 Complexity Measures and Completeness 1.2.1 Complexity Hierarchies 1.2.2 Machine-Independent Complexity 1.2.3 Reducibility and Completeness 1.2.4 Relations among Complexity Classes

13 ACM Computing Classification System F. Theory of Computation 2. Analysis of Algorithms and Problem Complexity 2.1 Numerical Algorithms 2.2 Non-numerical Algorithms and Problems 2.2.1 Complexity of Proof Procedures 2.2.2 Computations on Discrete Structures 2.2.3 Geometrical Problems 2.2.4 Pattern Matching 2.2.5 Routing and Layout 2.2.6 Sequencing and Scheduling 2.2.7 Sorting and Searching

14 ACM Computing Classification System A.General Literature B.Hardware C.Computer System Organization D.Software E.Data F.Theory of Computation G.Mathematics of Computing H.Information Systems I.Computing Methodologies J.Computer Applications

15 ACM Computing Classification System G. Mathematics of Computing 1.Numerical Analysis 2.Discrete Mathematics 3.Probability and Statistics 4.Mathematical Software

16 ACM Computing Classification System G. Mathematics of Computing 2. Discrete Mathematics 2.1 Combinatorics 2.2 Graph Theory 2.3 Applications 2.1.1 Combinatorial Algorithms 2.1.2 Counting Problems 2.1.3 Generating Functions 2.1.4 Permutations and Combinations 2.1.5 Recurrences and Difference Equations 2.2.1 Graph Algorithms 2.2.2 Graph Labeling … 2.2.5 Path and Circuit Problems 2.2.6 Trees

17 a world FULL of NP-hard problems Problem: I want to travel among a set of cities driving the fewest possible number of KMs. IT’S DIFFICULT!! Problem: I want to put a set of objects into some bags, knowing that each bag can not afford more than 10 KGs and trying to use as few bags as possible. IT’S DIFFICULT!!

18 How to Deal with NP-hard problems? Exact Algorithms Randomized Algorithms Approximation Algorithms Fixed-Parameter Tractable Algorithms …

19 Approximation Algorithms

20 We want a solution “close” to the optimal one. Given a minimization problem Π, an algorithm is an α -approximation for Π if, for every instance I of Π, it outputs a solution SOL(I) such that SOL(I)/OPT(I) ≤ α

21 Vertex Cover Problem: Given a graph G(V,E), find a minimum vertex cover, that is, a set V’ V such that every edge e E has an endvertex in V’. NP-hard  [Karp]

22 How to Guarantee an Approximation? We want an approximation algorithm for Vertex Cover. But computing the cost of an optimal solution is NP-HARD!! LOWER BOUNDS! The cost of the solution produced by the algorithm should be compared with the cost of an optimal solution.

23 Lower Bound for Vertex Cover Given a graph G(V,E), a matching M is a set of edges M E such that no two edges share an endvertex. The size of a matching is a lower bound on the size of an optimal solution to Vertex Cover! A matching is maximal if no matching M’ exists such that M M’.

24 An Approximation Algorithm for Vertex Cover Algorithm: Find a maximal matching M and output the set S of matched vertices

25 An Approximation Algorithm for Vertex Cover Theorem: The previous algorithm is a 2-approximation algorithm for Vertex Cover Proof: S is a vertex cover, otherwhise the matching would not be maximal. OPT≥M, where M is the size of the output maximal matching. SOL=2M, as the number of matched vertices is twice the size of the matching.

26 Approximation Algorithms:much more… Approximation schemes: (1+ε)-approx. Inapproximability results. Complexity classes, e.g., APX.

27 Fixed-Parameter Tractable Algorithms

28 Problem (optimization): Let G be a graph. Which is the minimum number of vertices whose deletion makes G planar? Easy or Hard? NP-hard  [Lewis-Yannakakis ]

29 Problem (decision): Let G be a graph and k be an integer. Is there a set of k vertices whose deletion makes G planar? Easy or Hard? Polynomial Easy O(n k+1 ) time algorithm for solving the problem: Consider every set of k vertices. Remove such vertices. Test the planarity of the resulting graph. There are O(n k ) such sets. Testing the planarity of an n-vertex graph takes O(n) time. Then, T(n,k)= O(n k ) O(n) = O(n k+1 )

30 Where is the trick? Easy or Hard? In the decision version, k is a constant parameter part of the input An O(n k+1 )-time algorithm, with k constant, is a polynomial-time algorithm. But it is very slow 

31 Fixed-Parameter Tractability A problem is fixed-parameter tractable if it can be solved in f(k) n O(1) time, where k is a parameter of the problem, f is an arbitrary function, and n O(1) is a polynomial (not depending on k).

32 FPT algorithm for Vertex Cover Theorem [Melhorn]: There is an O(2 k n)- time algorithm for Vertex Cover. Proof: Consider an instance (G,k). There is a vertex cover with k=0 if and only if G has no edge. Consider any edge e=(u,v). Either u or v belongs to any vertex cover S. Consider both the case in which u S and the case in which v S.

33 FPT algorithm for Vertex Cover u S -> S is a vertex cover of G if and only if S-{u} is a vertex cover of G-{u} -> solve the instance (G-{u}, k-1) v S -> S is a vertex cover of G if and only if S-{v} is a vertex cover of G-{v} -> solve the instance (G-{v}, k-1) u v v u

34 FPT algorithm for Vertex Cover Time complexity T(n,k): T(n,0) = O(n) T(n,k) = 2 T(n-1, k-1) +O(n) ≤ 2 T(n, k-1) +O(n) ≤ 2 (2 T(n, k-2) +O(n)) +O(n) ≤ 2 (2 (2 T(n, k-3) +O(n)) +O(n)) +O(n) ≤ 2 (2 (2 (…(2 T(n, 0)+O(n)) + … +O(n)) +O(n)) +O(n) ≤ 2 k O(n) + (2 k-1 + 2 k-2 + 2 k-3 +... + 1) O(n) = 2 k O(n) + (2 k - 1) O(n) = O(2 k n)

35 Reduction Rules Reduction rule : a rule (that is, a polynomial time algorithm) that transforms an instance (I,k) to an "equivalent and simpler” instance (I', k’). Equivalent: (I,k) is a YES instance if and only if (I', k') is a YES instance. Simpler: |I'|<|I| or k'<k or I' has fewer occurrences of a particular substructure.

36 Another FPT algorithm for Vertex Cover Theorem: There is an O(1.6181 k n 2 )-time algorithm for Vertex Cover. Proof: Consider an instance (G,k). We apply the following two reduction rules: If G has a vertex u of degree 0, then let (G',k')=(G-{u},k). If G has a vertex u of degree 1, then let N(u) denote the set of neighbors of u (here |N(u)|=1). Add N(u) to S and let (G',k')=(G-{u,N(u)},k-1).

37 Another FPT algorithm for Vertex Cover If G has a vertex u of degree 0, then let (G',k')=(G-{u},k). Correctness: if S is a vertex cover of G and u is in S, then S-{u} is also a vertex cover of G, as u has no incident edge. If G has a vertex u of degree 1, then let N(u) denote the set of neighbors of u (here |N(u)|=1). Add N(u) to S and let (G',k')=(G-{u, N(u)},k-1). Correctness: if S is a vertex cover of G and u is in S, then S-{u} N(u) is also a vertex cover of G, as u has no other incident edge.

38 Another FPT algorithm for Vertex Cover If neither of the two rules can be applied, then every vertex has degree at least 2. Pick a vertex u. Any vertex cover of G contains either u or N(u). Thus, (G,k) is a YES instance if and only if (G-{u},k-1) or (G-N(u),k-|N(u)|) is.

39 FPT algorithm for Vertex Cover Time complexity T(n,k): Since |N(u)|\geq 2, T(n,k) ≤ T(n,k-1)+ T(n,k-2)+O(n^2). The k-th number of the Fibonacci series tends to the golden ratio to the power of k. Fibonacci series: every number is the sum of the previous two x k =x k-1 +x k-2 +c. T(n,k)=Φ k O(n 2 )=((1+√5)/2) k O(n 2 ) = O(1.6181 k n 2 ).

40 Kernelization Sometimes the reduction rules work till the size of the problem is reduced really a lot. That is, after the reduction rules have been applied, the problem has size g(k), for some function k. In this case the problem has a g(k)-kernel. Kernel: given a problem and an instance (I,k), a kernel is an algorithm that outputs in polynomial time an instance (I',k') such that (a) (I',k') is a YES instance if and only if (I,k) is; (b) |I'|<g(k), and k'<g(k).

41 Kernelization Theorem [Niedermaier] : Every fixed-parameter tractable problem has a g(k)-kernel. Proof: Suppose that there exists a FPT algorithm with running time f(k) n c, for some function f and some constant c. Consider an instance (I,k) with |I|=n. If n>f(k), we run the decision algorithm in time f(k) n c < n c+1. If it returns YES (NO), the kernelization algorithm outputs a constant size YES (resp. NO) instance. If n≤f(k), the the kernelization algorithm returns (I,k).

42 Kernelization The last theorem implies that every problem that is FPT has a kernel. However, the goal is to obtain kernels that are "small", that is, polynomial in k, or even constant.

43 FPT: much more… Some problems are not FPT (e.g., graph coloring). Complexity classes: W[1] -> Can a non- deterministic Turing machine accept an unary string s in at most k steps? Independent Set is W[1]-hard. Reductions to W[1]-hard problems give new W[1]-hard problems. Lower bounds for FPT tractability Upper and lower bounds for the size of the kernels

44 FPT: much more… Theorem [Robertson and Seymour]: Every graph problem with parameter k whose YES istances are closed under taking minors can be solved in O(f(k) n 3 )


Download ppt "Fabrizio Frati Dipartimento di Informatica e Automazione Università degli Studi Roma Tre Tecniche Algoritmiche per Grafi e Reti."

Similar presentations


Ads by Google