COMS 482: unofficial class blog

Lecture 16: More Network Flow

Posted in Class Notes by Elliott Back on February 28th, 2005.

Ford-Fulkerson Algorithm:

ford_fulkerson(G, s, t, capacity):
    f[e] = 0 for all e
    while there exists an s -> t path in the residual graph
        choose a path p
        f = augment(f, p)
        update residual graph
    Endwhile

augment(f, path):
    c = lowest capacity on path
    for each edge e on path
        if e if a forward edge
            f[e] += c
        if e is a backwards edge
            f[e] -= c
    Endfor

Termination:

Every time we find a path, the flow on s increases by at least 1 each time (assuming integer capacities). There is also a maximum possible flow from s, equal to C = sum( ce ) of e out of s = fout(s). We can find a path at most C times, so the total time = O( C * work to find and update path) = O(m*C).

Application: Bipartite Matching:

A Bipartite Matching is defined as V= X + Y where X & Y = {} and for all edges (a, b) in V, a is in X and b is in Y. Imagine wanting to assign people and tasks. You can create a network flow diagram for this:

Bipartite Matching: Network Flow

Here, we draw an edge between a person and a task iff that person can perform said task. Then, running the flow algorithm will assign 1 person to every task, or find the best possible match. This runs in O(m*n) time, where m is the number of edges and n is the number of vertices.

This entry was posted on Monday, February 28th, 2005 at 4:32 pm and is tagged with ford fulkerson, flow algorithm, nbsp nbsp nbsp nbsp nbsp, network flow, c times, forward edge, flow diagram, c application, fout, graph, match, ford. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

2 Responses to “Lecture 16: More Network Flow”

  1. Ivan G. says:

    “A Bipartite Matching is defined as V= X + Y where X & Y = {} and for all edges (a, b) in V, a is in X and b is in Y.”

    … your shorthand notation for set operations isn’t making any sense – does
    this mean that X and Y are disjoint sets, whose union is V?

    Furthermore this is wrong, since (a,b) cannot be in V (which is a vertex set).
    Perhaps you mean E.

  2. I’m using + to mean union and & to mean intersection here, since V and ^ are ugly and the real operators are hard to draw. What this means is V = X union Y, where X and Y are disjoint. Also, you can define an edge in a graph by two endpoint vertices (a, b). All that says is that all edges are between the sets X and Y.

Leave a Reply

Powered by WP Hashcash