Network%20Flows - PowerPoint PPT Presentation

About This Presentation
Title:

Network%20Flows

Description:

Bipartite Cardinality Matching Problem ... Bipartite Matching Algorithm ... Bipartite network satisfy it; nonbipartite network doesn't satisfy it. Flower and Blossoms ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 51
Provided by: DEN153
Category:

less

Transcript and Presenter's Notes

Title: Network%20Flows


1
Network Flows
  • Chun-Ta, Yu
  • Graduate Institute
  • Information Management Dept.
  • National Taiwan University

2
Chapter 12
  • ASSIGHMENTS AND MATCHINGS

3
Outline
  • Introduction
  • Bipartite Cardinality Matching Problem
  • Bipartite Weighted Matching Problem
  • Stable Marriage Problem
  • Nonbipartite Cardinality Matching Problem

4
Introduction
  • Bipartite matching problem
  • The cardinality problem
  • The weighted problem
  • Stable marriage problem
  • Nonbipartite matching problem

5
Bipartite Cardinality Matching Problem
  • Transform this problem into a maximum flow
    problem in a simple network
  • Each arc has a unit capacity and each node has an
    indegree of at most 1 or an outdegree of at most
    1
  • Introduce a source node s and a sink node t
  • Solving this problem at worst-case

6
Bipartite Cardinality Matching Problem
7
Bipartite Weighted Matching Problem
  • Assignment problem
  • Given a weighted bipartite network

8
Bipartite Weighted Matching Problem
  • The assignment problem can be viewed as
    adaptation of algorithm for the minimum cost flow
    problem
  • Four algorithm to solve
  • Successive Shortest Path Algorithm
  • Hungarian Algorithm
  • Relaxation Algorithm
  • Cost Scaling Algorithm

9
Successive Shortest Path Algorithm
  • Discuss in section 9.7
  • Augment 1 unit flow in every iteration
  • Let S( n ,m ,C) denote the time needed to solve a
    shortest path problem with nonnegative arc
    lengths and n1N1
  • The algorithm would terminate within n1
    iterations and would require O(n1S( n ,m ,C))

10
Hungarian Algorithm
  • Discuss in section 9.7, primal-dual algorithm
  • With a single supply node s and a single demand
    node t.At every iteration ,the primal-dual
    algorithm computes shortest path distance from s
    to all other nodes
  • The algorithm would terminate within n1
    iterations and would require O(n1S( n ,m ,C))

11
Relaxation Algorithm
  • Closely related to the successive shortest path
    algorithm
  • Relax the constraint
  • thus allowing any node in N2 to be assigned
    to more than one node in N1
  • Overall running time O(n1S( n ,m ,C))

12
Stable Marriage Problem
  • A certain community consists of n men and n
    women. Each person ranks those of the opposite
    sex in accordance with his or her preferences for
    a spouse.
  • Unstable if man-woman are not married to each
    other but prefer each other to their current
    spouses
  • For any set of rankings, we can always find a
    stable matching in O(n2) time

13
Stable Marriage Problem
  • The input to the stable marriage problem consists
    of two n x n matrices.
  • Each rank is an integer between 1 and n
  • Priority list is a vector of n elements for each
    person, can be sorted using bucket sort in O(n2)
    time

14
Stable marriage algorithm
  • Propose-and-reject algorithm
  • Time complexity
  • Each iteration each woman receiving a proposal
    either (1) receives her first proposal (2)
    rejects some proposal
  • Each woman rejects any mans proposal at most
    once, so total rejection times is (n-1) for each
    woman
  • Total time is O(n2)
  • Man-optimal matching

15
Nonbipartite Cardinality Matching Problem
  • Alternating Paths
  • We refer to a path Pi1-i2-ik in the graph as an
    alternating path with respect to a matching M if
    every consecutive pair of arcs in the path
    contains one matched and one unmatched arc
  • ex1-2-4-3-5

16
Nonbipartite Cardinality Matching Problem
  • Augmenting Paths
  • We refer to an odd alternating path P with
    respect to matching M as an augmenting path if
    the first and last nodes in the path are
    unmatched
  • ex1-2-4-3-5-6
  • Interchanging the matched and unmatched arcs on
    augmenting paths can add one more cardinality

17
Symmetric Difference
  • Let S1 and S2 be two sets the symmetric
    difference of these sets, denoted S1?S2, is the
    set S1?S2 (S1?S2)-(S1nS2)
  • for example, S1 4,5,7,8 and S2 2,4,8,9
    , then S1?S2 2,5,7,9

18
Property 12.6
  • If M is a matching and P is an augmenting path
    with respect to M, then M?P is a matching of
    cardinality M 1. Moreover, in the matching
    M?P, all the matched nodes in M remain matched
    and two additional nodes, namely the first and
    last nodes of P, are matched

19
Property 12.7
  • If M and M are two matchings, their symmetric
    difference defines the subgraph G (N, M?M)
    with the property that every component is one of
    the six types shown in Figure 12.7

