The Extended Longest Path Problem

The Extended Longest Path Problem

The Extended Longest Path Problem (Nov 2009, Theory seminar) Problem definion Longest Path Problem: Given an undirected graph, G = (V,E) and an integer k ≥ 0, does G have a simple path of length k? Extended Longest Path Problem: Given an undirected graph, G = (V,E) and an integer k ≥ 0, find all pairs of verces that have a simple path of length k between them. (Note: 1. “length k” denotes edge‐length k (i.e. a simple path of length k has k edges. 2. The Longest Path Problem, and the Extended Longest Path Problem – both are NP‐complete. ) • This talk will be based on the following two papers: [1] Color‐coding: Alon, Yuster, Zwick. [1995] [2] Divide‐and‐color: Kneis, Molle, Richter, Rossmanith [2006] • We shall look at three approaches to solve the Extended Longest Path problem. 1. Method of Random Orientaons [Alon et al.] 2. Color‐coding [Alon et al.] 3. Divide‐and‐color [Kneis et al.] Method of Random Orientaons • Movaon for the method • Consider adjacency matrix, A of G = (V,E). A has 0/1 entries (we’ll interpret them as integers). Now, A[i][j] ≠ 0 ⇒ there exists an edge between verces, i and j in the graph. • Movaon for the method Consider matrix, A2 = A × A. 2 → there exists a path of length 2 between A [i][ j] ≠ 0 verces, € i and j. Generalizing, we can say:‐ € there exists a path of length Ak[i][ j] ≠ 0 → k between verces i and j. € • Movaon for the method • Each entry in the matrix, corresponds to a path of Ak length k. • Queson: Do entries of correspond to Ak simple paths of length k€? • In other words, is the following statement true: € k there exists a A [i][ j] ≠ 0 → simple path of length k between verces, i and j. (?). € • Movaon for the method Answer: No. Remarks: 1. The paths represented by the matrix entries may Contain cycles. Hence the statement is not true. 2. If the statement were true, we would have already solved in polynomial me the NP‐complete problem we set out to solve (and hence it is not true). • Movaon for the method • Simple Idea: If the graph itself did not have cycles, then all paths in the graph would be simple. Hence, we could then use the matrix, of that graph, Ak to find all pairs of verces having simple paths of length k between them. € • Movaon for the method • Queson: How do we convert the given graph G=(V,E) into an acyclic graph? • Soluon: Convert G into a Directed Acyclic Graph. Method of Random Orientaons • Idea • Take a random permutaon, π : V → {1, …, |V|} of the Vertex Set, V of G. • Orient each edge {i,j} of E from i to j iff π(i) < π(j). Remark: By orienng edges in this manner, all cycles in the original graph get broken. Method of Random Orientaons • Method: • Call the directed acyclic graph obtained from G as Ga . • Let B be the adjacency matrix of Ga . Method of Random Orientaons • Method k • there exists a simple path of B [i][ j] ≠ 0 → length k between verces i and j in Ga. • This in turn implies that there exists a simple path of length k between verces i and j in the € original graph, G. Method of Random Orientaons • Method • Queson: Are all simple paths of G preserved in Ga ? (Suppose p is a simple path in G; do the edges forming p form a simple path in Ga ? ) • Answer: No. Method of Random Orientaons • Method • Example: Method of Random Orientaons • Method • Given a simple path, p in G of length k. What is the probability that p is preserved in Ga ? • Answer: 2/ (k+1)! • Therefore, we need to repeat the algorithm with an expected number of O( (k+1)!) permutaons to find all k‐length simple paths of G. Method of Random Orientaons • We can now state the algorithm. • Input: undirected graph, G=(V,E), integer k ≥ 0. • Repeat (k+1)! / 2 mes. 1. Take a random permutaon, π and convert G into a directed acyclic graph based on π. 2. Compute to find all pairs of verces having a Bk simple path of length k between them under permutaon π. € Method of Random Orientaons • Running Time • For a parcular permutaon, π – compung k takes B O(log k) matrix mulplicaons, each taking me. O(V ω ) • We repeat the same for (k+1)! permutaons. € • Running me: O( (k+1)! poly(V,E,k) ) € Color‐coding • Movaon for color‐coding:‐ • Random orientaons method has a (k+1)! term in the running me. Color‐coding • Idea • Color each vertex in the vertex set of input graph G with one color from a set of colors. • Instead of trying to find a simple path, try to find a “Colorful path” in the colored graph. Color‐coding • Idea • Colorful path: A path in which each vertex along the path has a disnct color. • Example: Color‐coding • Idea • A colorful path is necessarily simple. Therefore, if we find that there exists a colorful path of length k, between verces u and v in the colored graph, then there exists a simple path of length k between u and v in the original graph. Color‐coding • Our aim now is to find a colorful path of length k in a colored graph. • Input: Colored graph G=(V,E) [each vertex is Colored with one color from a set of (k+1) Colors], integer k ≥ 0. • To find: All pairs of verces in V having a Colorful path of length k between them. Color‐coding • Finding colorful paths in a colored graph • Simple dynamic programming algorithm (This algorithm finds all verces, v such that there is a Colorful path of length k between v and a disnguished start vertex, s.) • i.e. Input: colored graph G=(V,E), integer k ≥ 0, start vertex, s ∈V. Color‐coding • Dynamic Programming algorithm • Idea/Example • Suppose we have a colorful path of length, 3 from s to some vertex, v. • Now, suppose we wish to extend the path to vertex x (assuming edge {v3,x} exists). • We need to ensure that Color(x) is disnct from all 4 Colors present in the current path. Color‐coding • Idea behind dynamic programming algorithm (1) In order to extend a path of length i into a path of length i+1, we need to know the set of colors used up so far in the path of length i. Color‐coding • Idea behind dynamic programming algorithm • Example: • We want to extend ll vertex x, the colorful path of length 3 from s to v3. • Now, the colorful path s – v1 – v2 –v3 cannot be extended to x, while the colorful path s – v5 – v4 – v3 Can. Color‐coding • Idea behind dynamic programming algorithm • Example: • (We have 2 colorful paths from s to v3, which we want to extend to vertex x.) • Since we are only interested in the color‐set used in the current path, and not its actual verces, we do not to store different paths having idencal color‐sets. • Storing only disnct color‐sets will suffice. Color‐coding • Idea behind dynamic programming algorithm (2) For proceeding from a colorful path of length i to one of length i+1, for each vertex, v we will store all sets of colors that are present on colorful path(s) of length i between s and v. • There can be at most C(k+1,i+1) = (k+1)! / ( i+1)! * (k‐i)!) such colors sets for each vertex v. Color‐coding • Idea behind dynamic programming algorithm • At any iteraon, we take all colorful paths of length i ( 0≤ i ≤ k‐1), and try to extend them to obtain colorful paths of length i+1. • We start with colorful paths of length 0. (The vertex, “s” is the only such path.) • At the end of the iteraon (for proceeding from paths ith . of length (i‐1) to i, for each vertex v ∈V, we store:‐ All color‐sets in colorful paths of length i‐1 from s to v. (Note: Each color‐set would have exactly € i colors; and there can be at most C(k+1,i) such color‐sets. ) Color‐coding • Dynamic Programming algorithm • Proceeding from ith iteraon to (i+1)th iteraon:‐ • Consider a vertex, v ∈V. • Compare Color(v) with each of the color‐sets (each having i colors) of each of it’s neighbors. • All color‐sets (having i+1 colors that result in a colorful path of length i from s to v, now form the collecon of Color‐sets of v aer iteraon i+1.) • Repeat the above 2 steps for every vertex in V. Color‐coding • At the end of the algorithm: If there exists at least one color‐set for any vertex, v (corresponding to colorful paths of length k), then there exists a colorful path of length k between s and v. Converse is also true. Color‐coding • Dynamic Programming algorithm • Running me: • At each iteraon: O( C(k+1,i)*i*E) • Therefore, running me over all iteraons is: k k , which is . O(∑C(k +1,i)*i * E) O(k *2 * E) i=1 € The above is for finding colorful paths from a parcular € start vertex, under a given coloring. • We repeat the above procedure once for each vertex. • Therefore, running me is . O(k *2k *V * E) € Color‐coding • Queson: Are all simple paths of length k in the (uncolored) input graph G, preserved under a random coloring of the verces of G (using k+1 colors)? • i.e.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    52 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us