Your methods are great, I was very confused about cycle detection in directed and undirected graph but you solved my problem. Thanks a lot. Subscribed already
I got stuck in one of my leetcode question ...thank you for this super clear explanation mam ... and one more think is that i found solution to this also in gfg but in that i had some doubt .Now its pretty clear .
Ma'am all the videos are very nice and give clarity in the required topics. I request you to please make a proper playlist of all the uploaded videos in the order they should be studied .I feel that in the existing playlist the videos are not in correct order.
G 250 6:30-6:41 main summery of the video is this 11 second(if you find adjacent vertex with flag 0 then its cycled graph. 10:00 worst case time complexity O(V+E)
ma'am in the beginning at vertice B i decide to go for D instead of C then what will happen to C? will it remain unvisited as the cycle already got detected or is there any further step?
In your algorith, you started from A and traverse along with it's adjacent with the help of stack. what would happen if you start with c? it doesn't have any adjacent so you popped it from stack, now what you will do?
Hi ma’am you are a wonderful teacher. There seems a problem in the approach as cycle detection in graph is different from tree . Coz in a graph a vertex can have multiple parents. in the same example , If you take only vertex A B And C . There is no cycle . But your method will indicate it as a cycle.
No, it won't. When the algo comes to C, before it can move back to A and then find the other way to C, the flag of C will be set to 1. The algo only indicates a cycle if the flag of a successor is 0. This can only happen if there is a cycle, because the flag of any vertex is set to 0 only while the algo is looking at the successors of this very same vertex. Therefore if you come to a vertex with flag 0, this means that this vertex is its own successor.
if there is an edge from e->c will that be considered a cycle? and also in geeksforgeeks they haven't provided the source how to find out the source in order to compute the cycle
Hello Ma'am, I have a question how can a graph be traversed if the source node selected is the end node. In short i want to know how to select the appropriate node for traversing
Hi nice video but I don’t think it works in all the cases since ur checking if we are trying to push an element which is already in stack ,but consider the following adjacency list (0 1,7) (5 0) (7 1) here 1 will be in stack when coming from 0 and we will try to push again 1 into the stack while coming from 7 but there is no cycle present so just checking duplicates in the stack doesn’t detect cycle. Correct me if I am wrong
I think ma'am, with this approach we cannot detect cycle if we don't give out Proper source node like for e.g tried with source as 2 as we don't know the parent at the start so say -1
For that, we want to start with any node, without having the knowledge of parent we need to count the indegree for each vertex and then select the node having indegree as zero
Your methods are great, I was very confused about cycle detection in directed and undirected graph but you solved my problem. Thanks a lot. Subscribed already
brilliant lady this is the best explanation in the entire internet for DFS and cycle detection
Thank you, mam, for such a wonderful explanation. I tried to write my own algorithm similar to this, but it has a few flaws. Your algo is excellent.
Thanks for the awesome explanation. I had struggled with understanding this for so long until I found this video 👏🏾👏🏾
I had struggled to understand what was written on the board
I got stuck in one of my leetcode question ...thank you for this super clear explanation mam ... and one more think is that i found solution to this also in gfg but in that i had some doubt .Now its pretty clear .
Saviour of ds subjects🥲 jai ho jenny mam ki☺
Thanks a lot for covering all the cases I've been looking for.
Thank you Jenny, i finally understand concept
Great Job Maam..Stay Blessed...
i love your eyes
why bro?? lol
Bhai Apne video me Bolte ho Jenny aur Tushar ne Sahi se Nahi padhaya aur Yaha aake nice explaination comment Kar rahe ho... Sahi hai Bhai✌️
Sir aap yha XD
@@manojnagthane Hypocrisy
Eyes to waise mast h
are guruji,aap yaha kaise??
very well explained, thank you very much .
I am trying to keep my eyes off but its not closing becz of ur teaching its osm to be u as our teacher ❤️
Thank you mam. This video helped me code it the right way.
You are doing great,.
Awesome explanation,
Thank you
Ma'am all the videos are very nice and give clarity in the required topics. I request you to please make a proper playlist of all the uploaded videos in the order they should be studied .I feel that in the existing playlist the videos are not in correct order.
Okay. I will
thanks . done it right in first attempt .
ur teaching method is awesome ma’am. 😀😘
the explanation was good, can be made better if code was explained after the explanation of algo
Ok
Thank you so much mam, you have explained very well.
G 250
6:30-6:41 main summery of the video is this 11 second(if you find adjacent vertex with flag 0 then its cycled graph.
10:00 worst case time complexity O(V+E)
thank you, it's really easy to follow
Finally i understood a topic
if you implemented the code,ya share.
Awsm explainations please continue this amazing work ,💜💜
you make it look so easy, can you please also discuss the code for the same thanks,
ma'am in the beginning at vertice B i decide to go for D instead of C then what will happen to C?
will it remain unvisited as the cycle already got detected or is there any further step?
In your algorith, you started from A and traverse along with it's adjacent with the help of stack. what would happen if you start with c? it doesn't have any adjacent so you popped it from stack, now what you will do?
Md Hossain we can then use a for loop ,for n vertices,and start all over taking each vertices as my starting node...I hope so this will work
The ideal protocol would be start with a node which has the in-degree 0. This will work always. Hope this helps.
Hi ma’am you are a wonderful teacher.
There seems a problem in the approach as cycle detection in graph is different from tree . Coz in a graph a vertex can have multiple parents.
in the same example , If you take only vertex A B And C . There is no cycle . But your method will indicate it as a cycle.
No, it won't. When the algo comes to C, before it can move back to A and then find the other way to C, the flag of C will be set to 1. The algo only indicates a cycle if the flag of a successor is 0. This can only happen if there is a cycle, because the flag of any vertex is set to 0 only while the algo is looking at the successors of this very same vertex. Therefore if you come to a vertex with flag 0, this means that this vertex is its own successor.
I'm still unclear with the need of parent map. Using stack itself we can identify the cyclic path. Please correct me if I'm wrong.
Parent map is required to find the node which is responsible for creating cycle.
Why wouldn't the stack be sufficient for that?
@@stalera Seems like you are correct.. if we pop the element from stack till B we will get the cycle.
great vid as always ,what would the space complexity be ? is it O(v + e) aswell ?
I made one without using flag. the idea is to jot down the vertices when we traverse to a node that has an edge directed to the root
will you please provide the code of algo used in lecture
ya,i need the same.
my mom said to follow my dreams so i subscried you and i follow you
if there is an edge from e->c will that be considered a cycle? and also in geeksforgeeks they haven't provided the source how to find out the source in order to compute the cycle
no that would not be considered as a cycle
if its visited, but popped out of the stack, is it a cross edge?????
Where can I check a code implementation of this algorithm, please?
Beauty with brain !! 🌹
Practice code- leetcode.com/problems/course-schedule/
leetcode.com/problems/course-schedule/discuss/663857/C%2B%2B-or-DFS-Solution-with-explanation
Hello Ma'am, I have a question how can a graph be traversed if the source node selected is the end node. In short i want to know how to select the appropriate node for traversing
hi great vid - can you use the same algo for directed and undirected graph?
Mam can you please make a video on printing have unique paths in a graph and that not involved in forming a cycle in a graph
Hi nice video but I don’t think it works in all the cases since ur checking if we are trying to push an element which is already in stack ,but consider the following adjacency list (0 1,7) (5 0) (7 1) here 1 will be in stack when coming from 0 and we will try to push again 1 into the stack while coming from 7 but there is no cycle present so just checking duplicates in the stack doesn’t detect cycle. Correct me if I am wrong
u r wrong. flag= 1 while moving from 7 to 1. and flag=-1 while moving from 0 to 1.
Please can someone write a Pseudocode or C/C++ or python or java code for this
Me too, i need the python code
@@maryamboubekraoui1096 its easy actually
How about disconnected graph??
I think ma'am, with this approach we cannot detect cycle if we don't give out Proper source node like for e.g tried with source as 2 as we don't know the parent at the start so say -1
For that, we want to start with any node, without having the knowledge of parent we need to count the indegree for each vertex and then select the node having indegree as zero
I love u mam💖💖💖💖🥰🥰🥰🥰🥰🥰🥰
Mam count the 6 cycle ? Please the solution.
but a,b,c are also cyclic why did we not consider it?
@@aadillakdawala1577 did you find out
Abc is not a cycle since the edge is from a->c
Mam aap codechef ka editorials daaliye..
long challenge ya short challenges ka
Ma'am ABC also form cycle
ABC does not form a cycle, you can go from A to B and then B to C but can not go C to A(since arrow point from A to C) so ABC does not form a cycle.
Hello,is it possible to share the code of this solution with us. If it is,please share.
Code is missing in your explanation
Can't we use BFS to detect cycle in directed graph?
I followed the BFS approach for this example in the video but not getting the expected result.
mam thodi loud banaya kro vedio plzzzzzzzzz
Can you please provide us the code
Order of video 6.8 and 6.9 is wrong, reverse it
If you remove BE, there is still a cycle BACB.
No.. it is directed graph..
Is Programming possible for you to teach Madam. Only Concepts I see.
Konsi class me pdhta he tu
Ma'am board pr concentration hi nhi ho paa rha aapko dekh kr... 😍
You are so pretty!
atleast try to maintain the quality of video minimum 720p
Thanks for suggestions... Will do that form now onwards
Day 66
please don't put soo many ads in the video they are annoying
🤨will take care in later videos..
@@JennyslecturesCSIT thank you ma'am I cleared my exams bcoz of your lectures 🥺😭
one of the annoying things in your vide is the long green text at the bottom (like subscribe.......). its too long
I wish you were my girlfriend :) what about the complexity of finding all cycles? same?
Bolti Aankhain
a very beautiful woman