Tarjans strongly connected components algorithm

  Рет қаралды 62,491

Techdose

Techdose

Күн бұрын

This lecture explains the Tarjans algorithm for finding the strongly connected components in a graph.The previous video explained the same using kosaraju algorithm and link for that is given below.In the tarjans algorithm, we can find all the strongly connected components in just a single traversal of graph.In this video, I have first explained the concepts required to completely understand the reasons behind each step of tarjan's algorithm and then i have shown the dry run example.I have also shown the reason for using low and disc (discovery) time of nodes and how to calculate it with intuition.At the end of the video, I have shown the CODE walk through of this algorithm.This algorithm makes used of Arrays,Stack and a DFS traversal.CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
========================================================================
Join this channel to get access to perks:
/ @techdose4u
INSTAGRAM : / surya.pratap.k
SUPPORT OUR WORK: / techdose
LinkedIn: / surya-pratap-kahar-47b...
WEBSITE: techdose.co.in/
TELEGRAM Channel LINK: t.me/codewithT...
TELEGRAM Group LINK: t.me/joinchat/...
=======================================================================
CODE LINK: gist.github.co...
USEFUL VIDEOS:-
Kosaraju Algorithm: • Kosaraju Algorithm | S...

Пікірлер: 221
@techdose4u
@techdose4u 3 жыл бұрын
At 19:50 , If you are confused why only single back-edge is allowed ? Ans-> We are allowed to have a single back-edge only for calculating low and disc. However, It will have a cascading effect at the given time. If you carefully run the algorithm as dry run then you will find only 1 head node of SCC and hence, there will be only 1 SCC. I hope you got it :)
@Góne-y2s
@Góne-y2s 3 жыл бұрын
After watching the video I also find it really confusing, I am not sure but what I think is that (6 and 2) has a back edge relation where we need to check if 6 is part of earlier SCC and also that we know that it's articulation point too, and if we take (2 and 0), for 2 to be part of that SCC there no need to check for the back edge. SO I think min(low[u], disc[v]) is for back edge and articulation point. Hope I am not wrong. : )
@techdose4u
@techdose4u 3 жыл бұрын
@@Góne-y2s Yes right. For tree edge, it will be low(v)
@Góne-y2s
@Góne-y2s 3 жыл бұрын
this Algorithm has much application- one you mentioned is SCC, then Bridge and Articulation Point. Though all three are the same thing. first asks for a number of components, 2nd is for critical edges and 3rd is for articulate points.
@Góne-y2s
@Góne-y2s 3 жыл бұрын
@@techdose4u True for tree edges and only while tracking back and popping from stack.
@techdose4u
@techdose4u 3 жыл бұрын
@@Góne-y2s you are going deep 🙏🏼 😅 great
@jyotirmoydey9907
@jyotirmoydey9907 3 жыл бұрын
this is, in my opinion, THE MOST COMPREHENSIVE explanation of Tarjan's algorithm on SCC. The video contained a huge amount of information but it was delivered in a way that was very easy to follow.
@techdose4u
@techdose4u 3 жыл бұрын
👍
@karanveersingh5535
@karanveersingh5535 2 жыл бұрын
Outstanding video from tech dose 🔥🔥🔥🔥🔥🔥
@sujaysreedhar8313
@sujaysreedhar8313 3 жыл бұрын
Thank you so much for this amazing explanation and readable code. Can't believe this is for free.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@SurajKumar-bw9oi
@SurajKumar-bw9oi 3 жыл бұрын
At first sight, the lecture looked lengthy and boring but it turned out to be the most amazing and simplified explanation of Tarjan's. Thank you for this lecture.
@willturner3440
@willturner3440 3 жыл бұрын
2 hrs lage ye video smajhne me but ab Confidence aagya is algo me, thanks bhaiya
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@rahulchudasama9363
@rahulchudasama9363 3 жыл бұрын
What a great video. Finally, I am able to understand this concept. I can see the efforts you made. Thank you :)
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@hansalkothari8826
@hansalkothari8826 2 жыл бұрын
This is such a great explaination of concepts and the algorithm .The code was so intuitive and beautiful . We are so grateful you made this video . Thank you so much !!♥
@techdose4u
@techdose4u 2 жыл бұрын
Welcome 😀
@anuragchakraborty7607
@anuragchakraborty7607 2 жыл бұрын
Students of JU are proud of u sir , keep up your work
@sujoyseal195
@sujoyseal195 3 жыл бұрын
I have been following your entire graph playlist since 1 week and they have been super useful to me. This one was awesome 👌👌. Keep up the good work 👍💯
@techdose4u
@techdose4u 3 жыл бұрын
Thanks ☺️
@NareshKumar-dw9xp
@NareshKumar-dw9xp 3 жыл бұрын
Thank you so much for making it so clear. This algorithm appears to be very hard but your hard work and awesomeness are just great enough to defeat that hardness. Keep it up sir.
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@devilronak7262
@devilronak7262 3 жыл бұрын
you are literally great, literally whenever I did not understand any concept, and then I see your video then all concepts are clear, Thx for such wonderful videos.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@yashasvimahajan2298
@yashasvimahajan2298 29 күн бұрын
One of the best explanation that anyone can provide. OP Surya🔥
@Virtualexist
@Virtualexist 4 ай бұрын
This is so good. Very well explained. This is implementation with understanding and not just memorising an algorithm. I did not understand this in striver's video. I tried hard, but this one, just 1 go, and I could code it. Beautiful!
@code-gurruu6856
@code-gurruu6856 3 жыл бұрын
I m regreating why I hadn't come to this channel before, love your explanation. Thanks for helping us🙏
@arpanbanejee5143
@arpanbanejee5143 2 жыл бұрын
Nobody can explain better than you! Thank you...
@techdose4u
@techdose4u 2 жыл бұрын
Welcome 😁
@KousthubhaKumar
@KousthubhaKumar 3 жыл бұрын
Took me a lot of time to understand from other sources, but able to understand in one watch here. Excellent explanation. Very easy to understand call stack and how to deduce this algorithm. Great job, thank you!
@Sunny-qq6un
@Sunny-qq6un 3 жыл бұрын
I'm wondering how much efforts u've pushed to make this video. Tysm 🙏🙏🙏
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@sanheensethi8344
@sanheensethi8344 2 жыл бұрын
Explanation is very nice in the entire youtube, I explored alot, but didn't get this type of explanation. and Finally I understand low, disc why we take that ? , each and every concept. it takes me 2 hrs continuously to understand, in every minute , stopped the video and understand the words more focusly and writing on copy, rather it take me time 2 hr, but understanding the algorithm is more important.
@yashwanthsai2460
@yashwanthsai2460 3 жыл бұрын
Thank you very much for the clear explaination...everything is so clear after this video
@akshatthakur7402
@akshatthakur7402 Жыл бұрын
best explanation of Tarjan's Algorithm . Thank you
@techdose4u
@techdose4u Жыл бұрын
Welcome :)
@himanshu2149
@himanshu2149 3 жыл бұрын
Initially I thought graph algorithms are really easy. Then I came across Tarjan's algorithm😭
@techdose4u
@techdose4u 3 жыл бұрын
😅
@abhisheksaraf2616
@abhisheksaraf2616 3 жыл бұрын
Okay let's assume you are sitting in cluster of people and you are connected anticlockwise. Assign number to each person 1,2,3 since you are in cycle eventually you will meet min number. Now think you have clusters of those cycle
@himanshu2149
@himanshu2149 3 жыл бұрын
@@abhisheksaraf2616 thanks bhai!! 👌👌
@akashkumarbeniwal4875
@akashkumarbeniwal4875 3 жыл бұрын
@@abhisheksaraf2616 didn't get!
@abhisheksaraf2616
@abhisheksaraf2616 3 жыл бұрын
@@akashkumarbeniwal4875 think about cycle in undirected graph if you try to remove any edges or node will it be more than 2 component ans is no now think about a graph with no cycle
@algorithmimplementer415
@algorithmimplementer415 4 жыл бұрын
What a coincidence! This morning I was learning this topic! Many thanks for the video.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@jkrw3540
@jkrw3540 3 жыл бұрын
At 19:50 why are we allowed only single back-edge?
@apoorvkrishan1447
@apoorvkrishan1447 3 жыл бұрын
No, you can take the low value at both the step. He has explained it wrong. In that example, you can clearly go from any vertex to any other vertex. They all will account for 1 SCC. As per his algo you will have 2 SCC which is wrong.
@SparshGupta1
@SparshGupta1 3 жыл бұрын
I agree, this implementation of having only one back edge is wrong. We can have multiple backedges. It is quite evident from the given graph example that it's a single SCC. I tried the same graph with Kosaraju that's giving me only one SCC. I tried the same graph on GFS's implementation for Tarjans that's also giving a single SCC.
@techdose4u
@techdose4u 3 жыл бұрын
We are allowed to have a single back-edge only for calculating low and disc. However, It will have a cascading effect at the given time. If you carefully run the algorithm as dry run then you will find only 1 head node of SCC and hence, there will be only 1 SCC. I hope you got it :)
@youssefelamrani7905
@youssefelamrani7905 3 жыл бұрын
this is the best KZbin Channel for CS by far, Good Job brother
@gangli3484
@gangli3484 3 жыл бұрын
Top high quality video about computer science graph theory, others I have looked can't compare with yours. By watching your video, I can truly understand the content from [Geeks for Geeks] and wiki. Now I am confident, thank you so much.
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@danym-98
@danym-98 2 жыл бұрын
Awesome. I understand from the first try. I really recommend this channel!
@UchihaMadara-rf9yi
@UchihaMadara-rf9yi 4 жыл бұрын
It's a great video. You explained a very tough concept in such a simple way. Thank You so much Sir.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@abhinaygupta
@abhinaygupta 3 жыл бұрын
Tech Dose is God! So good explaination. Finally understood this algo!.
@adityajhajharia3041
@adityajhajharia3041 3 жыл бұрын
Huge respect for such explanation
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@alpishjain1317
@alpishjain1317 3 жыл бұрын
The dry run really makes it very clear.
@techdose4u
@techdose4u 3 жыл бұрын
:)
@arunrahullakkapragada2304
@arunrahullakkapragada2304 3 жыл бұрын
At 19:47, explanation is that we cannot min low[u] with low[v], it must be disc[v] since 0 is not directly reachable from 6. But for the given graph, even if we consider low[v] instead of disc[v], answer is there is only 1 strongly connected component isn't it? Will there be any case where taking low[v] for back edge yields wrong result. I couldn't think of any. Please let me know if there is such a graph where it yields wrong result
@shady41
@shady41 2 жыл бұрын
You are right, using low instead of disc will not yield the wrong result.
@saurabhkale4495
@saurabhkale4495 3 жыл бұрын
Perfect explanation!!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@ayushmanvashishtha8180
@ayushmanvashishtha8180 3 жыл бұрын
Great Explanation sir.
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@milanchatterjee1662
@milanchatterjee1662 3 жыл бұрын
Very well and indepth explanantion
@abhigyannayak4151
@abhigyannayak4151 3 жыл бұрын
Your videos for graph is awesome.. great job 👏
@techdose4u
@techdose4u 3 жыл бұрын
Thanks :)
@sackshamsharma2829
@sackshamsharma2829 2 жыл бұрын
thankyou so much sir, you nailed it
@techdose4u
@techdose4u 2 жыл бұрын
Welcome 😊
@harishreddythalla
@harishreddythalla 2 жыл бұрын
I loved how he changes pen colour at 32:40
@jaydeepvasoya6243
@jaydeepvasoya6243 Жыл бұрын
Excellent sir..! Thanks a lot..!
@code-for-mars
@code-for-mars Жыл бұрын
Great explanation
@techdose4u
@techdose4u Жыл бұрын
Thanks :)
@dhruvankadavala568
@dhruvankadavala568 2 жыл бұрын
Nice explained 👍👍
@techdose4u
@techdose4u 2 жыл бұрын
Thanks
@mananpurohit9299
@mananpurohit9299 2 жыл бұрын
Hats off to you sir ! Mind blowing job with this video 🔥💯👌
@avnishpanwar9502
@avnishpanwar9502 3 жыл бұрын
I found this explanation better than That of William Fiset, that one regarding the use of low vs index
@livelittlewithdeeps
@livelittlewithdeeps 2 жыл бұрын
For all those who are wondering why we used low[u] = min(low[u], disc[v]) for back edge, what I think is that if you look at example given at 18:29 you see that from 6 we have back edge to 2 , so let's say if there was an edge from 6 to 5 then only we could say that 0 is lowest node 6 can visit and the component is connected to other component but here only 2 is lowest node 6 can visit. If we will take more than one back edge may be we would mistakenly take cross edges as back edge also.. For current situation we can only take decision for 2 that it part of our component. May be in future when we explore more nodes 0 also becomes part of our scc. I hope it makes sense !!
@karanveersingh5535
@karanveersingh5535 2 жыл бұрын
Superbly explained.Mind blowing bro ❤️❤️
@theghostwhowalk
@theghostwhowalk 4 жыл бұрын
Was waiting for this. Thanks so much!!
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@adhaarsharma753
@adhaarsharma753 3 жыл бұрын
You did not explain what would happen in the case of a forward edge. I think that forward edges will be treated similar to the cross edge in the algorithm implementation. Is that right?
@shivammehta9661
@shivammehta9661 3 жыл бұрын
Very Nice Explanaton. Keep making videos
@nirajgusain1452
@nirajgusain1452 2 жыл бұрын
Very detailed explanation,thank you sir🙏
@abhishekshankar1136
@abhishekshankar1136 3 жыл бұрын
Kosaraju is much more easier than this to implement , but you have explained this really well, thank you
@VY-zt3ph
@VY-zt3ph 3 жыл бұрын
This one is more effective.
@vaibhavgupta7429
@vaibhavgupta7429 2 жыл бұрын
Amazing video, Appreciate the effort
@techdose4u
@techdose4u 2 жыл бұрын
Thanks 😊
@kunalsoni7681
@kunalsoni7681 4 жыл бұрын
Great video 😇 really 💞. Thanking you so much sir 😊 to making always very helpful video.
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@kulkven
@kulkven 3 жыл бұрын
Tech Dose. what is the significance of FORWARD EDGE in Tarjans algorithm ? I understood the roles played by Tree Edge ( for DFS) / Cross Edge (Ignore) and Back Edge ( update low time based on discovery tiime). And also after back track of tree edge traversal we update low time. Forward edge effectively plays the role of back/cross edge depending on presence/absence of its value in stack ?
@ShaliniNegi24
@ShaliniNegi24 2 жыл бұрын
Thanks for all the hard work.
@soumavanag5025
@soumavanag5025 3 жыл бұрын
Best explanation
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@soumavanag5025
@soumavanag5025 3 жыл бұрын
@@techdose4u This algorithm will help in solving many questions, thanks for ur effort in explaining it :)
@tarunsingh3687
@tarunsingh3687 3 жыл бұрын
Bow down to the master
@techdose4u
@techdose4u 3 жыл бұрын
😂
@letscodewithshivam
@letscodewithshivam 2 жыл бұрын
great explaination
@superneutral1663
@superneutral1663 2 жыл бұрын
kya bat hai,too good
@megasage
@megasage 2 жыл бұрын
Ok but I am still unable to process when are we using the 1st formula [min(low(u), low(v)] and when are we using the 2nd formula [min(low[u], disc[v])]
@vivekkashyap157
@vivekkashyap157 2 жыл бұрын
Sir, I didn't make the stack. I updated only low value and discovery. After completing the traversal, I made a unordered_map and whose low values are same put them into the same key. But my answer is wrong. I am not getting what is wrong in this.
@sampannapokhrel
@sampannapokhrel Жыл бұрын
Good description of tarjans algo but I found a little inconsistency. While backtracking why are you waiting to change the Instack to false. I feel like that should be immediately changed to false after we complete exploring and not waiting on finding a SCC. It kind of contradicts what you explained at 12:05.
@shaileshhegde9205
@shaileshhegde9205 3 жыл бұрын
Great video!, so easily taught!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@DanielSColao
@DanielSColao 3 жыл бұрын
Your videos are great, mate!
@dipuprasad3694
@dipuprasad3694 3 жыл бұрын
thank you sir. It was helpful
@prernasingh564
@prernasingh564 3 жыл бұрын
This is THE BEST!! Thanks a ton!!!!!!
@techdose4u
@techdose4u 3 жыл бұрын
Welcome :)
@prernasingh564
@prernasingh564 3 жыл бұрын
@@techdose4u I had one doubt. The diagram at 19:45, how many strongly connected components are there? I think the entire graph is strongly connected. Is that correct? If yes, then while updating node no. 6, why can't the low value be 0? because we can reach 0 from 6 and in some youtube videos they said that the scc nodes will have same low-link value.. please clarify
@Góne-y2s
@Góne-y2s 3 жыл бұрын
@@prernasingh564 ohh,,, good question. kaha tk kr chuki be 4 mahine me.. Caught ya!!
@Góne-y2s
@Góne-y2s 3 жыл бұрын
@@prernasingh564 reply fast if u get notified for me comment, else u wont be alive if u meet ever again lol!!
@Góne-y2s
@Góne-y2s 3 жыл бұрын
@@prernasingh564 After watching the video I also find it really confusing, I am not sure but what I think is that (6 and 2) has a back edge relation where we need to check if 6 is part of earlier SCC and also that we know that it's articulation point too, and if we take (2 and 0), for 2 to be part of that SCC there no need to check for the back edge. SO I think min(low[u], disc[v]) is for back edge and articulation point. : )
@raghavrathi7858
@raghavrathi7858 3 жыл бұрын
Pure Gold
@techdose4u
@techdose4u 3 жыл бұрын
:)
@ismail8973
@ismail8973 2 жыл бұрын
Nice video as always. Hope you will do more videos about System Design too in the future.
@abhinavgarg5611
@abhinavgarg5611 2 жыл бұрын
I have a doubt at 19:50, why are we not allowed to have multiple back edges? The reason provided by @TECH DOSE isn't clear :(( Any help would be appreciated.
@reshmah1497
@reshmah1497 3 жыл бұрын
Well explained video!
@techdose4u
@techdose4u 3 жыл бұрын
Thanks
@laraibanwar1618
@laraibanwar1618 3 жыл бұрын
Picture perfect my man
@adrikagupta5573
@adrikagupta5573 3 жыл бұрын
Thank you for the amazing explanation! I wrote and executed the code in GFG and it worked BUT when I wrote low[u] = min(low[u], low[v]) FOR THE BACK EDGE, IT ALSO WORKED! Can you please give one example (not from the video) to help us know why we are using disc instead of low?
@tanmaybhayani
@tanmaybhayani 3 жыл бұрын
Yeah, I had the same doubt.
@ApoorvaRajBhadani
@ApoorvaRajBhadani 4 жыл бұрын
You are GOD!!
@techdose4u
@techdose4u 4 жыл бұрын
😅
@bhavikpatelid
@bhavikpatelid 3 жыл бұрын
Amazing explanation! thanks much! Can you also tell me what setup you are using for making this video ? Which tablet and software you are using for drawing/writing ? I wanna build similar setup for daily day conference videos.
@shanks____1071
@shanks____1071 4 жыл бұрын
Thank you so much sir
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@priyankabagal9269
@priyankabagal9269 2 жыл бұрын
For me, when I submitted following condition for back edge on gfg as mentioned in the video : low[u] = Math.min(low[u],disc[v]); it did'nt pass all test cases. low[u] = Math.min(low[u],low[v]); With this condition it worked perfectly fine.
@SarabjotSingh294
@SarabjotSingh294 3 жыл бұрын
At 15:43, the example looks like 1 strongly connected component right? Am I correct? As each node can be reached from any other node. If yes, how can we know? as there are 2 lows (0 and 1) after the algo finishes at 20:29. (0,0) (1,0) (2,0) (5,0) (3,1) (4,1) ( 6,1)
@Ice-2706
@Ice-2706 4 жыл бұрын
appreciate your work!!
@techdose4u
@techdose4u 4 жыл бұрын
Thanks :)
@apoorvkrishan1447
@apoorvkrishan1447 3 жыл бұрын
CAUTION EVERYONE!!! at @19:24 he has suggested not to take low value for multiple back edges. In fact, one must take it because a low value denotes the min vertex one can reach for a given vertex. In that example he has explained it wrong. You can clearly go from any vertex to any other vertex. They all will account for 1 SCC. As per his algo you will have 2 SCC which is wrong.
@SarabjotSingh294
@SarabjotSingh294 3 жыл бұрын
Exactly what I was looking for!!! I had the same query. Thanks for clarifying. I also believed that it's a 1 SCC.
@LegitGamer2345
@LegitGamer2345 3 жыл бұрын
so for all cases we take min(low , low) and not min(low , disc) right
@krishankantmani817
@krishankantmani817 3 жыл бұрын
How can you say that his algo is resulting 2 SCC. In fact, no. of SCC = (no. of such node that have " low Val == disc Val") After processing graph. Now tell me no. of SCC by his algorithm.
@arpanbanejee5143
@arpanbanejee5143 2 жыл бұрын
You are getting it wrong, if you dry run the algo yourself, you will understand. His algo will result in only 1 scc. At each step of backtracking we will check if low[v]==dis[v] if so then it will be the head of an scc.
@apoorvkrishan1447
@apoorvkrishan1447 2 жыл бұрын
@@arpanbanejee5143 yeah.. I found the mistake I made at that time. Thanks..
@shourabhpayal1198
@shourabhpayal1198 3 жыл бұрын
Quality vid. Thanks
@techdose4u
@techdose4u 3 жыл бұрын
Welcome
@debdattabiswas4902
@debdattabiswas4902 3 жыл бұрын
In case of back edge why are we doing low [u] = min(low[u], dis[v]) and not low [u] = min(low[u], dis[u]) . This was my biggest doubt after seeing articles from different sites. Thanks a lot for addressing this .
@techdose4u
@techdose4u 3 жыл бұрын
I thought you were asking me 😅 Okay you just edited the comment I guess.
@pranjalgupta9427
@pranjalgupta9427 3 жыл бұрын
Nice video Can we solved it using iteration?
@vinayprakash1687
@vinayprakash1687 7 ай бұрын
Your definition of cross edge is bit different than the actual definition of the cross edge. In your definition, you consider a cross edge from u to v if v is not present in the stack. However, this stack is not the same as the dfs call stack. For eg: take the follow adj list representation of a graph: 1: 2 2: 3, 4 3: 1 4:3 Start dfs from node 1. 1->2, 2->3, 3->1 (back edge), backtrack to 3 , backtrack to 2, 2->4, 4->3 (this should be cross edge, because 3 will not be in dfs call stack, however, it will be in the stack variable that you used in the code. Hence, by your code's definition, this is not a cross edge). Please, let me know if my understanding is correct or not? I got a bit confused due to this. Thanks.
@vinayprakash1687
@vinayprakash1687 7 ай бұрын
Ok. I found on wikipedia that we don't remove a vertex from the stack when we backtrack from that node to its parent node. So, although 4->3 is technically a cross edge by original definition, but in this algorithm, we will consider it as a "back edge". Another confusion that I had was why are we using the disc(v) to update low(u) when there is a back edge from u to v, we can use low(v) as well. Turns out that it does not matter. The result will be the same. However, using using disc(v) is "more" correct in the sense that it disc(v) represents the earliest node reachable from u.
@tanmaybhayani
@tanmaybhayani 3 жыл бұрын
Sir, I dint understand what was the use of doing min(low[u],disc[v]) for back edge instead of min(low[u],low[v]). Aren't they part of the same component. Won't the final answer be the same regardless. An explanation will be highly appreciated. Thank you.
@GauravKumar-ue7nz
@GauravKumar-ue7nz Жыл бұрын
Thank you Bhaiya
@Cruz0e
@Cruz0e 2 жыл бұрын
what happens if your graph has multiple parts that are not connected at all?
@adrikagupta5573
@adrikagupta5573 3 жыл бұрын
At 30:21 the edge from 4 to 6 is said to be cross edge but isn't it forward edge?
@andrewsm1309
@andrewsm1309 3 жыл бұрын
in 12:47 how you gonna know that 0 already present in a stack , we cant access 0 until we pop all elements from stack ?
@ankithreddyadudodla7673
@ankithreddyadudodla7673 3 жыл бұрын
why for every discovered node, you are checking only for backedge and cross edge, if it is not backedge why it cant be forward edge?
@techdose4u
@techdose4u 3 жыл бұрын
Will the forward edge change anything you your calculation ? Low will still be the same. Only the discovery time for the nodes skipped will be different but it doesn't matter. Dry run this and check.
@ankithreddyadudodla7673
@ankithreddyadudodla7673 3 жыл бұрын
@@techdose4u yes, right, but how do we check if it is a cross edge or forward edge if not backedge
@techdose4u
@techdose4u 3 жыл бұрын
@@ankithreddyadudodla7673 no need to check forward edge
@ankithreddyadudodla7673
@ankithreddyadudodla7673 3 жыл бұрын
@@techdose4u yes, I do know, but in general I am asking
@techdose4u
@techdose4u 3 жыл бұрын
@@ankithreddyadudodla7673 tell me a use case for it :)
@danym-98
@danym-98 2 жыл бұрын
Thanks!
@raviteja-xl8sz
@raviteja-xl8sz Жыл бұрын
According to wiki a strongly connected means Every node can visit every other node which is TRUE for 19:50 graph so the ans should be 1 but according to u it is 2 What is ur definition of strongly connected graph
@jaysolanki1644
@jaysolanki1644 3 жыл бұрын
Will you please explain why we just check for the discovery value of ancestor and don't consider parent for updating low value of a node?
@techdose4u
@techdose4u 3 жыл бұрын
I think I had explained this in the video. Please rewatch and let us know if you don't get it.
@04pradeep
@04pradeep 11 ай бұрын
At 15:16, you did not explain why it is cross edge and not a tree edge.
@amitavamozumder73
@amitavamozumder73 3 жыл бұрын
I stupidly started doing this on a bi-directional graph and got freaked out when every edge became a back edge LOL.
@Marcos_1154
@Marcos_1154 3 жыл бұрын
At 12:00, if I take right edge first and the left edge, then 5->3 would be tree edge and not cross edge as node 3 would not be visited before. Am I wrong?
@Nikhil-lq1kb
@Nikhil-lq1kb 3 жыл бұрын
In the last example, the edge from 4 -> 6 is a forward edge not a cross edge
@divanshmahajan1769
@divanshmahajan1769 4 жыл бұрын
Where to practice graph questions from??which is best one??
@techdose4u
@techdose4u 4 жыл бұрын
Leetcode or geeksforgeeks
@sdeBack1
@sdeBack1 3 жыл бұрын
Can anyone give exmaple where low[u] = min ( low[u], low[v] ) { in back edge case} fails ? 19:50
@suryapratap7071
@suryapratap7071 3 жыл бұрын
Please read the pinned comment. Try to dry run. It will work.
@anubhavaggarwal017
@anubhavaggarwal017 3 жыл бұрын
At 16:08 why did you go to 5 from 2 and not 3 in DFS traversal?
@motivation_hubPJ
@motivation_hubPJ 3 жыл бұрын
hi a lot of thanks for this video but just a request if you can make this explaination in hindi. I am unable to understand after first 20 mins. Its not language problem but i am getting confused with the confused . Again thanks a lot.
@techdose4u
@techdose4u 3 жыл бұрын
You can slow the video and watch part by part. You will understand. English is anyway essential for IT. So, you need to learn it sooner or later. Better do it now.
@dysonfilmstw4764
@dysonfilmstw4764 3 жыл бұрын
Can Someone please explain what is low. Am not able to figure it out and its assignment!!
@RAHULSONI-en6dw
@RAHULSONI-en6dw 2 жыл бұрын
low[u]==dis[u] is head node then why low[2]==dis[2] but i t cannot be head node?? at 11:04
Find Articulation Points using Tarjans Algorithm | Cut vertex
33:55
Kosaraju Algorithm | Strongly connected components in a graph
24:30
Самое неинтересное видео
00:32
Miracle
Рет қаралды 2,1 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 153 МЛН
Find Bridges in a graph using Tarjans Algorithm | Cut Edge
23:27
Remove K digits | Build lowest number | Leetcode #402
15:30
Techdose
Рет қаралды 88 М.
Word Ladder | Leetcode #127
19:19
Techdose
Рет қаралды 71 М.
Floyd Warshall algorithm | All pairs shortest path
25:43
Techdose
Рет қаралды 67 М.