20
(No Transcript)
21
Augmenting Path Theorem
  • If a node p is unmatched in a matching M, and
    this matching contains no augmenting path that
    starts at node p, then node p is unmatched in
    some maximum matching.

22
Bipartite Matching Algorithm
  • Start with a feasible matching M (which might be
    a null matching) and then repeat the following
    step for every unmatched node
  • Try to identify an augmenting path starting at
    node p. If we find such a path P, replace M with
    M?P otherwise, delete node p and all the arcs
    incident to it from the graph

23
Bipartite Matching Algorithm
  • Search algorithm

24
Bipartite Matching Algorithm
25
(No Transcript)
26
Bipartite Matching Algorithm
  • Time complexity
  • The search algorithm execute at most n times
  • For each node i, the search procedure performs
    one of the following two operations at most once
    (1) examine-even (2) examine-odd, the former
    operation require O(A(i)) time, about O(m)
  • Total time O(nm)

27
Unique label property
  • A graph is said to possess a unique label
    property with respect to a given matching M and a
    root node p if the search procedure assigns a
    unique label to every labeled node irrespective
    of the order in which it examines labeled nodes

28
  • Bipartite network satisfy it nonbipartite
    network doesnt satisfy it

29
Flower and Blossoms
  • A flower, defined with respect to a matching M
    and a root node p, is a subgraph with two
    components
  • Stem. A stem is an even length alternating path
    that starts at the root node p and terminates at
    some node w. We permit the possibility that p
    w, in which case we say that the stem is empty
  • Blossom. A blossom is an odd length alternating
    cycle that starts and terminates at the terminal
    node w of a stem and has no other node in common
    with the stem. We refer to node w as the base of
    the blossom

30
Flower and Blossoms
31
Property 12.9
  1. A stem spans 2l1 nodes and contains l matched
    arcs for some integer l?0
  2. A blossom spans 2k1 nodes and contains k matched
    arcs for some integer k?1. The matched arcs match
    all nodes of the blossom except its base
  3. The base of blossom is an even node

32
Property 12.10
  • Every node i in the blossom (except its base) is
    reachable from the root (or from the base of the
    blossom) through two distinct alternating paths.
    One has even length and the other has odd length

33
Contracting a Blossom
  • Introduce a new node b (pseudonode) and define
    its adjacency list A(b) A(i1)?A(i2)? ?A(jk)
  • Update the adjacency list of every node
  • by executing A(j)A(j)?b
  • To be able to recover, set contracted node to
    inactive mode

34
(No Transcript)
35
(No Transcript)
36
Nonbipartite matching algorithm
37
Nonbipartite matching algorithm-- Find a
augmenting path
38
Complexity of nonbipartite matching algorithm
  • Lemma 12.13
  • During an execution of the search procedure, the
    algorithm performs at most n/2 contractions
  • Since each contraction adds at most one element
    to any adjacency list (the pseudonode), and since
    the algorithm performs at most n/2 contractions,
    no adjacency list will ever contain more than
    3n/2
  • Each search procedure performs one of the
    following operation at most once (1)it discovers
    that node i is inactive (2)examine-odd(3)examine-e
    ven, (3) require Ac(i)?3n/2, so running time is
    O(n2)
  • Total time complexity O(n3)

39
Chapter 13
  • MINIMUM SPANNING TREES

40
Outline
  • Introduction
  • Optimality Condition
  • Kruskals Algorithm
  • Prims Algorithm
  • Sollins Algorithm

41
Introduction
42
Optimality Condition
  • Cut Optimality Conditions
  • A Spanning tree T is a minimum spanning tree if
    and only if it satisfies the following cut
    optimality condition For every tree arc
    ,
  • cij?ckl for every arc (k, l) contained in the
    cut formed by deleting arc (i, j) from T

43
Optimality Condition
  • Path Optimality Conditions
  • A spanning tree T is a minimum spanning tree if
    and only if it satisfies the following path
    optimality conditions For every nontree arc (k,
    l) of G, cij?ckl for every arc (i, j) contained
    in the path in T connecting nodes k and l

44
Kruskals Algorithm
  • Time Complexity O(mn )

45
Prims Algorithm
  • Time Complexity O(m log n)

46
Sollins Algorithm
  • Time Complexity O(m log n)

47
Summary of minimum spanning tree algorithm
48
Matroids and the Greedy Algorithm
  • Independenta subset I of objects do not form a
    cycle in the network
  • Subset System (E, ?)a finite set of objects E
    and nonempty collection ? of subsets of these
    objects
  • Matroida subset system satisfies the growth
    property that if Ip and Ip1 are independent sets
    containing p and p1 elements, we always can find
    an element , satisfying the
    property that Ip?e is an independent set

49
Matroids and the Greedy Algorithm
  • Maximal independent setan independent set I
    satisfying the property that we cannot add any
    other element e to I and produce another
    independent set
  • Greedy algorithm

50
Thank You!
Write a Comment
User Comments (0)
About PowerShow.com