96
MST and Max Flow CS3233

MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Embed Size (px)

Citation preview

Page 1: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

MST and Max Flow

CS3233

Page 2: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Overview

Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut

ProblemOne Data Structure

Disjoint Sets

Page 3: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Minimum Spanning Tree

Prim’s and Kruskal’s Algorithm

Page 4: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Spanning Tree

Page 5: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Minimum Spanning TreeGiven a graph G, find a spanning

tree where total cost is minimum.

Page 6: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

4

Page 7: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 8: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 9: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 10: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 11: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 12: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 13: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 14: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 15: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 16: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 17: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 18: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

3

1

2 1

2

1 23

1

3

4

Page 19: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Greedy Algorithmcolor all vertices yellowcolor the root redwhile there are yellow vertices

pick an edge (u,v) such thatu is red, v is yellow & cost(u,v) is

mincolor v red

Page 20: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Why Greedy Works?

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 21: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Why Greedy Works?

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 22: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Why Greedy Works?

1 3

3

4

3

3

45 3

Page 23: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Prim’s Algorithm

foreach vertex vv.key =

root.key = 0pq = new PriorityQueue(V)while pq is not empty

v = pq.deleteMin()foreach u in adj(v)

if v is in pq and cost(v,u) < u.key pq.decreaseKey(u, cost(v,u))

Page 24: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Complexity: O((V+E)log V)

foreach vertex vv.key =

root.key = 0pq = new PriorityQueue(V)while pq is not empty

v = pq.deleteMin()foreach u in adj(v)

if v is in pq and cost(v,u) < u.key pq.decreaseKey(u, cost(v,u))

Page 25: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 26: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 27: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 28: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 29: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 30: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 31: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 32: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1 3

4

2

3

1 4

2 3

1 4 23

451

4 3

43

Page 33: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

3

1

2

3

1

2

1 2

1

3

4

Page 34: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Kruskal’s Algorithm

while there are unprocessed edges left pick an edge e with minimum cost if adding e to MST does not form a

cycle add e to MST else throw e away

Page 35: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Data Structures

How to pick edge with minimum cost? Use a Priority Queue

How to check if adding an edge can form a cycle? Use a Disjoint Set

Page 36: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Disjoint Set Data Structure

Union/Find

Page 37: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Overview

Page 38: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Operation Union

Page 39: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Operation Find

A

B

C

Page 40: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Application: Kruskal’s

Initialize: Every vertex is one partitionwhile there are unprocessed edges left

pick edge e = (u,v) with minimum cost// if adding e to MST does not form a cycle

if find(u) != find(v)add e to MSTunion(u, v)

elsethrow e away

Page 41: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Application: Maze Generation

Page 42: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Algorithm

Starts with walls everywhereRandomly pick two adjacent cellsKnock down the wall if they are not

already connectedRepeat until every cell is

connected

Page 43: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

GenerateMaze(m,n)

toKnock = mn-1while toKnock != 0

pick two adjacent cells u and v if find(u) != find(v)

knock down wall between u and v

union(u,v)toKnock = toKnock - 1

Page 44: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

How to implement?

typedef struct item {struct item *parent;

int data;} item;

A B C D

Page 45: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Union(A, B)

A

B

C D

Page 46: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Union(A, C)

A

B

C

D

Page 47: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Union(D, B)

A

B

C

D

Page 48: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Union(A, B)

// find root of A// set parent of root of A to B

curr = Awhile (curr.parent != NULL)

curr = curr.parentcurr.parent = B

Page 49: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Find(A)

// return root of A

curr = Awhile curr.parent != NULL

curr = curr.parentreturn curr

Page 50: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

How to make find faster?Reduce the length of path to root!

union-by-rank path compression

Page 51: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Union by Rank (A, B)

rootA = root of ArootB = root of Bif tree of rootA is shorter

rootA.parent = rootBelse

rootB.parent = rootA

Page 52: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

find(A) with Path Compressionif A.parent != NULL

A.parent = find(A.parent)return A.parent

else return A

Page 53: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Path Compression

Before After

Page 54: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Review

Minimum Spanning TreePrim’s and Kruskal’s AlgorithmUnion-Find Data Structure

Page 55: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Variations

Does Prim and Kruskal works with negative weights?

How about Maximum Spanning Tree?

