Algorithm Analysis (CSC 301 2015F) : EBoards

CSC301.01 2015F, Class 30: Network Flows


Overview

Preliminaries

Admin

Extra Credit

Academic

Peer

Questions

All-pairs shortest path, continued

Make a matrix of all minimum-path lengths between two vertices.

Negative edge weights permitted, no negative cycles.

The Floyd-Warshall algorithm

Build a series of matrices. Matrix k gives shortest paths involving only intermediate nodes numbered 1 .. k.

How do we build matrix k+1 from matrix k?

  for (i = 1 to n)
    for (j = 1 to n)
      M(k+1)[i,j] = min(M(k)[i,k] + M(k)[k,j], M(k)[i,j])

What's the algorithm?

for (k = 1 to n)
  for (i = 1 to n)
    for (j = 1 to n)
      M(k+1)[i,j] = min(M(k)[i,k] + M(k)[k,j], M(k)[i,j])

Why?

The max-flow problem

Treat the graph as a network. Edges are capacities.

Give a source and a target, find the maximum "flow" from the source to the target.

Augmenting paths

Find a path from source to target. (augmenting path) Find the smallest size of an edge on that path For each edge on that path Decrement the edge in the original graph Increment the corresponding edge in the flow graph

INCORRECT!

The Ford-Fulkerson algorithm

Bipartite matching