G-55. Bridges in Graph - Using Tarjan's Algorithm of time in and low time

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024
  • Leetcode-Problem Link: leetcode.com/p...
    C++/Java/Codes and Notes Link: takeuforward.o...
    DP Series: • Striver's Dynamic Prog...
    SDE Sheet: takeuforward.o...
    Check out our Website for curated resources:
    Our Second Channel: / @striver_79
    In case you are thinking to buy courses, please check below:
    Code "takeuforward" for 15% off at GFG: practice.geeks...
    Code "takeuforward" for 20% off on sys-design: get.interviewr...?_aff=takeuforward
    Crypto, I use the Wazirx app: wazirx.com/inv...
    Take 750 rs free Amazon Stock from me: indmoney.oneli...
    Earn 100 rs by making a Grow Account for investing: app.groww.in/v...
    Linkedin/Instagram/Telegram: linktr.ee/take...
    ---------------------------------------------------------------------------------------------------------------------------

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

  • @rushidesai2836
    @rushidesai2836 8 หลายเดือนก่อน +83

    Had to watch this 3 times to completely understand. Probably the most difficult of the playlist.

    • @az-zm4ji
      @az-zm4ji 3 หลายเดือนก่อน +1

      haha same. my brain got messed up from this algo

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

      I watched this video. And again cam back to watch this after 4 days. Now i clearly understand whole process!!!!!!!!!!

    • @amansingh.h716
      @amansingh.h716 หลายเดือนก่อน

      thanks bro i am leaving this video

    • @princeroshan4105
      @princeroshan4105 11 วันที่ผ่านมา

      Instead of using the conventional approach with DFS tree, subtree of DFS tree, and back edges, he's trying to explain it in an unconventional way, which doesn't seem appropriate for this context. However, I can't really argue, considering he works at Google.

  • @venugopalreddy8596
    @venugopalreddy8596 ปีที่แล้ว +135

    I think this problem is very hard to explain. But striver did it very clearly....Awesome!!

  • @rohinianekar61
    @rohinianekar61 ปีที่แล้ว +51

    Well, in simple words, if the low[] of next node is less than the one which calls dfs for it, then there is a other node through which that node can be reached and which appeared before the one which calls the dfs, Thanks, Well Explained❤

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

      kya bol rhe ho bhaya?

    • @amitdahiya7425
      @amitdahiya7425 11 หลายเดือนก่อน +3

      In Some details => if any adjacent node (except parent) has low time greater than curr node means node and adj node share an edge
      and the adj node is only reachable via this edge , so if we remove this edge we never gonna reach this adjNode , means this edge is a bridge

    • @amitdahiya7425
      @amitdahiya7425 11 หลายเดือนก่อน +3

      otherwise if low time is equal or lesser than curr node time , means that adjnode has other path which takes lesser or equal time than curr node , so if we try to remove this edge we still can reach the adjNode from other path , means they are still connected to each other , the edge is not a bridge

  • @ravisingh-el8np
    @ravisingh-el8np ปีที่แล้ว +28

    striver I know you teach good but just for this video sorry to say but this video is not much clear to a beginner like me and others also ,i watched jenny lecture and love babbar on this topic that was way more clearer. It's just a constructive feedback from one of your students. I watched your entire graph playlist but just for this video and articulation points video i had to refer others.

  • @ABHIMANYUTHAPLIYAL
    @ABHIMANYUTHAPLIYAL 3 หลายเดือนก่อน +5

    had to spend too much time understanding it , now its clear. For those who could not understand this topic , i would suggest watch jenny lecture on bridges in graphs first, then come again to this lec, you will indeed have a lot more clarity.Because striver has explained it beautifully but to understand his approach you must know it from somewhere else before.

    • @thaman701
      @thaman701 3 หลายเดือนก่อน +1

      condition of critical edge why do we check lowest_time[recently popped node] > time[current node] and not lowest_time[current node]? pliz help bro

    • @devanshverma8050
      @devanshverma8050 3 หลายเดือนก่อน +1

      @@thaman701 we won't be comparing with lowest_time[current node] because lowest_time[current node] might have got updated cuz of the adjacent nodes of current node , the thing to note here is that lowest_time[node] doesn't mean that u will take that much time to reach the "node" but it's rather keeps track of the earliest visited node reachable from the subtree rooted at "node" , so while comparing with lowest_time[recently popped node] tells that there might be node connected to it that can be reached earlier and through that further adjacent nodes , and if it's greater than the time[current node] , then there's no point cuz to reach that node u will be requiring that much time at least, and from the recently popped node if u r taking more than that then it's not even possible to reach lower time cuz all other paths will at least take more time than that.

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

      @@devanshverma8050 thnxx bhai

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

    Thanks, I learned bridges before from a lengthy video somewhere and your video is a quick review and saves me lots of time.

  • @shklbor
    @shklbor 11 วันที่ผ่านมา

    zabardust bhai, nowhere is it as clearly explained as this. india is really vishav guru - we teach the entire world

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

    It was hard first but then I watched the video twice and now I understand the problem. Striver is amazing!

  • @40_arkoprovodatta23
    @40_arkoprovodatta23 ปีที่แล้ว +8

    A visited array is not needed, if tin is initialized with -1, we could check if tin[i] == -1. Btw, an amazing explanation. ❤

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

      can u please tell me why my code does nt work for larger test cases
      vectorans;
      void dfs(int node,int dad,vector&low,vector&visited,vectorgraph[]){
      visited[node]=1;
      low[node]=node;
      for(int j=0;jlow[node]) {
      ans.push_back({node,t});
      }
      }else if(low[t]

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

      @@cr7johnChan your condition low[t] > low[node] is wrong, it should be low[t] > in[node]

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

    hell yeah! Finally completed the series. Thanks a lot Striver!

  • @nealgautam1882
    @nealgautam1882 ปีที่แล้ว +21

    In the LeetCode problem, it has provided connected graphs as input however, for added functionality for disconnected graphs, the function call for dfs can be done like this:
    for(int i=0;i

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

      only if the question was named as find the critical connections in all the networks

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

    this is only explanation can be for this tough question on youtube thanks striver !!

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

    Had to tell this!!
    First of all thank you very much for all the playlists!
    Secondly, how can you be soo good at knowing what we understand and we don't.
    @3:26 timestamp, you just knew that the first timer's might not understand, and you assure we will understand it later.
    its like 1:1 where we tell we didn't understand, and you say that you'll understand later in the lecture.
    Damn nice!

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

    Insane stuff . So well explained

  • @stith_pragya
    @stith_pragya 10 หลายเดือนก่อน +1

    Understood, Thank You So Much for this wonderful video...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @iamnoob7593
    @iamnoob7593 21 วันที่ผ่านมา

    Hey Striver what a superb video , Came back to revise , Fantastic understood.

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

    condition for bridge is low[node] > tin[neigh] and not low[node] > low[neigh]
    bcz for eg if node is 8, it can have low 3/6, and if neigh is 10, it can have low 3/6
    so we can't compare lows of each other nor can we track just the current low and increment and decrement later as all nodes should be unique
    so tim array is used

  • @lavanya_m01
    @lavanya_m01 7 หลายเดือนก่อน +2

    INTUITION:
    Let nodeA be a parent and nodeB be it's adjacent node.
    Bridge exists between nodeA and nodeB only if nodeB is not already visited and the lowest time of nodeB (the lowest time gathered among all it's adjacent neighbours) is greater than the time of insertion of nodeA. Hence nodeB cannot reach nodeA.
    We're checking for a bridge only if nodeB is not already visited because, if it was already visited, the existing edge is like a cycle (i.e another way of reaching nodeB through nodeA) So even if we remove this edge, we can anyway visit nodeB from the path that we came.

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

    a tough problemmm but you explained it really well!!! Thank you so much!!!

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

    God!! How could you explain it so nicely.... Thank you so much for the explanation

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

    yr bhai hard ko itta simple Hats off to you bhai🤗🤗

  • @isheep9025
    @isheep9025 ปีที่แล้ว +20

    alternative method:
    an edge can be a bridge if and only if its is not a part of a cycle

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

      this method will take O(e(v+e)) time. you will need O(v+e) time for every edge to check if it is in a cycle.

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

    Ok got it after watching twice but i guess it will take some time to digest .Thanku Striver Sir

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx ปีที่แล้ว +1

    Understood! This was the question asked by google when I was in college. Only if this resource was present then :)

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

      Which company are u in now?

  • @saillaanil2604
    @saillaanil2604 10 หลายเดือนก่อน +2

    the inititution is:
    the "tin" vector stores the steps/order in which we are visiting the nodes and the "low " vector is used to store the recent/(previously visited) node from which we can visit the current node. So if their is no previously visited to reach that node then it is a bridge.

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

    thank you sir , i understood , after this can you make vedios on further depth topics in graph like flows and cuts etc.
    your explanation is the best on the youtube.
    i would like to purchase your courses for competitive programming , if you are teaching.

  • @meepo-yk7jc
    @meepo-yk7jc 2 หลายเดือนก่อน +2

    I realized that Tarjan's algorithm not only can find the bridges but also Strongly Connected Components(SCC), learn a lot, thanks Striver

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

    u did the best possible to make me understand ..thankyou

  • @20je086Saphal
    @20je086Saphal ปีที่แล้ว

    //to reach the nbr needs for time than node's insertion i.e. only possible when nbr is solely traversed via that node hence it is critical component or a Bridge!
    if(time[node] < low[nbr]){
    bridges.push_back({node,nbr});
    }

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

    you are also a good english teacher

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

    Understood. Great explanation for a Hard problem.💯

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

    Crystal clear explanation thanks a lot

  • @PriyanshuVerma-p9b
    @PriyanshuVerma-p9b 3 หลายเดือนก่อน

    Awesome explanation man ----------Thankyou so much

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

    Amazing explanation , cleared my doubt why we are not considering parent edge. Thanks !

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

      yes i struggled it too. The main concept behind this algo is , let's say if a parent left its child , and if child don't have access to its ancesstors or grandparents , then the child can't be connected to it's lineage , i.e its a bridge between parent and a child (child don't have any back edge).
      The second point is why we are not looking for the low time of parent is, if we closely look into dfs , and let's say a parent have many childs but while dry running we choose any one of the child and move forward to do dfs with that choosen child and while again returning we give chance to the other child from the rest ones , so a parent updates it's low if it's any of the child's low is smaller that is if any of it's child is connected to the ancesstors , that means the parent can also access to it's parent via his child. But a child don't update it's low with it's parent's low because in dfs we came to dfs of child and parent is visited and irrespective of whether a parent have access to it's ancesstor or not , but it's already visited so we can't go back to tha parent . :)

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

    amazing striver!! your are a true genius

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

    bhaiya, after the end of the playlist, please provide us a list of all the problems you solved in one place(similar to the sde sheet). It would be a great help when we will do the revision of the graph

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

      It is there on the website

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

      @@takeUforward thank you so much

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

    Great explanation to such a hard prob. Understood!

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

    Understood!! Explanation was very clear :))

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

    Awesome explanation and presentation as well

  • @16avikasgupta70
    @16avikasgupta70 ปีที่แล้ว

    My bro got some different level of energy

  • @UECAshutoshKumar
    @UECAshutoshKumar 9 หลายเดือนก่อน +1

    Thank you sir 🙏

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

    Understood sir!!! Such an awesome explanation!!! Loads of thanks sir😄

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

    Understood! So amazing explanation as always, thank you very much!!

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

    In the else case at line 22, it should be low[node]=min(low[node],tin[it])

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

      yes

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

      can u please tell me why my code does nt work for larger test cases
      vectorans;
      void dfs(int node,int dad,vector&low,vector&visited,vectorgraph[]){
      visited[node]=1;
      low[node]=node;
      for(int j=0;jlow[node]) {
      ans.push_back({node,t});
      }
      }else if(low[t]

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

      No, it is fine. Watch the explanation again

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

    Took me watch the video 2 times to understand but yeah understood!

  • @youracademicfriend-shashwa1051
    @youracademicfriend-shashwa1051 3 หลายเดือนก่อน

    Thankyou!!
    Nice explanation

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

    Very nice explanation!

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

    Great explanation. Thank you

  • @abhirupadhikary4274
    @abhirupadhikary4274 3 หลายเดือนก่อน +1

    For condition of critical edge why do we check lowest_time[recently popped node] > time[current node] and not lowest_time[current node]?

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

      same query did u get the answer??

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

      @@thaman701 Nope

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

      @@abhirupadhikary4274 😆😆😆shi h.bhai

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

    Good explanation.

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

    Us, but indeed a HARD Problem. Like Go through multiple times the video, think a lot internally in the brain. Then Code.

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

    I wish I could talk to my code the way you do ❤

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

    understood sir thankyou for your teaching

  • @VarunSharma-xd8xd
    @VarunSharma-xd8xd 7 หลายเดือนก่อน

    great explanation

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

    understood !! beautiful explanation

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

    You're realy great ❤

  • @GANESHSINGH-uc1gk
    @GANESHSINGH-uc1gk ปีที่แล้ว

    dayummm....amazing explanation!!!!!!!!!

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

    understooood 🐼

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

    Please add a video for Kuhn's algorithm

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

    This was difficult! But Understood!

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

    Thank you striver sir!!

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

    Understood SIr!

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

    why we cannot compare low[node] < low[it] instead of tin[node] < low[it] for finding a bridge ?? can anyone give an example ?

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

    Comments Padke and Video dekh ke I felt thoda lost , doosri teesri baar dekhne pe thoda anaolgy se samjhne ka try kiya then samajh aya thoda kya hora hai.
    theek toh m thoda samjhane ka try karta hu , suppose
    1.) TIN[ node ] is ki mujhe is node tak aane m kitna time laga ,
    2.) LOW[ node ] tells ki mujhe is node pe aane pe minimum kitna time laga.
    ab ise dekho , suppose m parent pe khada hu aur m child pe gaya tha ->
    when we got a bridge :->
    parent -> dekh child mujhe khud tak aane m TIN [ parent ] = 8 sec(suppose) lage hai toh m tujh tak toh 9th second m pahuch jaunga
    child -> yaar parent 🥲, mujhtak toh minimum aane m hi LOW[ child ] = 10 sec lag jayenge , kaha se ayega tu mujhtak
    TIN[ parent ] < low [ child ].
    hence we got a bridge.
    when not a bridge :->
    parent -> dekh child mujhe khud tak aane m TIN [ parent ] = 8(suppose) sec lage hai toh m tujh tak toh 9th second m pahuch jaunga
    child -> are parent mein toh khud par LOW[ child ] = 6 sec m hi pahuch jaunga , tu esa kar mere saath aja , jaldi pahuch jayega
    LOW [ parent ] = LOW [ child ].
    let's write a pseudo code using this analogy
    dfs( node , parent , timer ){
    visited [ node ] = true; // mark myself visited
    tin [ node ] = low [ node ] = timer; // noting the time at which i came on this node
    timer++; // increase the timer
    // get all neighbours
    for( nbr : adj [ node ] ){
    if(nbr == parent ) continue; // leave it
    if(visited [ nbr ] == true ) {
    // lol , phele se hi visited hai definetly kisi aur raste se aya hoga isliye visited hogya
    // sirf low ki baat cheet kar sakta yani mein
    low [ node ] = min( low [ node ] , low [ nbr ] );
    }else{
    // visited nahi hai , yani yaha m parent child wali baate kar sakta hu , child mera nbr ban jayega , parent meri node
    dfs( nbr , node , timer + 1)
    // now , parent bolta , mujhtak aane ka time TIN , tu tera minimum bata
    // mereko minimu hi LOW[ nbr ] time lagra 🥲, tujhe toh aur time lag jayega
    if( low [ nbr ] > tin [ node ] ){
    // found potential bridge
    }
    // mereko minimum LOW[ nbr ] time lagra , aur yeh tujhtak ( parent ) pahuchne ke time se better hai , ise badiya tu mere through aja
    else{
    low [ node ] = min( low [ node ] , low [ nbr ]);
    }
    }

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

      samakj ni aaye toh ek baar is analogy se dry run karlena , ajaye toh badiya

    • @Aman-dl6cf
      @Aman-dl6cf ปีที่แล้ว

      BEST COMMENT EVER , 🔥🔥🔥🔥

    • @Aman-dl6cf
      @Aman-dl6cf ปีที่แล้ว

      THNX

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

    Awesome striver👏

  • @mayankjain-901
    @mayankjain-901 6 หลายเดือนก่อน

    Can't we only use minTime to compare and find the edge is bridge or not , like minTime[node] < minTime[child] , then it is a bridge ,assuming minTime will also be equal of nodes that have a edge and it is not a bridge ?

  • @amittiwari360
    @amittiwari360 8 หลายเดือนก่อน +1

    why low[it]>tin[s] , and not low[it]>low[s] , please tell me because when i did this 15/17 test case pass , i am not able to make that graph condition where this is failing , please help me striver.

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

      I had the same doubt, did you find the answer for this?

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

    for directed graphs, we have kosaraju algo. for undirected graphs, there is tarjan's algo. right??

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

    understood,great explanation

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

    Didnt understood the if condition ,where we are collecting the bridges.
    why are we taking low[it]>tin[node] ?

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

      If the adjacent nodes lowest time is smaller or equal to current node, so it can reach again via some path, so if its greater, it cannot!

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

      @@takeUforward okay got it , Thanks !

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

      @@takeUforward can u please tell me why my code does nt work for larger test cases
      vectorans;
      void dfs(int node,int dad,vector&low,vector&visited,vectorgraph[]){
      visited[node]=1;
      low[node]=node;
      for(int j=0;jlow[node]) {
      ans.push_back({node,t});
      }
      }else if(low[t]

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

      @@cr7johnChan i have also same doubt bro u check your if condition if(low[t]>low[node]) i think this also should work but dont know why its not working

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

    why did you take the timer as global variable. Cant we pass it from main?

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

    But "10" is already visited so as he said later in the video that visited child can't be bridge so i don't understand can anyone tell me

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

    Understood! :)
    Thank you! 😊

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

    Understood :)
    Sep'5, 2023 07:27 pm
    Pretty much complex

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

    Is this new leetcode UI available to everyone?? because mine is still normal and this one looks super cool!
    Btw awesome explanation..Crystal clear

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

    getting a TLE in a testcase having n=1000 and a very large number of connections

  • @TranTrungKien-us1lu
    @TranTrungKien-us1lu ปีที่แล้ว +2

    can we call "TUF" is "The University Free" ?

  • @GAURAVSINGH-t9p
    @GAURAVSINGH-t9p 4 หลายเดือนก่อน

    Why do we need tin array, why cant we just solve it using low array, cant we just change
    if (low[it] > tin[node]) {
    bridges.push_back({it, node});
    }
    to
    if (low[it] > low[node]) {
    bridges.push_back({it, node});
    }
    Where does it fails, i tried finding the counter example but wasn't able to

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

    to check for bridge cant we use if(low[node]!=low[child]){ then there is bridge} cant we use this?

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

    for input
    connections as
    1 2
    3 4
    4 7
    7 8
    8 5
    4 5
    will it work?? i think we sluld add one more for loop in main??

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

    This algorithm is for directed graphs, how have you assumed an undirected graph?

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

      Tarjan algo is used in directed graphs to find the scc. But for bridges, it is applied to undirected graphs. In directed graphs, edges have a direction. The concept of a "bridge" in a directed graph is more complex because the directionality of edges influences connectivity differently.

  • @sivakumar-wr1hn
    @sivakumar-wr1hn ปีที่แล้ว

    Just wondering if we find node with only one incoming edge and its parent would be the part of result.

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

    lil complex but will watch thrice

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

    Understood striver😇

  • @amritanshu1402
    @amritanshu1402 11 หลายเดือนก่อน +2

    Loved the way you explained such a hard concept in the easiest manner! Thanks a lot.
    Guys the least we can do is to smash the subscribe and the like button :)

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

    brute force
    remove each edge and check the number of components if its greater than 1 return edge;

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

    y didnt you check minimum adjacent for node 5

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

    Why it is not working for finding the number of connected components as the number of connected components should be number of bridges+1
    Can anyone tell me the reason..

  • @ramyashrip9791
    @ramyashrip9791 9 วันที่ผ่านมา

    No audio after 0:23?

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

    If anyone of you is having dought that why this condition is being writter low[node]= min(low[node], disc[neighbour]) instead of writing low[node]= min(low[node], disc[neighbour]) this then please jenny mam lecture on this topic . I am sure that all your doughts will be cleared

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

    please make playlist on cp

  • @Yash-uk8ib
    @Yash-uk8ib ปีที่แล้ว

    Can this be somehow done with dsu?

  • @Jenia-ou6vt
    @Jenia-ou6vt ปีที่แล้ว

    Why do we have to declare timer globally? Can anyone explain?

  • @-VLaharika
    @-VLaharika ปีที่แล้ว

    Understood 👍

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

    i got it wow explanation

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

    thanks

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

    Understood ❤

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

    Superb

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

    Understood 🔥🔥

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

    Why can't I just check indegree vector, if it has only one component means it has to be bridge
    Edit: Got the mistake...