GNN Maximum Flow Problem (From Shusen Wang)

2023-12-13 23:06:24

Maximum Flow Problem

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

  • Maximum Flow Problem
    • Description
      在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  • Naive Algorithm
    • Residual = Capacity - Flow
    • Left: Original Graph
    • Right: Residual Graph
      在这里插入图片描述

在这里插入图片描述

- Bottleneck capacity = 2

在这里插入图片描述

在这里插入图片描述

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

在这里插入图片描述

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

在这里插入图片描述

  - 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
      在这里插入图片描述

    • Procedure
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述
      在这里插入图片描述

    • Worst-Case Time Complexity
      在这里插入图片描述

    • 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(m2?n) . (m is #edges; n is #vertices.)
  • Dinic’s Algorithm
    • Time complexity: O ( m ? n 2 ) O(m \cdot n^2) O(m?n2) . (m is #edges; n is #vertices.)

    • Key Concept: Blocking Flow
      在这里插入图片描述

    • Key Concept: Level Graph
      在这里插入图片描述

在这里插入图片描述

- Procedure

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

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

在这里插入图片描述

- 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
      在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  - 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

在这里插入图片描述

- 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.

在这里插入图片描述

- 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

在这里插入图片描述

在这里插入图片描述

文章来源:https://blog.csdn.net/weixin_45347752/article/details/134819223
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。