Your teaching approach reminds me of one of my previous teachers, who was unparalleled (atleast for me) ... Thank you sir for such content
@leviackerman98824 жыл бұрын
I couldn't understand anywhere why it needs to run at most n-1 times And you made it super easy with that example Thank you so much ❤️
@rahulsawant2093 Жыл бұрын
Because there can be at most n-1 edges in the graph, so to resolve (relax) each edge length, we should take the worst case scenario.
@anubhavagrawal39634 жыл бұрын
Probably the best videos for graph theory on youtube. hats off.
@dardev8360 Жыл бұрын
Thank you. I will be more active henceforth. Any ideas on how we can become more popular?
@s.d8756 Жыл бұрын
@@dardev8360 Sir, use a facecam for your videos. It may help. also consistency can help. Create decent social media personality. Lastly, just put out quality content like this, nothing beats content. Once you put out content, it is just waiting for the masses to discover this beautiful channel.
@satyamchhatrala934 жыл бұрын
Very nice playlist !! Highly Appreciated
@Mr_D0T2 жыл бұрын
Man you are a gem , i was so confused after reading solution in positive cycles
@dardev8360 Жыл бұрын
Man, you are THE gem. You took out the time to write such a sweet comment. Any ideas on how we can become more popular?
@rounakagarwal16003 жыл бұрын
Couldn't find the best video other than this on youtube
@amoghhuddar64088 ай бұрын
Great work dude! Was so confused on why we require n-1 relaxations to propagate anything and you just explained it all so nicely. Thanks a lot man! Also some newer tc were added on cses like a graph with a single node with self loop with weight 1. You will have to run n relaxations on it cause n-1 is just 0. Do make more videos. Amazing Content❤
@youknowwho321 Жыл бұрын
solution starts at 29:00 ( For those who already knows Bellman-Ford's Algorithm)
@manusisodia58149 ай бұрын
for those whose solution is not accepting add this condition if(n==1) { bool check=false; for(auto e: edges) { if(e.third
@m.e.t.a.l31254 жыл бұрын
You are very much underrated! Awesome channel to learn Graphs..
@paragroy53594 жыл бұрын
Thanks for this playlist really helpful...
@dardev83604 жыл бұрын
Cycle Detection in Directed Graph coming up in a few hours! Stay tuned and Stay updated
@loudcapricorn5513 Жыл бұрын
Really very great learning video. 💯 Especially relating everything to past learned topics like Djikstra, BFS, etc
@dardev8360 Жыл бұрын
Glad you liked it
@crazyfootball22714 жыл бұрын
The series is good. In this particular video , there is a mistake at 5:21. You have shown 2 graphs , Djikstra will work for the first one but not for the second one. Djisktra would only fail if there is a negative cycle (not a negative edge). Hence , it would work for example at 5:21.
@abhishekpandey78593 жыл бұрын
yes that what i was also thinking
@yashbansal15203 жыл бұрын
It will not work in case in case he is taking a visited array else if we are relaxing the nodes without a visited array it will work.
@jaishriharivishnu27 күн бұрын
seriously! you made it damn easy, I was complicating it.
@matheuscardoso11104 жыл бұрын
this video is really great, congratz!
@manaskumarpanda33432 жыл бұрын
i'm addicted to your videos for cses problemset problems 💚
@dardev8360 Жыл бұрын
That's how I want it to be! Stay addicted to the good stuff, man! Looking forward to suggestions.
@priyankarrajgupta41984 жыл бұрын
Very well explained. I dont know why ur videos have such a low view count Are u using Windows XP ?
@dardev83604 жыл бұрын
I also don't know why low view count. I use Windows 7 with Classic Theme.
@dardev83604 жыл бұрын
Share more please? So my views increase and do subscribe!
@AnkitMishra-sq9nf4 жыл бұрын
@@dardev8360 sir, make your video titles that people will search for normally, dont put in video number as the first thing in your title , just give simple headings and ue keywords ony so that your channel is shown in search results....like "bellmanford algo" or "cses graph algo qustions"......there are more searches for bell man ford algo rather than csse playlist and even less searches for the big title that you generally put in your titles.....you can put rest of the info in your descriptions...
@pabitrakb52919 ай бұрын
Best postmortem of Bellman Ford algo ever possible ❤
@abhipatel133113 жыл бұрын
Great content brother🙏🏻
@sibashissom340425 күн бұрын
Thank you so much for this.
@nishuz4 жыл бұрын
Nice video. But at 1:33, the path from 1 to 4 should be 4, not 2, right?
@dardev83604 жыл бұрын
Right. Sorry! :( Thanks for pointing it out.
@s.d8756 Жыл бұрын
Extremely Helpful video. Thanks a lot. Are your courses availabel on any other platforms? and why you have only videos on graph? Would love to see your vieos on other topics as well.
@androidguruji45423 жыл бұрын
superb explanation really helpful , thank you . keep uploading new videos love to watch it........
@rupeshkataria81 Жыл бұрын
I have one doubt since there are m edges so we should start loop from 1 to m instead of 1 to n in bellman_ford function because your code fail for this input when n=1,m=1 and the edges are 1 1 1 . So edges start from 1 and end at 1 and the weight of edge is 1. its right answer is -1 but your code give 0 .Since for n=1 I our bellman_ford function would not run if I use m instead of n it give wrong output on many test cases
@haribooshan7457 Жыл бұрын
I had just changed the number of iterations to max(n-1,1) instead of n-1. This seems to work.
@mohitahlawat4944 Жыл бұрын
Dijkstra's will work if there is a negative edge. only thing is that the graph should not have any negative edge cycle
@anishsinghdhami2557 Жыл бұрын
It only worked, because of our implementation details. But according to the concept he taught it won't work because we won't be visiting or considering those vertices again which have been processed once(i.e. those vertices which is once taken out of the min_heap) will not be considered to do the relaxation for the remaining vertices. Hope the explanation makes sense if not do a google search and look for some of the stack-overflow articles.
@sachinsingh19564 жыл бұрын
this was a great solution i have ever seen.
@aadityaupadhyay62644 жыл бұрын
Thanks for this video. Wonderful explanation
@dardev83604 жыл бұрын
You are welcome Aaditya. I am impressed that you have kept up with the series! I will be making Floyd-Warshall and posting tonight! Stay tuned!
@aadityaupadhyay62644 жыл бұрын
@@dardev8360 ya sure brother, waiting for more videos to learn the concepts
@159_mdamirulislam83 жыл бұрын
This man deserves more views and likes. Thanks.
@tarunjayadevan59813 жыл бұрын
sir you are amazing ! Thanks so much for such videos .... really helpful ..
@dardev8360 Жыл бұрын
I am glad that I am able to help! Will make more content. What else would you like to see?
@raghavmittal53524 жыл бұрын
Great explanation
@sdmfslkdm8 ай бұрын
if we are adding the cap to the dist[v] to inf , wouldn't it make it our answer to change
@bhanuprasadbellam31077 ай бұрын
Good explanation
@sommayghosh46172 жыл бұрын
I had a doubt your solution is correct and gets accepted , but the idea behind bellman ford is that after n-1 times , if we are again getting a shorter path for the nth time then there is a negative weight cycle but it doesn't get accepted few wrong answers came, but when i did like u , i.e again for n-1 times it got AC, can u tell the intuition behind it?
@yath36812 жыл бұрын
The negative weight cycle that we are getting should also be involved in the 'shortest path' from 1 -> n in our negated graph. If we found a negative cycle in our graph , but it is in no way involved ini the 'shortest path' , then the answer would not be -1.
@vinayverma88972 жыл бұрын
Bro can you share the code pls
@shishankrawat2105 Жыл бұрын
"You may go through a tunnel several times." And we don't necessarily have to stop when we reach the Nth room. This means that if we can reach the Nth room with some distance, say d... and then from the Nth room back to room 1, such that now the distance of room 1 is less than 0. So we can re-iterate this path again and again. So, to confirm it what we can do is run cycle N times and then another (N-1) times and then finally see the distance values.
@dhairya74603 жыл бұрын
Sir I have a doubt please help me out. What's my claim is that if we reaches a node that doesn't have any outgoing edges we simply popout that node from priority queue so at the time of poping out if we mark that node as visited then we can't have to face negative cycle. Am i correct sir?
@KhemendraBhardwaj Жыл бұрын
did you able to find it out?
@Rajjain_3 жыл бұрын
these are really good. thanks
@beonthego87252 жыл бұрын
Thank you Dardev
@dardev8360 Жыл бұрын
You are welcome!
@kaukuntlaprudviraj108 Жыл бұрын
Is it mandatory to convert the edge weights to it's negative form, in relaxation why can't we maximize the distance in place of minimizing
@optimus_prime0110 ай бұрын
do a dry run, that's how you learn
@madhvansharma59173 жыл бұрын
Hi, I had a question. I took INF as LLONG_MAX and NINF as -INF. I saw that the code didn't work for some testcases whereas when I took the values of INF and NINF same as in the video, then the Code executed nicely. Could u tell me why is that ?
@AkashKumar-im2zy3 жыл бұрын
It is due to overflow,(The maximum value that the variable can store is LLONG_MAX), LLONG_MAX+d will result in overflow, whereas some user-defined infinity like INF= 1e16 will not overflow because INF + u value is still less than the max size the long long variable can store!
@prime_edits0074 жыл бұрын
well explained dude :P
@dardev83604 жыл бұрын
Thanks, dude! :P
@paragsaini27953 жыл бұрын
Your r awesome!! Great explanation. 🔥
@NiteshKumar-xm3nq6 ай бұрын
your code is giving wrong answers for self loops . try submitting it .
@litcode7022 жыл бұрын
excellent...may I know from where you learnt in this much depth?? nowhere this kind of explanation is given
@dardev8360 Жыл бұрын
Glad you liked the video. I learned stuff on my own. Do you want me to continue the series? :D
@lichuphy Жыл бұрын
2 words: THANK YOU
@dardev8360 Жыл бұрын
You are welcome! Subscribe for more!
@gantagourish75362 жыл бұрын
I have a doubt. let the input be 5 5 1 2 1 2 3 1 3 4 1 4 2 1 4 5 1 according to your code it will give -1 because 2->3->4->2 will form negative cycle(as edges weight are converted to -ve) but when we draw graph on paper we can see path as 1->2->3->4->5 with score 4. can you explain please.