Network Flows: Max-Flow Min-Cut Theorem (& Ford-Fulkerson Algorithm)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2019
  • Free 5-Day Mini-Course: backtobackswe.com
    Try Our Full Platform: backtobackswe.com/pricing
    📹 Intuitive Video Explanations
    🏃 Run Code As You Learn
    💾 Save Progress
    ❓New Unseen Questions
    🔎 Get All Solutions
    Flow Networks: en.wikipedia.org/wiki/Flow_ne...
    Ford-Fulkerson Algorithm: en.wikipedia.org/wiki/Ford%E2...
    Max-Flow Min-Cut Theorem: en.wikipedia.org/wiki/Max-flo...
    Proofs: Reference "Algorithm Design" by Jon Kleinberg and Éva Tardos Chapters 7.1, 7.2 for excellent proofs on all of this.
    Things I'd Improve On This Explanation (w/ More Time):
    1.) I should have done a walk-through showing how the residual graph dictates how the original graph's edge flows (f(e)) are updated each iteration. (That would've made it more clear how the residual graph in the Ford-Fulkerson algorithm tells us how to update the flow on each edge (f(e)) in the original graph along the s-t path P, THEN we update the residual graph (also along P) to prepare for the next iteration.)
    2.) Go into the actual augmentation once we find an s-t path P in the residual graph. We can only modulate the flow f(e) for each edge in the original graph on path P ± the smallest value residual graph edge on path P. The smallest forward edge on path P in the residual graph is the "bottleneck" to how much we can increase flow along the path P in the original graph. (hard to visualize...the textbook may have to take it away with this one, but when you understand this you'll really get it after watching this video)
    I also didn't talk about time complexity, but the amount of while loop iterations is bounded to the capacity coming out of start node 's'. We can't ever push more flow from 's' than the sum of capacities of those exiting edges. If each interaction increases the value of the flow v(f) by 1 (and v(f) starts at 0 in the beginning since no "water" is going through the "pipes"), we can do at most C augmentations of the flow network where C = sum(edge capacities leaving 's').
    In each while loop:
    - O(|V| + |E|) to find the augmenting path
    - O(|E|) to update the flows in the original graph
    - O(|E|) to update the residual graph
    So total runtime can be bounded to O(C * (|V| + |E|)).
    #backtobackswe #benyamephrem
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 329

  • @FirstTimeDad23
    @FirstTimeDad23 4 ปีที่แล้ว +246

    Ben your stuff is also helpful for senior devs(like myself). I’ve just landed a job at Amazon SA CPT. Thank you young man. Continue doing what you do.

  • @alexanderson753
    @alexanderson753 3 ปีที่แล้ว +62

    > Textbooks could do 10 times of a better job than I could ever do.
    Textbooks could stretch out what you described in this video to be 300 pages. This is beautiful and is more than I learned from a week of Algorithms. Thank you!

  • @qR7pK9sJ2t
    @qR7pK9sJ2t 4 ปีที่แล้ว +129

    You already have achieved the minumum cut..Cause you(source) are clearly trying to maximize the amount of flow of knowledge that can reach us(sink)..
    Well done bro..

  • @dianaayt
    @dianaayt 3 ปีที่แล้ว +9

    This was really helpful! I'm studying to be a data engineering and we talk a lot about graphs so your videos really help. You are very clear and explain things in a very visual way which helps a lot. Thank you so much!

  • @enricomilettogranozio8817
    @enricomilettogranozio8817 3 ปีที่แล้ว +7

    First year Computational Science student here. Thanks a lot for your videos, man. They're really helping me for my Data Structures & Algorithms class

  • @tvishathakur8947
    @tvishathakur8947 8 หลายเดือนก่อน +9

    This 20 min video was more clear than a whole chapter of a book or any other lecture! Thanks for this beautiful explanation :D

    • @BackToBackSWE
      @BackToBackSWE  7 หลายเดือนก่อน +1

      Happy Holidays 🎉 Thank you for this beautiful comment, tvishathakur! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40

  • @anastasiagavrilita6567
    @anastasiagavrilita6567 4 ปีที่แล้ว +11

    There aren't enough good words in the world to describe my gratitude towards you and the videos you make!

    • @BackToBackSWE
      @BackToBackSWE  4 ปีที่แล้ว +2

      May the internet grow big and strong

  • @qqww1345
    @qqww1345 2 ปีที่แล้ว +2

    This is literally the best video I've seen for explaining the min-cut problem.

  • @BackToBackSWE
    @BackToBackSWE  4 ปีที่แล้ว +100

    Check out the free DSA Mini-Course 👉backtobackswe.com/five-day
    Table of Contents:
    Defining The Flow Network 0:00 - 3:35
    Greedily Pushing Flow 3:35 - 5:16
    Recovering From The Greedy Choice 5:16 - 8:01
    The Residual Graph 8:01 - 15:36
    Ford-Fulkerson Algorithm (Overview) 15:36 - 17:42
    Max-Flow Min-Cut 17:42 - 21:55

    • @noahcoomer9170
      @noahcoomer9170 4 ปีที่แล้ว +2

      Thanks so much for this channel dude. Your videos on backtracking and sorting were absolutely key to my technical interviews at Amazon this past week. Ended up getting an offer, cheers mate.

    • @BackToBackSWE
      @BackToBackSWE  4 ปีที่แล้ว

      Nice!

    • @rookiecookie8258
      @rookiecookie8258 4 ปีที่แล้ว

      @@BackToBackSWE So as far as i understand the min cut (S,T) is an indication/bottleneck for the maximum flow we can push if all outgoing edges of the S part become saturated,right?

    • @ryanmacanzie1846
      @ryanmacanzie1846 3 ปีที่แล้ว

      @@BackToBackSWE What purpose does a cut serve ?

  • @mengengao7657
    @mengengao7657 4 ปีที่แล้ว +6

    This is so helpful! I memorized Ford-Fulkerson algorithm but never got an intuitive understanding until I saw this video. Thanks!

  • @dariusbuhai9074
    @dariusbuhai9074 3 ปีที่แล้ว

    Dude, best explanation ever. I tried looking at 4 different videos, yours is the best.

  • @abdi6141
    @abdi6141 4 ปีที่แล้ว +7

    DUDE. I am still really early on in your videos but just wanted to come to your latest video and say.Your videos are incredible they are such an enormous help. The amount of research and thought you put into each video Is very clear in how well you explain all of the concepts you cover. Thank you very much for all your hard work. I appreciate it and godspeed brother wishing you all the best in your career and studies.

  • @boris5214
    @boris5214 3 ปีที่แล้ว +1

    This is amazing, thank you so much for explaining what the residual graph actually means. I've studied the proof but never understood it fully until now.

  • @CrzyAsianGuy
    @CrzyAsianGuy 4 ปีที่แล้ว +4

    Watched like several videos on this topic, and this video by far the most clear and concise.

  • @summerxia7474
    @summerxia7474 ปีที่แล้ว

    Please continue to do this series of lectures!!! You are way better than my teacher in college.

  • @SR-ti6jj
    @SR-ti6jj 4 ปีที่แล้ว +6

    Thank you for explaining why we can traverse backwards edges when finding an augmented path. Most other resources seem to gloss over this when it's the trickiest part of the algo!

  • @gtmashok
    @gtmashok 3 ปีที่แล้ว

    THANKS a ton! You're explanation of max-flow min cut was so valuable, better than my course lectures.

  • @sanikakulkarni3061
    @sanikakulkarni3061 7 หลายเดือนก่อน

    perfect. thanks so much.. spent hours watching lectures and this one vid helped me more than all of them combined!!!!

  • @sumitlahiri209
    @sumitlahiri209 4 ปีที่แล้ว +3

    Great Tutorial man. It saved me the pain of reading a whole paper. Thanks. This is a really good explanation. One can go back and code without much of a problem.

  • @ollieeilon4061
    @ollieeilon4061 ปีที่แล้ว +2

    This is actually the best source out there which simplifies and explains properly!

  • @pedro_soares_bhz
    @pedro_soares_bhz 8 หลายเดือนก่อน

    Great. It really helps seeing a fellow human being gesticulating and talking and drawing. I never thought about it, but it really helps binding my attention. Thanks, my dude.

  • @riddlediddleriddle
    @riddlediddleriddle ปีที่แล้ว

    Your ability to transmit information in a clear and complete way is golden.

    • @BackToBackSWE
      @BackToBackSWE  ปีที่แล้ว

      Thank you 🎉 Please enjoy a special coupon from us - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=SUB 🚀

  • @bryanthandamparambil1581
    @bryanthandamparambil1581 3 ปีที่แล้ว +1

    Thank you for your help, I'm currently studying in year 12 in Australia and this is really helpful, Thank You!!!

  • @IAmNigHtMaReTR
    @IAmNigHtMaReTR 4 ปีที่แล้ว +2

    5 mins in and I’m subbed. These videos are true gems. Thank you very much

  • @addemfrench
    @addemfrench 4 ปีที่แล้ว +1

    The choice of example was perfect. Simple but complex enough to illustrate the need for backflow. Great video for the intuition.

  • @alitcher4425
    @alitcher4425 ปีที่แล้ว +2

    Big Thanks from a novice com-sci student here! I couldn't follow this in class but you explained everything clearly!

  • @irukandjiShred
    @irukandjiShred 3 หลายเดือนก่อน

    God, thank you so much for this video. I was pulling my hair out reviewing some modules before my upcoming final. This clarified things so much!!

  • @danielescotece7144
    @danielescotece7144 4 ปีที่แล้ว +4

    Mathematical engineering student here! Thanks man, this is helping me with my OR exam!

  • @Daniel-iy1ed
    @Daniel-iy1ed ปีที่แล้ว

    This video was fantastic, I needed a visualization badly. Thank you so much

  • @rutujashah3919
    @rutujashah3919 3 ปีที่แล้ว

    Excellent teaching skills! I finally understood the concept now! Thanks a lot :)

  • @DUSHYANTPANCHAL
    @DUSHYANTPANCHAL 4 ปีที่แล้ว +5

    Really well explained the intuition. Exactly what I was looking for!

  • @magickb7255
    @magickb7255 3 ปีที่แล้ว

    best lecture i ve found so far, thanks!

  • @amaefulemercy8974
    @amaefulemercy8974 2 หลายเดือนก่อน

    Thank you so much for this video, I've been struggling to understand this for awhile.. Buh now I get it..

  • @xflory26x
    @xflory26x 4 ปีที่แล้ว +2

    So glad I found your channel!! Your explanations are so clear :)

  • @JoseSanchez-vv1zd
    @JoseSanchez-vv1zd 2 ปีที่แล้ว

    Thank you for making this great video! :) It's helping me with my graph algorithms course.

  • @ADorssers
    @ADorssers 3 ปีที่แล้ว

    Well done! Thank you very much for your work putting together this helpful video

  • @nayararossi7513
    @nayararossi7513 4 ปีที่แล้ว +18

    I'd like to thank you cause I didn't understand anything my professor told us in class, and his slide were also a mistery until I saw your video.

  • @priyanshugupta4875
    @priyanshugupta4875 ปีที่แล้ว

    literally one of the best explainations

  • @kureshimiru
    @kureshimiru 3 ปีที่แล้ว

    Many thanks from graduate students at the Faculty of Electrical Engineering and Computing, Zagreb, Croatia!
    Amazing video!

  • @niritcohen7199
    @niritcohen7199 5 หลายเดือนก่อน

    Thank you!! You make it so simple. Keep on, it's great!!

  • @brettjenkins1645
    @brettjenkins1645 2 ปีที่แล้ว

    So clear! Thank you! I find the textbook stuff is so bogged down with notation that I have a hard time seeing the intuitions. You made it crystal clear!

  • @vicd32
    @vicd32 4 ปีที่แล้ว +13

    Amazing Explanation! You have some great communication skills for a topic that is definitely not the easiest

  • @user-qj8bq1yd5s
    @user-qj8bq1yd5s 2 หลายเดือนก่อน

    Best video on this subject! Thank you!

  • @CarlosHenrique-pb5lz
    @CarlosHenrique-pb5lz 3 ปีที่แล้ว +1

    Thank you a lot for this!
    This has helped me a lot with my presentation

  • @jackkrueckeberg2352
    @jackkrueckeberg2352 8 หลายเดือนก่อน

    Thank you so much, you made this so much more understandable than my instructor

  • @nimidi2568
    @nimidi2568 2 ปีที่แล้ว

    Thanks 🙏🏻
    Your way of explaining is perfect

  • @ckc2498
    @ckc2498 ปีที่แล้ว

    Really love the word "undo". It help me understand what the hell there's an reverse arrows in this algo

  • @sam-lr4lz
    @sam-lr4lz 4 ปีที่แล้ว +3

    Found your video literally a day before my exams. Thanks heaps

  • @SDKThe8God
    @SDKThe8God 4 ปีที่แล้ว +3

    Glad I couldn’t find any German videos on this topic, this is great!

  • @umairfaisal5861
    @umairfaisal5861 4 ปีที่แล้ว +3

    Hey man, that was really really helpful. Thank you so much for the awesome explanation.

  • @constantinemacris9047
    @constantinemacris9047 3 หลายเดือนก่อน

    Fantastic video. Beautiful work.

  • @shmulimargulies5462
    @shmulimargulies5462 3 ปีที่แล้ว

    someone get this man a medal

  • @Arush-eu2xz
    @Arush-eu2xz 4 ปีที่แล้ว +2

    Hey man, thank you for your interview preparation videos. I have got a very good job offer from a startup in India, and your videos played a substantial role in building up my understanding of concepts during interview preparation. Thank you for explaining things so elegantly!

  • @bencameron8840
    @bencameron8840 2 ปีที่แล้ว

    Great stuff! Really helped me understand these concepts!

  • @shawn77160
    @shawn77160 7 หลายเดือนก่อน +1

    god bless you, i was trying to understand an exercices and just by saying it's like water pipe everything was so clear ! i wasn't thinking i can understand so fast with just a trivial comparaison xD
    But anyway thanks ! you're the best :)

  • @sakshammahajan3568
    @sakshammahajan3568 3 ปีที่แล้ว

    Best video i have ever seen thanks a lot.

  • @yashrajpriyadarshanpatra566
    @yashrajpriyadarshanpatra566 ปีที่แล้ว

    Thanks that was worth the watch!

  • @coffee-syrup
    @coffee-syrup 8 หลายเดือนก่อน

    Thank you so much, I finally understood what was happening there. I read the book, not only consumes a lot of time but it can be tricky to understand. You helped me finally clearing up any question I had.

    • @BackToBackSWE
      @BackToBackSWE  7 หลายเดือนก่อน

      Happy Holidays 🎉 Thank you for your kind words, Anto-y! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40

  • @MrKingoverall
    @MrKingoverall 4 ปีที่แล้ว +5

    Operations Research student here , thanks Ben !

  • @mariasandru7
    @mariasandru7 4 ปีที่แล้ว +14

    Amazing! My university professor recommended your videos last week in class🤗 Could you also explain when you have time the Bellman Ford algorithm?

  • @bodobaumstamm8386
    @bodobaumstamm8386 3 ปีที่แล้ว

    Great video, clearified a lot! Thank you

  • @divyaranga6058
    @divyaranga6058 4 ปีที่แล้ว +3

    Hi Ben, Great work! These videos are so helpful for interview preparation. Can you make a video to go over Union-Find data structure ?

    • @BackToBackSWE
      @BackToBackSWE  4 ปีที่แล้ว

      Yes I can, just time limits my ability to contribute here.

  • @caothanhlong7577
    @caothanhlong7577 2 ปีที่แล้ว

    wow, it's so clear and intuitive. Thanks a lot. It helps me to understand more after diving complicated concepts in textbook.

    • @BackToBackSWE
      @BackToBackSWE  2 ปีที่แล้ว

      Thank you, glad you liked it 😀
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends 😀

  • @XORBob
    @XORBob 2 ปีที่แล้ว

    Well done, that was a big help. Thanks!

  • @dana1391
    @dana1391 7 วันที่ผ่านมา

    That was very helpful, thanks!

  • @sergten
    @sergten 3 ปีที่แล้ว

    Finally an explanation that makes sense to me.

  • @AlwaysFiesta
    @AlwaysFiesta 4 ปีที่แล้ว +2

    Thank you! Brilliant explanation, so easy and clear!

  • @Gwittdog
    @Gwittdog หลายเดือนก่อน

    Great Explanation

  • @ruchirjain1163
    @ruchirjain1163 2 ปีที่แล้ว +1

    this was amazing

  • @angiee_granda
    @angiee_granda 9 หลายเดือนก่อน

    Thank you professor!!!

  • @user-fw4zu2tc2g
    @user-fw4zu2tc2g 2 ปีที่แล้ว

    Thanks! Your video lets me understand the theorem.

    • @BackToBackSWE
      @BackToBackSWE  2 ปีที่แล้ว

      Thank you, glad you liked it 😀
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends 😀

  • @butlikereally
    @butlikereally 4 ปีที่แล้ว +2

    Love this! Can you do a video on the dp algorithm for Regular Expression Matching next?

    • @BackToBackSWE
      @BackToBackSWE  4 ปีที่แล้ว

      Yeah I can, just time constrained.

  • @tljstewart
    @tljstewart 2 ปีที่แล้ว

    "S-T cut, S must be in A and T must be in B" exactly what I was searching for, most memorable. Thanks

  • @ZPSu-gs5hc
    @ZPSu-gs5hc 4 ปีที่แล้ว +1

    thanks for your video it help me to understand maxflow -mincut more directly

  • @zcjsword
    @zcjsword 3 ปีที่แล้ว

    Your "undo" gives me the epiphany! Thank you!

  • @markusmichaeldavidsnelder3395
    @markusmichaeldavidsnelder3395 4 ปีที่แล้ว +1

    You're videos are amazing! Keep it up

  • @VineetBhatawadekar
    @VineetBhatawadekar ปีที่แล้ว

    This is very good content!

  • @isaacbuitrago2370
    @isaacbuitrago2370 4 ปีที่แล้ว +1

    Thanks for explaining this. You have good teaching skills.

  • @saskm3904
    @saskm3904 3 ปีที่แล้ว

    Really thanks !

  • @mehmetalikeskin6467
    @mehmetalikeskin6467 หลายเดือนก่อน

    good job brother very appreciate it

  • @TheChepats
    @TheChepats 2 ปีที่แล้ว

    Thanks man!

  • @rio-ty9vr
    @rio-ty9vr ปีที่แล้ว

    thanks, was so much easier to understand after i watched the video

    • @BackToBackSWE
      @BackToBackSWE  ปีที่แล้ว

      Thank you, appreciate it 😄 Also check out our Free 5 Day DSA Interview Prep Mini-Course - backtobackswe.com/ 🎉

  • @silasleuenberger7204
    @silasleuenberger7204 หลายเดือนก่อน

    Great video!

  • @fb_a
    @fb_a 4 ปีที่แล้ว +3

    Awesome explanation bro!!! Just Watched till 5:47 but felt amazing man!.

  • @shamanstation6821
    @shamanstation6821 8 หลายเดือนก่อน

    Thanks for nice explanation. Much appreciated.

    • @BackToBackSWE
      @BackToBackSWE  7 หลายเดือนก่อน

      Happy Holidays 🎉 Thank you for your kind words, Shamanstation! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40

  • @ManishKumar-rz9ub
    @ManishKumar-rz9ub 4 หลายเดือนก่อน

    I never understood that back edges concept until i saw this one.

  • @user-wm6pe9mm7q
    @user-wm6pe9mm7q 3 ปีที่แล้ว

    thank you so much !

  • @ShashidharG_addString_
    @ShashidharG_addString_ 3 ปีที่แล้ว +1

    Great job in explaining the reason why the undo operations work!!

  • @djhacaptures
    @djhacaptures 4 ปีที่แล้ว +3

    Seems like you are going with what is being taught in classes :P
    Great video, thanks again.

  • @mahditalebi1770
    @mahditalebi1770 4 ปีที่แล้ว +1

    great explanation. no stutter.no bullshit. just good solid well explained!
    thank you

  • @boratsagdiev6486
    @boratsagdiev6486 4 ปีที่แล้ว +1

    Wow really clear and good video! Thanks!

  • @md.muidulalamtuhin1863
    @md.muidulalamtuhin1863 4 ปีที่แล้ว +1

    Thanks, Man for the awsome explanation

  • @smartlearners3257
    @smartlearners3257 2 ปีที่แล้ว

    Please a qustion, can we hav more than one min cut in a network flow? Bcs from what i did i get 2 min cuts cuz when i sum both gives me the max flow value i got.

  • @henrynguyen911
    @henrynguyen911 4 ปีที่แล้ว +5

    my man Ben doing God's work! Thank you so much!

  • @ankityadav-zz9gf
    @ankityadav-zz9gf 4 ปีที่แล้ว +3

    Thanks a lot for all your videos. Could you please upload some more videos on greedy problems and about the approach to solve them. for ex the gas station problem in Leetcode.

  • @imanejalal5074
    @imanejalal5074 3 ปีที่แล้ว

    Thank you!

  • @patchiang13
    @patchiang13 3 ปีที่แล้ว +1

    Thank you. The tutorial is quite helpful.

  • @kimsan4374
    @kimsan4374 ปีที่แล้ว

    What. A. Legend.

  • @sharbel9624
    @sharbel9624 3 ปีที่แล้ว

    what a life saver

  • @sayandey1478
    @sayandey1478 3 ปีที่แล้ว

    This is a very good video