cs lunch this week
play

CS Lunch This Week Lunch with the Chair! Wednesday, Kendade 307 2 - PowerPoint PPT Presentation

1 CS Lunch This Week Lunch with the Chair! Wednesday, Kendade 307 2 Sequence Alignment: Algorithm Alignment(m, n, x 1 x 2 ...x m , y 1 y 2 ...y n , , ) { for i = 0 to m M[i, 0] = i for j = 0 to n M[0, j] = j for i = 1 to m for j


  1. 1 CS Lunch This Week Lunch with the Chair! Wednesday, Kendade 307 2 Sequence Alignment: Algorithm Alignment(m, n, x 1 x 2 ...x m , y 1 y 2 ...y n , δ , α ) { for i = 0 to m M[i, 0] = i δ for j = 0 to n M[0, j] = j δ for i = 1 to m for j = 1 to n M[i, j] = min( α [x i, y j ] + M[i-1, j-1], δ + M[i-1, j], δ + M[i, j-1]) return M[m, n] } 3-1 Sequence Alignment What if the sequences have 100,000 characters or more, as a gene sequence might? Slides19 - Network Flow Intro.key - April 15, 2019

  2. 3-2 Sequence Alignment What if the sequences have 100,000 characters or more, as a gene sequence might? Too much memory! 3-3 Sequence Alignment What if the sequences have 100,000 characters or more, as a gene sequence might? Too much memory! Textbook shows an algorithm that combines dynamic programming with divide and conquer Dynamic programming is used to remember the answers to subproblems Divide and conquer is used to compute the answer using less memory 4 Soviet Rail Network, 1955 Reference: On the history of the transportation and maximum flow problems . 
 Alexander Schrijver in Math Programming, 91: 3, 2002. Slides19 - Network Flow Intro.key - April 15, 2019

  3. 5 Flow Networks Flow network. Abstraction for material flowing through the edges. G = (V , E) = directed graph Two distinguished nodes: s = source, t = sink. 5 2 9 10 15 15 10 4 t sink s source 5 3 8 6 10 15 4 6 10 15 capacity 4 30 7 6 Flows An s-t flow is a function that satisfies: Capacity condition: For each e ∈ E: 0 ≤ f(e) ≤ c(e) Conservation condition: For each v ∈ V – {s, t}: 
 ∑ f(e) = ∑ f(e) e into y e out of y 0 5 2 9 0 0 0 4 10 flow = 4 15 15 10 4 0 0 0 s t sink source 3 5 8 6 10 0 4 0 4 0 6 15 10 15 4 4 30 7 0 7 Flows The value of a flow f is: v(f) = ∑ f(e) e out of s 0 value = 4 5 2 9 0 0 0 4 10 15 15 flow = 4 10 4 0 0 0 t sink s source 5 3 8 6 10 0 4 15 0 4 0 6 10 15 4 4 30 7 0 Slides19 - Network Flow Intro.key - April 15, 2019

  4. 8 Flows The value of a flow f is: v(f) = ∑ f(e) e out of s 9 value = 24 5 2 9 0 9 1 0 10 15 15 flow = 10 10 4 4 6 6 t sink s source 5 3 8 6 10 0 9 15 10 4 1 6 10 15 0 4 30 7 10 9 Maximum Flow Problem Find s-t flow of maximum value. 9 value = 28 5 2 9 0 9 0 1 10 flow = 10 15 15 10 4 5 8 9 s t sink source 3 5 8 6 10 0 10 13 4 3 6 15 10 15 0 4 30 7 13 10 Residual Graph u 17 v Original edge: e = (u, v) ∈ E. 6 Flow f(e) = 6, capacity c(e) = 17 . Residual edges. residual e = (u, v) with capacity c(e) - f(e) capacity AND e R = (v, u) with capacity f(e) u 11 v 6 Residual graph: G f = (V , E f ). Residual edges with positive residual capacity. E f = {e : f(e) < c(e)} ∪ {e R : f(e) > 0}. Slides19 - Network Flow Intro.key - April 15, 2019

  5. 11 Augmenting Path Algorithm Ford-Fulkerson(G, s, t, c) { foreach e ∈ E f(e) ← 0 // initially, no flow G f ← G // initially, the residual 
 // graph is the original graph while (there exists an s-t path P in G f ) { f ← Augment(f, c, P) // change the flow update G f // build a new residual graph } return f } Augment(f, c, P) { / / edge on P with least capacity b ← bottleneck(P) foreach e ∈ P { / / forward edge, increase flow in G if (e ∈ E) f(e) ← f(e) + b else { / / reverse edge, decrease flow in G let e be the forward edge corresponding to e R f(e) ← f(e) - b } return f } Slides19 - Network Flow Intro.key - April 15, 2019

Recommend


More recommend