Page 56: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Max Flow/Min Cut

Page 57: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Problem

Page 58: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Definitions

7Capacity

SinkSource

Page 59: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

A Flow

7

3

2

5

Page 60: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

A Cut

Page 61: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Capacity/Flow Across A Cut

Page 62: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Problem

Find a cut with minimum capacity

Find maximum flow from source to sink

Page 63: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

More Definition: Residual Graph

7

3

2

5

2

5

Page 64: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Augmenting Path

A path from source to sink in the residual graph of a given flow

Page 65: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Idea

If there is an augmenting path in the residual graph, we can push more flow

Page 66: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Ford-Fulkerson Method

initialize total flow to 0residual graph G’= Gwhile augmenting path exist in G’

pick a augmenting path P in G’ m = bottleneck capacity of P add m to total flow push flow of m along P update G’

Page 67: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

12

1

1

1

11

1

1

12

2

2

2

4

3 3

3

3

3

4

4

Page 68: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

12

1

1

1

11

1

1

12

2

2

2

4

3 3

3

3

3

4

4

Page 69: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

12

1

1

1

11

1

1

12

1

2

2

3

3 3

3

3

3

3

4

111

Page 70: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

12

1

1

1

11

1

1

12

1

2

2

3

3 3

3

3

3

3

4

111

Page 71: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

12

1

1

1

11

1

1

12

1

2

2

3

1 3

1

1

3

3

4

111

Page 72: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

12

1

1

1

11

1

1

12

1

2

2

3

1 3

1

1

3

3

4

111

Page 73: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Example

11

1

1

1

11

1

1

12

2

2

2

1 3

1

1

3

2

3

222

Page 74: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Answer: Max Flow = 4

11

2

2

2

2

2

2

2

12

Page 75: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Answer: Minimum Cut = 4

12

1

1

1

11

1

1

12

2

2

2

4

3 3

3

3

3

4

4

Page 76: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Find Augmenting Path?

initialize total flow to 0residual graph G’= Gwhile augmenting path exist in G’

pick a augmenting path P in G’ m = bottleneck capacity of P add m to total flow push flow of m along P update G’

Page 77: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Picking Augmenting Path Edmonds-Karp’s Heuristics

I. Find a path with maximum bottleneck capacity

II. Find a path with minimum length

Page 78: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Variations

How about Maximum Cut?

Page 79: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Applications for MaxFlow/MinCut

Page 80: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Application: Bipartite MatchingMarriage Problem

BTW, how to determine if a graph is bipartite?

Page 81: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

A Matching

Page 82: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Maximum Matching

Page 83: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Maximum Flow Problem

Page 84: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Maximum Flow/Matching

Page 85: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Minimum Vertex Cover Bipartite Graph

5 2 1 2 4

3 2 3 4 2

Page 86: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

A Vertex Cover (W=15)

5 2 1 2 4

3 2 3 4 2

Page 87: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Maximum Flow

5 2 1 2 4

3 2 3 4 2

Page 88: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Finite Cut = Vertex Cover

5 2 1 2 4

3 2 3 4 2

Page 89: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Finite Cut = Vertex Cover

Page 90: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Problems..

Page 91: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Problem 1: Optimal Protein SequenceGiven a 2D geometric structure of

a protein, with n residuals

Page 92: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Optimal Protein SequenceEach residual can be either

hydrophobic (H) or polar (P)

Page 93: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Optimal Sequence

Each residual has a “solvent area”Want to reduce solvent areas of Hs

Want to increase pairs of Hs in close contacts

Page 94: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Optimal Sequence

Assign H, P to the residuals to minimize

d(i,j): 1 if H at position i and H at position j is close enough, 0 otherwise

s(i) : area exposed at position i

HH SiSji

isβjidα )(),(,

Page 95: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Problem 2: Forest Clearence

5 10

8 12

profit forcutting trees

cannot cleartwo adjacentsquare!

which squares to clear to maximize profit?

Page 96: MST and Max Flow CS3233. Overview Two Graph Problems Minimum Spanning Tree Maximum Flow/Minimum Cut Problem One Data Structure Disjoint Sets

Problem 3: All-Pair Maximum Bottleneck Bandwidth PathGiven a graph, how to find the

maximum bottleneck bandwidth path between any two nodes, u and v, efficiently?