GNN Maximum Flow Problem (From Shusen Wang)

Maximum Flow Problem

ShusenWang 图数据结构和算法课程笔记 Slides

  • Maximum Flow Problem
    • Description
      GNN Maximum Flow Problem (From Shusen Wang)_第1张图片

GNN Maximum Flow Problem (From Shusen Wang)_第2张图片

GNN Maximum Flow Problem (From Shusen Wang)_第3张图片

  • Naive Algorithm
    • Residual = Capacity - Flow
    • Left: Original Graph
    • Right: Residual Graph
      GNN Maximum Flow Problem (From Shusen Wang)_第4张图片

GNN Maximum Flow Problem (From Shusen Wang)_第5张图片

- Bottleneck capacity = 2

GNN Maximum Flow Problem (From Shusen Wang)_第6张图片

GNN Maximum Flow Problem (From Shusen Wang)_第7张图片

- Iteration 2:
  - Find an augmenting path: s -> v_1 -> v_3 -> t
  - Update residuals

GNN Maximum Flow Problem (From Shusen Wang)_第8张图片

  - Remove saturated edge
- Iteration 3:
  - Find an augmenting path: s -> v_1 -> v_4 -> t
  - Update residuals

GNN Maximum Flow Problem (From Shusen Wang)_第9张图片

  - Remove saturated edge
- Iteration 4:
  - Cannot find an augmenting path: end of procedure
- Summay
  - Inputs: a weighted directed graph, the source , and the sink .
  - Goal: Send as much water as possible from  to 
  - Constraints:
    - Each edge has a weight (i.e., the capacity of the pipe).
    - The flow must not exceed capacity.
  - naïve algorithm
    - Build a residual graph; initialize the residuals to the capacity. 
    - While augmenting path can be found: 
      - a. Find an augmenting path (on the residual graph.) 
      - b. Find the bottleneck capacity  in the augmenting path. 
      - c. Update the residuals. (residual ← residual − .)
  - The naïve algorithm can fail
    - The naïve algorithm always finds the blocking flow.
    - However, the outcome may not be the maximum flow.
  • Ford-Fulkerson Algorithm
    • Problem with the naïve algorithm
      GNN Maximum Flow Problem (From Shusen Wang)_第10张图片

    • Procedure
      GNN Maximum Flow Problem (From Shusen Wang)_第11张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第12张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第13张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第14张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第15张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第16张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第17张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第18张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第19张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第20张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第21张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第22张图片
      GNN Maximum Flow Problem (From Shusen Wang)_第23张图片

    • Worst-Case Time Complexity
      GNN Maximum Flow Problem (From Shusen Wang)_第24张图片

    • Summary

      • Ford-Fulkerson Algorithm
        • Build a residual graph; initialize the residuals to the capacities
        • While augmenting path can be found:
          • Find an augmenting path (on the residual graph.)
          • Find the bottleneck capacity on the augmenting path.
          • Update the residuals. (residual ← residual − .)
          • Add a backward path. (Along the path, all edges have weights of .)
      • Time complexity: (⋅). ( is the max flow; is #edges.)
  • Edmonds-Karp Algorithm
    • Procedure
      • Build a residual graph; initialize the residuals to the capacities.
      • While augmenting path can be found:
        • Find the shortest augmenting path (on the residual graph.)
        • Find the bottleneck capacity on the augmenting path.
        • Update the residuals. (residual ← residual − .)
        • Add a backward path. (Along the path, all edges have weights of .)
    • Note: Edmonds-Karp algorithm uses the shortest path from source to sink. (Apply weight 1 to all the edges of the residual graph.)
    • Time complexity: O ( m 2 ⋅ n ) O(m^2 \cdot n) O(m2n) . (m is #edges; n is #vertices.)
  • Dinic’s Algorithm
    • Time complexity: O ( m ⋅ n 2 ) O(m \cdot n^2) O(mn2) . (m is #edges; n is #vertices.)

    • Key Concept: Blocking Flow
      GNN Maximum Flow Problem (From Shusen Wang)_第25张图片

    • Key Concept: Level Graph
      GNN Maximum Flow Problem (From Shusen Wang)_第26张图片

GNN Maximum Flow Problem (From Shusen Wang)_第27张图片

- Procedure

GNN Maximum Flow Problem (From Shusen Wang)_第28张图片

GNN Maximum Flow Problem (From Shusen Wang)_第29张图片

GNN Maximum Flow Problem (From Shusen Wang)_第30张图片

GNN Maximum Flow Problem (From Shusen Wang)_第31张图片

GNN Maximum Flow Problem (From Shusen Wang)_第32张图片

GNN Maximum Flow Problem (From Shusen Wang)_第33张图片

GNN Maximum Flow Problem (From Shusen Wang)_第34张图片

GNN Maximum Flow Problem (From Shusen Wang)_第35张图片

GNN Maximum Flow Problem (From Shusen Wang)_第36张图片

GNN Maximum Flow Problem (From Shusen Wang)_第37张图片

  - On the level graph, no flow can be found!
  - End of Procedure

GNN Maximum Flow Problem (From Shusen Wang)_第38张图片

- Summary
  1. Initially, the residual graph is a copy of the original graph. 
  2. Repeat: 
    1. Construct the level graph of the residual graph. 
    2. Find a blocking flow on the level graph. 
    3. Update the residual graph (update the weights, remove saturated edges, and add backward edges.)
- Time complexity: $O(m \cdot n^2)$ . (m is #edges; n is #vertices.)
  • Minimum Cut Problem
    • statement
      GNN Maximum Flow Problem (From Shusen Wang)_第39张图片

GNN Maximum Flow Problem (From Shusen Wang)_第40张图片

GNN Maximum Flow Problem (From Shusen Wang)_第41张图片

  - Capacity (S, T) = sum of weights of the edges leaving S.
  - In the figure, three edges leave S.
    - Capacity (S,T) = 2 + 2 + 2 = 6

GNN Maximum Flow Problem (From Shusen Wang)_第42张图片

- Max-Flow Min-Cut Theorem
  - In a flow network, the maximum amount of flow from s to t is equal to the capacity of the minimum s-t cut.
  - In short, amount of max-flow = capacity of min-cut.

GNN Maximum Flow Problem (From Shusen Wang)_第43张图片

- Algorithm
  - Run any max-flow algorithm to obtain the final residual graph.
    - E.g., Edmonds–Karp        algorithm or Dinic’s algorithm.
    - Ignore the backward edges on the final residual graph
  - Find the minimum s-t cut (S,T) :
    - On the residual graph, find paths from source  to all the other vertices.
    - S ← all the vertices that have finite distance. (Reachable from s.)
    - T ← all the remaining vertices. (Not reachable from s.)
- Example

GNN Maximum Flow Problem (From Shusen Wang)_第44张图片

GNN Maximum Flow Problem (From Shusen Wang)_第45张图片

你可能感兴趣的:(图神经网络,笔记,图神经网络)