I agree. The intuition explanation was so helpful to my understanding of this algorithm, as well as to my understanding of graph behavior in general. Thank you!
very good explanation of the intuition on why the first step is topological sort. and then DFS on the reversed graph based on the order of the topological sort.
Yeah , you have been my goto person during this lockdown. Basically, whenever I get to know of some algorithm during CP which I need to learn, I head to your channel to see whether you had explained it or not. Just one thing : the plural of child is children and not childrens :)
Nice one. In nutshell, we are topologically sorting the underlying DAG of reverse graph (with connected components as vertices), so that one strongly connected component cannot be traced from another strongly connected component.
I always wondered why a stack was used when a visited array could do the task. I searched a lot to find the reason and finally understood after landing here. Thank You for your service to the Community.
Dropping a comment bcoz I watched several videos but logically yrs makes the most sense and Im finally getting it right without contemplating which path to take
wonderful expalnation and the best part was now u are implememting the concept via code in your video. Earlier your videos gave insight but lack of code was a issue for me at least.Kudos to u ,keep going
Thank you! I've watched like 6 different videos and non of them helped do my homework, because none of them actually did a proper step by step explanation. But yours did! So thank you, I can finally do my homework and upload it.
I was stuck at this topic for an hour or so. Thank you for explaining with an example. Not only it was so easy to understand, no i believe that i can teach it somebody else too.
+Tushar Roy hey Tushar. I am preparing for interviews and ran into a question. This might be helpful for others too. Let's say someone asks me to write code related to strongly connected components or topological sort. Is it enough to write those two to four functions that deal with the actual implementation or should I write some prep code as a starting point. Unlike binary/tertiary trees, graph representation is not unique. Say you may be representing a weighted DAG using lists and I may be using arrays (being lazy!!!). Moreover I never faced any graph related problems in a limited number of interviews I attended and so this confusion. Please comment based on your actual interview experience. Thanks..
Bro omg thank you, I implemented the entire in python from Wikipedia, but it was missing some details. You outlined everything I needed, now onto Johnson's alg
great explanation. like all other videos.. what I liked in this video specially the way you explained why this algorithm works.. when I dry run is over.. I was thinking.. lets think how it will work and why it will work.. and this explanation was just there after that..
Tushar, I'm not going to lie. Most of the times, I loathe your videos, especially the ones on dynamic programming, where all you do is draw the 2d array(tabulation) and show us what to do, instead of showing us the way of recursion and memoization. But the intuiton you provided in this video was really helpful. Thank you. Cheers!
Very well explained intuition, I didn't get it in the first time but after few tries got it. Basically, in the stack we will always have at least one node of parent on top of children. And after reversing, doing DFS on this stack, we take out the parent node only, but since the edges to it's children in original graph are reversed, the parent node taken out traverses locally only. Once all parent groups are visited, then we reach to child components (child in original), and by that time other nodes are already visited so this child group also visits locally and gives the strongly connected component. That's what I understood, please correct me if I'm wrong.
Nice tutorial. One request, sometimes the white board gets blocked while something important is written on it. Please try to avoid it. Thanks again for such a nice tutorial.
I am a fan of your videos! Could you please explain somehow "Find the median of two sorted arrays in log (Min(m,n)) time?" I've really had a hard time in understanding this solution but still couldn't understand. I look forward to you for this.