This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Sequence Alignment Data Structures and Algorithms Andrei Bulatov Algorithms – Sequence Alignment 202 Shortest Path: Finding Negative Cycles Two questions: how to decide if there is a negative cycle? how to find one? emma Lemma It suffices to find negative cycles C such that t can be reached from C t <0 <0 Algorithms – Sequence Alignment 203 Shortest Path: Finding Negative Cycles Proof Let G be a graph The augmented graph, A(G), is obtained by ding a new node and adding a new node and connecting every node in G with the new node As is easily seen, G contains a negative cycle if and only if A(G) contains a negative cycle C such that t is reachable from C QED t Algorithms – Sequence Alignment 204 Shortest Path: Finding Negative Cycles (cntd) Extend OPT(i,v) to i ≥ n If the graph G does not contain negative cycles then OPT(i,v) = OPT(n – 1,v) for all nodes v and all i ≥ n Indeed, it follows from the observation that every shortest path contains at most n – 1 arcs. Lemma There is no negative cycle with a path to t if and only if OPT(n,v) = OPT(n – 1,v) Proof If there is no negative cycle, then OPT(n,v) = OPT(n – 1,v) for all nodes v by the observation above Algorithms – Sequence Alignment 205 Shortest Path: Finding Negative Cycles (cntd) Proof (cntd) Suppose OPT(n,v) = OPT(n – 1,v) for all nodes v. Therefore OPT(n,v) = min{ OPT(n – 1,v), min { OPT(n – 1,w) + len(vw) }} min{ OPT(n,v), min { OPT(n,w) + len(vw) }} w ∈ V = min{ OPT(n,v), min { OPT(n,w) + len(vw) }} = OPT(n + 1,v) = …. However, if a negative cycle from which t is reachable exists, then w ∈ V∞ = ∞ → ) , ( lim v i OPT i Algorithms – Sequence Alignment 206 Shortest Path: Finding Negative Cycles (cntd) Let v be a node such that OPT(n,v) ≠ OPT(n – 1,v). A path P from v to t of weight OPT(n,v) must use exactly n arcs Any simple path can have at most n – 1 arcs, therefore P contains a cycle C emma Lemma If G has n nodes and OPT(n,v) ≠ OPT(n – 1,v), then a path P of weight OPT(n,v) contains a cycle C, and C is negative. Proof Every path from v to t using less than n arcs has greater weight. Let w be a node that occurs in P more than once. Let C be the cycle between the two occurrences of w Deleting C we get a shorter path of greater weight, thus C is negative Algorithms – Sequence Alignment 207 The Sequence Alignment Problem Question: How similar two words are? Say “ ocurrance ” and “ occurrence ” They are similar, because one can be turned into another by few anges changes oc urr a nce oc c urr e nce Clearly, this can be done in many ways, say oc urr a nce oc c urr e nce Problem: Minimize the “number” of gaps and mismatches gap mismatch Algorithms – Sequence Alignment 208 Alignments Let and be two strings A matching is a set of ordered pairs, such that an element of each set...
View
Full
Document
This note was uploaded on 11/19/2009 for the course CS CMPT 307 taught by Professor A.bulatov during the Fall '09 term at Simon Fraser.
 Fall '09
 A.BULATOV
 Algorithms, Data Structures

Click to edit the document details