Тёмный

Breadth First Search - Finding Shortest Paths in Unweighted Graphs 

Mary Elaine Califf
Подписаться 3,8 тыс.
Просмотров 44 тыс.
50% 1

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 48   
@AdityaSingh-ql9ke
@AdityaSingh-ql9ke 2 года назад
Seriously, there is not a single video for this fundamental concept on the entire youtube, Thanks a lot ma'am.
@maryelainecaliff
@maryelainecaliff 2 года назад
You are certainly welcome.
@NoName-ef2gv
@NoName-ef2gv 2 года назад
This is the single most helpful video on the internet! Saved to my algorithm list for future use. Thank you so much!
@dmytroboiko1
@dmytroboiko1 2 месяца назад
This is great explanation! Thank you very much! 🙏
@maryelainecaliff
@maryelainecaliff 2 месяца назад
I'm glad you found it helpful.
@ethanmartin942
@ethanmartin942 3 года назад
Extremely helpful, best guide like this on the internet
@maryelainecaliff
@maryelainecaliff 3 года назад
Thank you. I appreciate the kinds words.
@niranjanm5942
@niranjanm5942 3 месяца назад
Explained in a way that's very easy to understand and thanks for not giving the code. Now I can try it on my own and test my understanding
@maryelainecaliff
@maryelainecaliff 3 месяца назад
That's my goal. I'm glad you found it helpful.
@jp46614
@jp46614 7 месяцев назад
Amazing explanation thank you very much! I'm actually learning this for a question to get a potential job at Google 😅 (for context the problem involves turning a chess board into a graph and finding the minimum moves from one position to another) I understand graphs and breadth first search in unweighted graphs now completely!
@maryelainecaliff
@maryelainecaliff 7 месяцев назад
I'm glad you found it helpful. Good luck with your interview.
@mehedihasanshameem5347
@mehedihasanshameem5347 3 месяца назад
take love from Bangladesh
@migzleon4047
@migzleon4047 2 года назад
Thank you for sharing knowledge with the world...
@mlevy5722
@mlevy5722 2 года назад
Excellent lecture, the best presentation I've seen so far, so clear and very well documented. I also really like the algorithm you derived as it goes beyond the simple BFS. Thank you Dr Califf!
@maryelainecaliff
@maryelainecaliff 2 года назад
I appreciate the compliment, and I'm very glad you found it helpful. It is certainly true that the fundamental algorithm then applies to many different approaches to searching a graph (or a tree).
@user-rz1uf7dn3t
@user-rz1uf7dn3t 2 года назад
Good lecture! A very good explanation indeed. 13:35 From the start of making the path you can just write from the end to the start of the path array, which saves processing time.
@hanthedeveloper5900
@hanthedeveloper5900 2 года назад
thank u very much for your video ma'am, very very simple to understand
@alifarah9
@alifarah9 2 года назад
thank you professor! keep going :)
@socksforfrogs
@socksforfrogs 9 месяцев назад
Super helpful, thank you so much :)!!!
@maryelainecaliff
@maryelainecaliff 9 месяцев назад
I'm glad to hear it.
@LowescC
@LowescC 2 года назад
many thanks...
@brunoa.colturato5868
@brunoa.colturato5868 2 года назад
Wonderful lecture. Thanks a lot.
@maryelainecaliff
@maryelainecaliff 2 года назад
I'm glad you found it helpful.
@yashwani8155
@yashwani8155 Год назад
excellent !!!
@hikari._.zasureiya1540
@hikari._.zasureiya1540 8 месяцев назад
thanks professor it helped
@maryelainecaliff
@maryelainecaliff 8 месяцев назад
Glad to hear it!
@ryanqway8560
@ryanqway8560 10 месяцев назад
Thanks for the video. How are you storing from, to and cost in the queue. A struct or object?
@maryelainecaliff
@maryelainecaliff 10 месяцев назад
It would depend on the language. Personally, in C++, I would use struct, because an object would be overkill in my opinion.
@abrahamberhe2061
@abrahamberhe2061 8 месяцев назад
Great video, but how do you track the cost when implementing this?
@maryelainecaliff
@maryelainecaliff 8 месяцев назад
In BFS, cost is simply the number of edges. You can keep track and store it in an array as you would for Dijkstra’s as shown here or simply count the number of edges in the path.
@gurukarthikc7870
@gurukarthikc7870 5 месяцев назад
I think there are some mistakes in this video..... Like before analyzing G, B must be analysed as the Queue order is C,B. Meaning after C, B has to be analyzed but the author went with G.
@maryelainecaliff
@maryelainecaliff 5 месяцев назад
The way the items were placed in the queue was C then G then B (just following the picture from top to bottom there). There is certainly an argument for having put the edges in order B, then C, then G, but if the graph was stored in an adjacency list, there's reason they could be in order AC, then AG, then AB. Certainly if C comes before B, there's no reason that G can't also come before B. If you do see some actual mistakes, I would very much appreciate learning of them.
@guneetkaur__
@guneetkaur__ Год назад
Thanks
@maryelainecaliff
@maryelainecaliff Год назад
Welcome
@sarahebal4391
@sarahebal4391 11 месяцев назад
Thank you, professor! I want to use another method than BFS and DFS to find a set of feasible paths (not all the possible paths) between two nodes in a graph do you have recommendations for me?
@maryelainecaliff
@maryelainecaliff 11 месяцев назад
You might consider some sort of priority queue-based approach, inspired by Dijkstra's but putting everything in the priority queue, even after you have found the best path. That would allow you to explore systematically from less to more expensive taking edge weights into account. If you have cost estimates, you could even do something A* inspired, just again including the alternate path in the search process.
@sarahebal4391
@sarahebal4391 11 месяцев назад
@@maryelainecaliff Thank you Prof, for responding, in my problem the graph is weighted, and the cost of edges and nodes has a non-linear function to the amount of flow, this later is not determined in the first step, in this case, how can I get the set of feasible paths?
@maryelainecaliff
@maryelainecaliff 11 месяцев назад
@@sarahebal4391 To answer that would require quite a bit information about the specifics of the problem (and I unfortunately don't have the time to address more than general problem solutions here, since I still have a full group of my own current students to support).
@mugheesmb6694
@mugheesmb6694 3 года назад
hey..! how can we know if the graph is weighted or unweighted??? explain please..! i also search on google but cant understand...!
@maryelainecaliff
@maryelainecaliff 3 года назад
As you look at the drawing of a graph, it's weighted if there are numbers associated with the edges and unweighted if not. When we represent the graph in a computer, for an adjacency list, we'll include a weight for each edge if it's weighted and not otherwise. In an adjacency matrix, the values of cells that represent existing edges will always be 1 in an unweighted graph, but will be the weight if the graph is weighted. Note that when we think about shortest paths, we're sometimes interested in the unweighted shortest path (the number of edges) even in graphs that do have weights. This can particularly be true when the weights represent something different from cost or distance (for example in a network flow problem). At some point I hope to post some videos on graph representations and on network flow, but that may be a few months yet.
@youssefgbb
@youssefgbb Год назад
How do I apply BFS in weighted graphs?
@maryelainecaliff
@maryelainecaliff Год назад
In exactly the same way. Breadth first search doesn't look at the weights it what it is doing. If you're wanting to find the shortest weighted path, then you want to take a look at Dijkstra's algorithm.
@youssefgbb
@youssefgbb Год назад
@@maryelainecaliff Thanks for the quick answer, so can't i use BFS in weighted graph to find the shortest weighted path ?
@maryelainecaliff
@maryelainecaliff Год назад
@@youssefgbb No. By definition, BFS is working with the number of edges, not anything to do with the weights on them.
@youssefgbb
@youssefgbb Год назад
Thank you so much Mary I get it.
@LUONGVANTUTE
@LUONGVANTUTE 2 года назад
very good lecture. but can you show me the code please?Thank you so much!
@maryelainecaliff
@maryelainecaliff 2 года назад
I understand the desire for code, but the goal of these particular videos is to help people understand the algorithm well enough to write the code themselves using whichever graph representation is appropriate and whatever language they are working in. I will note that there is some pseudocode here.
Далее
Dijkstra's Shortest Path Algorithm
11:00
Просмотров 7 тыс.
Starman🫡
00:18
Просмотров 14 млн
Breadth First Search (BFS): Visualized and Explained
10:41
Breadth First Search grid shortest path | Graph Theory
16:51
How Dijkstra's Algorithm Works
8:31
Просмотров 1,3 млн
Lecture 13: Breadth-First Search (BFS)
50:48
Просмотров 701 тыс.
Chapter 1 | The Beauty of Graph Theory
45:23
Просмотров 84 тыс.