GNN Maximum Flow Problem (From Shusen Wang)

2023-12-06 02:01

本文主要是介绍GNN Maximum Flow Problem (From Shusen Wang),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

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

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

在这里插入图片描述

- Procedure

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

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

在这里插入图片描述

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

在这里插入图片描述

在这里插入图片描述

这篇关于GNN Maximum Flow Problem (From Shusen Wang)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/459977

相关文章

csu 1446 Problem J Modified LCS (扩展欧几里得算法的简单应用)

这是一道扩展欧几里得算法的简单应用题,这题是在湖南多校训练赛中队友ac的一道题,在比赛之后请教了队友,然后自己把它a掉 这也是自己独自做扩展欧几里得算法的题目 题意:把题意转变下就变成了:求d1*x - d2*y = f2 - f1的解,很明显用exgcd来解 下面介绍一下exgcd的一些知识点:求ax + by = c的解 一、首先求ax + by = gcd(a,b)的解 这个

uva 10025 The ? 1 ? 2 ? ... ? n = k problem(数学)

题意是    ?  1  ?  2  ?  ...  ?  n = k 式子中给k,? 处可以填 + 也可以填 - ,问最小满足条件的n。 e.g k = 12  - 1 + 2 + 3 + 4 + 5 + 6 - 7 = 12 with n = 7。 先给证明,令 S(n) = 1 + 2 + 3 + 4 + 5 + .... + n 暴搜n,搜出当 S(n) >=

GNSS CTS GNSS Start and Location Flow of Android15

目录 1. 本文概述2.CTS 测试3.Gnss Flow3.1 Gnss Start Flow3.2 Gnss Location Output Flow 1. 本文概述 本来是为了做Android 14 Gnss CTS 的相关环境的搭建和测试,然后在测试中遇到了一些问题,去寻找CTS源码(/cts/tests/tests/location/src/android/locat

leetcode#628. Maximum Product of Three Numbers

题目 Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3]Output: 6 Example 2: Input: [1,2,3,4]Output: 24 Note: The lengt

Understanding the GitHub Flow

这里看下Github的入门介绍    --链接 GitHub Flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly. This guide explains how and why GitHub Flow works

11991 - Easy Problem from Rujia Liu?

题意: 输入一串整型数列,再输入两个数k,v,输出第k个v的序号。不存在则输出0,如第一个样例 8 41 3 2 2 4 3 2 11 3 //第1个3,序号为2,输出22 4 //第2个4,不存在,输出03 2 //第3个2,序号为7,输出74 2 思路: struct num {

GNN中的Over-smoothing与Over-squashing问题

Over-squashing (过度压缩,顾名思义就是数据被“压缩”的过分小了,导致学不到什么东西。) 1、 why 会被压缩的过分小? 可能因为网络过深,那么在多层传播后,信息可能会被过度压缩(本质是特征减少了,当层数过多时会大大杂糅信息,导致特征减少,输出维度过小也会),导致细节丢失。 2、why 学不到什么东西? 会加剧梯度消失的现象,导致早期层几乎不学习,从而使得输入信息的重要细

HDU 1016 Prime Ring Problem (深搜)

OJ题目 : click here ~~ 大概题意:n个数,形成一个环,使得相邻两个数的和为素数。以1开始,按字典序输出序列。 很简单的深搜。 AC_CODE int n;int visit[22];int num[22];int len;bool Is_prime(int x){for(int i = 2;i*i <= x;i++)if(x%i == 0) return

Versioned Staged Flow-Sensitive Pointer Analysis

VSFS 1.Introduction2.Approach2.1.相关概念2.2.VSFS 3.Evaluation参考文献 1.Introduction 上一篇blog我介绍了目前flow-sensitive pointer analysis常用的SFS算法。相比IFDS-based方法,SFS显著通过稀疏分析提升了效率,但是其内部依旧有许多冗余计算,留下了很大优化空间。 以

Maximum likelihood function maximizes what thing?

最大似然函数(Maximum Likelihood Function)最大化的是数据在给定参数下出现的概率。具体来说,它最大化的是似然函数(Likelihood Function),即给定参数 ( \theta ) 下观测数据的概率。在统计学中,似然函数 ( L(\theta) ) 通常定义为所有独立观测数据点概率的乘积,对于参数 ( \theta ) 的函数。 对于一组独立同分布的观测数据