1 00:00:16,800 --> 00:00:18,861 Akin: And today I will present to you 2 00:00:18,861 --> 00:00:22,150 one of the most interesting topics in my field of study, 3 00:00:22,150 --> 00:00:24,090 which is graph theory. 4 00:00:24,090 --> 00:00:28,710 Um, I know the topic might sound a little bit intimidating, 5 00:00:28,710 --> 00:00:32,568 but what you need to understand this presentation is 6 00:00:32,568 --> 00:00:33,460 quite simple. 7 00:00:33,460 --> 00:00:36,870 So, if you can do the basic math, 8 00:00:36,870 --> 00:00:39,427 like simple additions or simple multiplication, 9 00:00:39,427 --> 00:00:42,170 you are pretty good to go. 10 00:00:42,170 --> 00:00:44,626 And what you'll need is the observation skills 11 00:00:44,626 --> 00:00:48,833 and that's probably all you need to have for understanding 12 00:00:48,833 --> 00:00:51,719 this presentation. 13 00:00:51,719 --> 00:00:55,229 Before I jump in, can I ask like, if any of you guys 14 00:00:55,229 --> 00:00:58,930 have been familiar with this topic before? 15 00:00:58,930 --> 00:01:02,469 Student: A little bit, a little bit. 16 00:01:02,469 --> 00:01:05,780 Akin: Okay, um, yeah, I hope you get something out 17 00:01:05,780 --> 00:01:06,780 of today's presentation. 18 00:01:06,780 --> 00:01:09,110 Hope it will be useful. 19 00:01:09,110 --> 00:01:10,370 Okay. 20 00:01:10,370 --> 00:01:14,882 Okay about today's agenda, we'll go over some definitions 21 00:01:14,882 --> 00:01:17,890 to see what the graph is. 22 00:01:17,890 --> 00:01:20,320 And next we are going to explore one 23 00:01:20,320 --> 00:01:21,838 of the most interesting questions 24 00:01:21,838 --> 00:01:25,550 in graph theory, which is the shortest path problem. 25 00:01:25,550 --> 00:01:28,470 And then we are going to see some examples. 26 00:01:28,470 --> 00:01:31,030 And we are going to recap it at the end. 27 00:01:31,030 --> 00:01:32,550 All right. 28 00:01:32,550 --> 00:01:34,870 Akin: And also feel free to interrupt me 29 00:01:34,870 --> 00:01:36,610 with any questions you may have. 30 00:01:36,610 --> 00:01:38,190 Just don't be shy. 31 00:01:38,190 --> 00:01:39,240 Akin: Okay. 32 00:01:39,240 --> 00:01:40,289 All right. 33 00:01:40,289 --> 00:01:41,869 Let's dive in. 34 00:01:41,869 --> 00:01:45,130 Akin: The question is, what is a graph? 35 00:01:45,130 --> 00:01:47,886 If you have been dealing with data before, you might have 36 00:01:47,886 --> 00:01:51,279 been familiar with the concept of graph on the left one, 37 00:01:51,279 --> 00:01:56,628 you have the graph on the x axis and y axis and the right one 38 00:01:56,628 --> 00:02:00,050 you have a bar graph to represent some data. 39 00:02:00,050 --> 00:02:04,280 And but this is not the graph we are going to talk about today. 40 00:02:04,280 --> 00:02:08,069 What we are going to talk about today is quite--a little bit 41 00:02:08,069 --> 00:02:12,882 different and the definition of it is the graph is a collection 42 00:02:12,882 --> 00:02:14,730 of nodes and edges. 43 00:02:14,730 --> 00:02:19,769 And by nodes here I will use the red circle to represent a node 44 00:02:19,769 --> 00:02:23,840 and the edges will be this just a straight line. 45 00:02:23,840 --> 00:02:26,560 So basically nodes can represent any objects. 46 00:02:26,560 --> 00:02:29,811 It can be people, it can be animals, 47 00:02:29,811 --> 00:02:32,250 it can be just just anything. 48 00:02:32,250 --> 00:02:36,562 Akin: And the idea is to indicate some relationships 49 00:02:36,562 --> 00:02:38,000 between two nodes. 50 00:02:38,000 --> 00:02:40,400 Akin: And that might not sound clear, 51 00:02:40,400 --> 00:02:43,329 but let's take a look at some examples . 52 00:02:43,329 --> 00:02:43,829 Here. 53 00:02:43,829 --> 00:02:48,200 Okay, here I have a node that represents Harvard. 54 00:02:48,200 --> 00:02:53,050 Akin: And I have a node that represents MIT. 55 00:02:53,050 --> 00:02:56,491 And they both can be connected by the edge--the space--they 56 00:02:56,491 --> 00:02:58,900 are in the same city of Cambridge. 57 00:02:58,900 --> 00:03:00,790 Is it clear on this one? 58 00:03:00,790 --> 00:03:01,790 Student: Yes. 59 00:03:01,790 --> 00:03:02,790 Akin: All right. 60 00:03:02,790 --> 00:03:07,688 Akin: And I can have a node of Math and EECS Electrical 61 00:03:07,688 --> 00:03:09,321 Engineering and Computer Science: 62 00:03:09,321 --> 00:03:12,000 and both are the departments at MIT. 63 00:03:12,000 --> 00:03:18,110 I have Akin--this is me--who is a student at MIT and I study 64 00:03:18,110 --> 00:03:19,520 math and EECS. 65 00:03:19,520 --> 00:03:24,740 I can have Alice who loves math and Bob who hates math 66 00:03:24,740 --> 00:03:27,350 and Alice and Bob are rivals. 67 00:03:27,350 --> 00:03:29,280 Akin: Is it good? 68 00:03:29,280 --> 00:03:30,850 Student: Mmm hmm. 69 00:03:30,850 --> 00:03:32,940 Akin: Okay, ah okay. 70 00:03:32,940 --> 00:03:35,730 I would like to make some notes here. 71 00:03:35,730 --> 00:03:38,040 This graph is actually quite messy. 72 00:03:38,040 --> 00:03:41,285 It has like so many kinds of nodes--you have schools you 73 00:03:41,285 --> 00:03:44,720 have departments and you also have people. 74 00:03:44,720 --> 00:03:47,621 And at the same time, you also have so many kinds of edges, 75 00:03:47,621 --> 00:03:49,552 you have the same city, have departments, 76 00:03:49,552 --> 00:03:51,920 students and many more. 77 00:03:51,920 --> 00:03:56,470 So, in theory, this is not wrong. 78 00:03:56,470 --> 00:03:59,220 In one graph, you can have so many kind of nodes 79 00:03:59,220 --> 00:04:00,720 and so many kind of edges. 80 00:04:00,720 --> 00:04:04,319 But in practice, we usually refer to a graph 81 00:04:04,319 --> 00:04:10,200 as only having one kind of nodes and one kind of edges. 82 00:04:10,200 --> 00:04:12,036 And what it means by that, if you 83 00:04:12,036 --> 00:04:13,872 take a look at the right graph, you 84 00:04:13,872 --> 00:04:15,906 can see this graph has nodes that 85 00:04:15,906 --> 00:04:19,255 are the states in New England and the edges 86 00:04:19,255 --> 00:04:22,880 will be this indication if two states are neighbors. 87 00:04:22,880 --> 00:04:27,230 Akin: Are we still on the same page? 88 00:04:27,230 --> 00:04:28,870 Students: Mmm hmm. 89 00:04:28,870 --> 00:04:29,960 Uh huh. 90 00:04:29,960 --> 00:04:34,952 Akin: Yeah, and this is--I also have some examples--you can 91 00:04:34,952 --> 00:04:37,449 probably have a better understanding. 92 00:04:37,449 --> 00:04:41,960 Ah, the example I'm going to use is the network representations. 93 00:04:41,960 --> 00:04:47,370 And probably you guys have seen Facebook before. 94 00:04:47,370 --> 00:04:50,248 And what we are going to do is Facebook actually 95 00:04:50,248 --> 00:04:54,779 have a very nice way to present the network as a graph. 96 00:04:54,779 --> 00:04:58,904 And to do so you can have the node to represent a user 97 00:04:58,904 --> 00:05:03,464 and edge to represent the friendships between any two 98 00:05:03,464 --> 00:05:04,349 users. 99 00:05:04,349 --> 00:05:09,590 For example, this diagram here you can see Liz here is 100 00:05:09,590 --> 00:05:13,385 has--Liz has a page that connects to Emma, 101 00:05:13,385 --> 00:05:14,789 Shane and Alan. 102 00:05:14,789 --> 00:05:18,905 That means our list has three friends, which 103 00:05:18,905 --> 00:05:21,479 is Emma, Shane and Alan. 104 00:05:21,479 --> 00:05:22,830 Akin: Is it--is it okay? 105 00:05:22,830 --> 00:05:23,830 Is it all right? 106 00:05:23,830 --> 00:05:24,830 Student: Yeah. 107 00:05:24,830 --> 00:05:27,426 Akin: Okay, I just want to ask like to make sure 108 00:05:27,426 --> 00:05:29,550 that we are on the same page like just 109 00:05:29,550 --> 00:05:34,529 a quick questions like how many friends does John have? 110 00:05:34,529 --> 00:05:36,469 Student: Four? 111 00:05:36,469 --> 00:05:38,419 Akin: Four. 112 00:05:38,419 --> 00:05:40,360 Akin: Yeah. 113 00:05:40,360 --> 00:05:43,279 Who they are? 114 00:05:43,279 --> 00:05:47,118 Akin: Yeah the four friends of John 115 00:05:47,118 --> 00:05:50,409 are Bob, Jill, Shane and Leah. 116 00:05:50,409 --> 00:05:53,860 Akin: Okay, still good? 117 00:05:53,860 --> 00:05:54,860 Okay. 118 00:05:54,860 --> 00:05:59,210 Akin: Okay, I have another question for you. 119 00:05:59,210 --> 00:06:04,562 On the right, I have a graph whose--whose nodes are some 120 00:06:04,562 --> 00:06:06,509 states in the US. 121 00:06:06,509 --> 00:06:09,183 You can have Maine, New Hampshire, Massachusetts, 122 00:06:09,183 --> 00:06:10,330 and many more. 123 00:06:10,330 --> 00:06:14,598 And the edges will represent that there is a road that 124 00:06:14,598 --> 00:06:16,150 connects two nodes together. 125 00:06:16,150 --> 00:06:18,416 For example, this edge is the road 126 00:06:18,416 --> 00:06:20,360 that connects Maine and New Hampshire. 127 00:06:20,360 --> 00:06:24,699 This edge is the road that connects Vermont and New York. 128 00:06:24,699 --> 00:06:28,506 Akin: So basically, you can view this graph as a map 129 00:06:28,506 --> 00:06:31,604 and there are states then they are roads 130 00:06:31,604 --> 00:06:34,300 that connects states together. 131 00:06:34,300 --> 00:06:35,590 Yeah. 132 00:06:35,590 --> 00:06:37,669 So here's my question. 133 00:06:37,669 --> 00:06:42,043 You want to drive from Maine to Maryland, which 134 00:06:42,043 --> 00:06:44,960 is this circle to this circle. 135 00:06:44,960 --> 00:06:50,210 And to use a road, you need to pay $1 for each road you take. 136 00:06:50,210 --> 00:06:55,139 Yeah, the question is that what is the cheapest 137 00:06:55,139 --> 00:06:57,330 route you can take? 138 00:06:57,330 --> 00:07:07,199 Akin: Any figures? 139 00:07:07,199 --> 00:07:13,599 Student: You can go along the left edges. 140 00:07:13,599 --> 00:07:17,259 Akin: Left edges in New Hampshire, Vermont, New York, 141 00:07:17,259 --> 00:07:18,479 Pennsylvania and Maryland. 142 00:07:18,479 --> 00:07:19,354 Student: Yeah. 143 00:07:19,354 --> 00:07:20,479 Akin: Yeah, that's perfect. 144 00:07:20,479 --> 00:07:24,127 And there are actually two cheapest routes here, 145 00:07:24,127 --> 00:07:27,319 which are indicated by the green lines. 146 00:07:27,319 --> 00:07:33,979 Akin: And whatever route you take, you need to pay $5. 147 00:07:33,979 --> 00:07:36,979 And this is what we call the shortest path problem. 148 00:07:36,979 --> 00:07:40,360 I will explain it in in a minute. 149 00:07:40,360 --> 00:07:43,324 But if you guys have any questions, 150 00:07:43,324 --> 00:07:47,560 if you don't understand the graph, you can ask me. 151 00:07:47,560 --> 00:07:53,659 Akin: Okay, ah, let's move on. 152 00:07:53,659 --> 00:07:56,509 So, um, the shortest path problem. 153 00:07:56,509 --> 00:08:01,549 Akin: It is probably one of the most important questions 154 00:08:01,549 --> 00:08:04,069 in graph theory, where scientists 155 00:08:04,069 --> 00:08:06,955 have been dealing with it for decades, 156 00:08:06,955 --> 00:08:11,080 and it also has so many applications in real life. 157 00:08:11,080 --> 00:08:12,999 And the way we formulate a problem 158 00:08:12,999 --> 00:08:14,919 is that we are given a graph. 159 00:08:14,919 --> 00:08:17,499 And we want to find the shortest path in terms 160 00:08:17,499 --> 00:08:20,080 of the number of edges to go from one node 161 00:08:20,080 --> 00:08:24,349 to another, like we just did to go from Maine to Maryland. 162 00:08:24,349 --> 00:08:27,508 Akin: And it's actually easy to solve 163 00:08:27,508 --> 00:08:31,120 by eyes if a graph is so small. 164 00:08:31,120 --> 00:08:32,386 Nikita? 165 00:08:32,386 --> 00:08:33,469 Did I pronounce correctly? 166 00:08:33,469 --> 00:08:34,469 Student: Yep. 167 00:08:34,469 --> 00:08:36,559 Akin: Yeah, he just solved it in like 10 seconds. 168 00:08:36,559 --> 00:08:39,120 And it's pretty easy if the graph is small. 169 00:08:39,120 --> 00:08:41,960 But the question is, like, if the graph is large, 170 00:08:41,960 --> 00:08:43,380 how do we do it? 171 00:08:43,380 --> 00:08:46,376 Like on this one, if you want to go from the left node 172 00:08:46,376 --> 00:08:49,010 to the right node, is probably impossible to solve it 173 00:08:49,010 --> 00:08:52,410 by eyes because you know, there are like 100 nodes 174 00:08:52,410 --> 00:08:53,430 and thousand edges. 175 00:08:53,430 --> 00:08:56,737 So to solve these problems, computer scientists 176 00:08:56,737 --> 00:09:01,495 have come up with very nice and very simple procedures 177 00:09:01,495 --> 00:09:04,020 to find a shortest path. 178 00:09:04,020 --> 00:09:09,030 And we call it the breadth first search or BFS for short. 179 00:09:09,030 --> 00:09:11,120 Okay. 180 00:09:11,120 --> 00:09:15,190 Akin: And we are going to do it now. 181 00:09:15,190 --> 00:09:17,317 And I'm going to list the instructions on the left, 182 00:09:17,317 --> 00:09:20,220 and we are going to solve it together, on the right. 183 00:09:20,220 --> 00:09:23,841 Akin: So to do it, we are going to start 184 00:09:23,841 --> 00:09:29,720 with labeling the start node, which is Maine here with zero. 185 00:09:29,720 --> 00:09:32,510 And then you're going to see that from Maine, 186 00:09:32,510 --> 00:09:34,370 you can expand to New Hampshire. 187 00:09:34,370 --> 00:09:38,700 Akin: So we're going to put 1 at New Hampshire. 188 00:09:38,700 --> 00:09:41,314 Akin: And then from New Hampshire, 189 00:09:41,314 --> 00:09:44,800 you can only go to Vermont and Massachusetts. 190 00:09:44,800 --> 00:09:48,810 So we will put 2 here. 191 00:09:48,810 --> 00:09:51,682 And if you do the same thing from Vermont and Massachusetts, 192 00:09:51,682 --> 00:09:55,379 you can only go to New York, Connecticut and Rhode Island, 193 00:09:55,379 --> 00:09:57,509 and we put 3 there. 194 00:09:57,509 --> 00:10:01,783 Akin: And we are going to do it again and again until we find 195 00:10:01,783 --> 00:10:04,601 Maryland, Akin: which is 5. 196 00:10:04,601 --> 00:10:06,440 Akin: Is it clear on the procedure? 197 00:10:06,440 --> 00:10:07,620 Students: Yeah. 198 00:10:07,620 --> 00:10:09,400 Akin: That's good. 199 00:10:09,400 --> 00:10:12,014 Okay, so um, We found Maryland, it's 200 00:10:12,014 --> 00:10:15,750 level five, meaning that to go from Maine to Maryland, 201 00:10:15,750 --> 00:10:18,150 you need to take five edges. 202 00:10:18,150 --> 00:10:20,814 However, these procedures only tell you 203 00:10:20,814 --> 00:10:24,810 how like the number, the least number of edges 204 00:10:24,810 --> 00:10:26,130 you need to take. 205 00:10:26,130 --> 00:10:31,114 But it doesn't exactly tell you like what path 206 00:10:31,114 --> 00:10:33,330 you should be taking. 207 00:10:33,330 --> 00:10:37,697 So the question is, how do you find 208 00:10:37,697 --> 00:10:41,519 such a path that costs you $5? 209 00:10:41,519 --> 00:10:46,000 And the answer is what we call backtracking. 210 00:10:46,000 --> 00:10:47,600 And it is quite simple too. 211 00:10:47,600 --> 00:10:51,801 So what it means by backtracking is that you have Maryland at 5 212 00:10:51,801 --> 00:10:53,740 and you have Maine at 0. 213 00:10:53,740 --> 00:11:00,569 You want to find a path that goes like 5-4-3-2-1 and 0. 214 00:11:00,569 --> 00:11:06,988 And to do that, on the left one, you can go 5-4-3-2-1 and 0 215 00:11:06,988 --> 00:11:12,827 and under right one you can go 5-4-3-2-1 and 0 and these are 216 00:11:12,827 --> 00:11:17,680 actually two paths that we just saw it earlier by eyes. 217 00:11:17,680 --> 00:11:21,400 Akin: is it clear for everyone? 218 00:11:21,400 --> 00:11:22,400 Students: Yes. 219 00:11:22,400 --> 00:11:23,830 Akin: Okay, sounds good. 220 00:11:23,830 --> 00:11:26,470 So, how do you guys feel about this example? 221 00:11:26,470 --> 00:11:30,110 Is it like, too hard to easy or just okay? 222 00:11:30,110 --> 00:11:31,700 Student: It's all right. 223 00:11:31,700 --> 00:11:33,290 Akin: It's all right? 224 00:11:33,290 --> 00:11:34,870 All right for everybody? 225 00:11:34,870 --> 00:11:37,675 Okay, um, if this is not too hard for you, 226 00:11:37,675 --> 00:11:41,480 I have two questions that might be a bit more challenging. 227 00:11:41,480 --> 00:11:45,190 For this one, you still have a map. 228 00:11:45,190 --> 00:11:48,660 You have to have the same graph with the nodes of the states. 229 00:11:48,660 --> 00:11:51,990 And but now, each road will cost you differently. 230 00:11:51,990 --> 00:11:55,866 Like for example, from Maine to New Hampshire, 231 00:11:55,866 --> 00:11:58,290 it will cost you $1. 232 00:11:58,290 --> 00:12:00,384 And from New Hampshire to Massachusetts, 233 00:12:00,384 --> 00:12:02,090 it will cost you $2. 234 00:12:02,090 --> 00:12:04,173 So basically, it's like the numbers above the edge 235 00:12:04,173 --> 00:12:05,990 to tell you the amount of money you 236 00:12:05,990 --> 00:12:08,199 need to pay for using the road. 237 00:12:08,199 --> 00:12:13,120 Akin: You still want to go from Maine to Maryland? 238 00:12:13,120 --> 00:12:16,310 Akin: Will you still pick the same route? 239 00:12:16,310 --> 00:12:19,025 Akin: I'll tell you here that the old one will cost you 240 00:12:19,025 --> 00:12:20,610 $11--or $1, $2, $3, $3 and $2. 241 00:12:20,610 --> 00:12:23,810 Akin: Yeah, can we do better? 242 00:12:23,810 --> 00:12:33,548 Student: I think in the lower part of the graph, 243 00:12:33,548 --> 00:12:42,399 we can take the right route this time, so it would cost $4. 244 00:12:42,399 --> 00:12:43,399 Akin: Yeah. 245 00:12:43,399 --> 00:12:44,899 Akin: Yeah, that's a good catch. 246 00:12:44,899 --> 00:12:50,269 If you go this way, you only need to pay four, right? 247 00:12:50,269 --> 00:12:51,689 Student: Mmm hmm. 248 00:12:51,689 --> 00:12:54,550 Akin: How about the upper part? 249 00:12:54,550 --> 00:12:59,560 Akin: Can you find the shorter way, the cheaper way? 250 00:12:59,560 --> 00:13:05,506 Student: Well, we can go from New Hampshire to Massachusetts 251 00:13:05,506 --> 00:13:08,480 to Connecticut to New York. 252 00:13:08,480 --> 00:13:10,860 Akin: Yeah, that's great. 253 00:13:10,860 --> 00:13:15,040 This is actually the cheapest path we can buy. 254 00:13:15,040 --> 00:13:19,500 Akin: So, this type of question, we call it 255 00:13:19,500 --> 00:13:22,970 the weighted shortest path problem, is basically 256 00:13:22,970 --> 00:13:26,220 the shortest path problem with some variations. 257 00:13:26,220 --> 00:13:30,920 So it--here every edge will have the corresponding weight. 258 00:13:30,920 --> 00:13:33,837 In this case, the way is just the amount of toll 259 00:13:33,837 --> 00:13:35,959 we need to pay for using the road. 260 00:13:35,959 --> 00:13:40,250 Akin: Is everybody still good? 261 00:13:40,250 --> 00:13:41,250 Okay. 262 00:13:41,250 --> 00:13:44,928 Akin: So, as you can see, the traditional breadth 263 00:13:44,928 --> 00:13:48,125 first search will not work on this graph 264 00:13:48,125 --> 00:13:52,829 because it will just tell us to go on this way, the old way. 265 00:13:52,829 --> 00:13:55,862 But the actual the actual cheapest route 266 00:13:55,862 --> 00:13:59,329 is just to go on the green line. 267 00:13:59,329 --> 00:14:03,385 So the question is like ah, how can we 268 00:14:03,385 --> 00:14:06,089 solve it by using the BFS? 269 00:14:06,089 --> 00:14:14,620 Akin: The answer is we need to do some modifications. 270 00:14:14,620 --> 00:14:19,959 To use the BFS to solve it, we can add an intermediate node 271 00:14:19,959 --> 00:14:20,459 here. 272 00:14:20,459 --> 00:14:22,579 So we basically can split up the roads. 273 00:14:22,579 --> 00:14:25,223 And so from one road that cost you $2 274 00:14:25,223 --> 00:14:28,161 is going to be split up into two roads that 275 00:14:28,161 --> 00:14:29,749 cost you $1 for each road. 276 00:14:29,749 --> 00:14:35,139 Akin: Is the diagram clear for you? 277 00:14:35,139 --> 00:14:36,139 Student: Yeah. 278 00:14:36,139 --> 00:14:37,139 Akin: Yeah. 279 00:14:37,139 --> 00:14:40,120 And also the same thing with a road that cost you $3 280 00:14:40,120 --> 00:14:46,249 can be split into three roads that cost you $1 each. 281 00:14:46,249 --> 00:14:50,428 And you can transform the graph from the graph with the weights 282 00:14:50,428 --> 00:14:53,610 to the graph with intermediate nodes. 283 00:14:53,610 --> 00:14:57,038 As you can see, Massachusetts to Rhode Island--$2 will be split 284 00:14:57,038 --> 00:15:02,129 into two roads and you can do the same for every single edge. 285 00:15:02,129 --> 00:15:06,468 Akin: And from here, you can use the BFS 286 00:15:06,468 --> 00:15:08,879 like we just did before. 287 00:15:08,879 --> 00:15:13,379 I'm going to just show you how it goes 288 00:15:13,379 --> 00:15:16,380 because it will take too long. 289 00:15:16,380 --> 00:15:19,499 You have 0-1-2-3-4-5-6-7-8-9. 290 00:15:19,499 --> 00:15:23,651 Akin: And you can do the backtracking 291 00:15:23,651 --> 00:15:27,210 to find the actual shortest path. 292 00:15:27,210 --> 00:15:30,750 Akin: Is it clear for everybody? 293 00:15:30,750 --> 00:15:31,899 Student: Yep. 294 00:15:31,899 --> 00:15:34,190 Akin: Yeah, sounds good. 295 00:15:34,190 --> 00:15:35,190 Okay. 296 00:15:35,190 --> 00:15:36,190 Okay. 297 00:15:36,190 --> 00:15:39,837 I'd like to end with some--a couple of examples that you may 298 00:15:39,837 --> 00:15:40,749 have come across. 299 00:15:40,749 --> 00:15:43,479 So, these are the actual examples 300 00:15:43,479 --> 00:15:46,209 in real life of the BFS. 301 00:15:46,209 --> 00:15:49,410 So the first one is the cheapest flight transits. 302 00:15:49,410 --> 00:15:51,695 If you have used some traveling engines before, like, 303 00:15:51,695 --> 00:15:55,630 you will want to go from one place to another. 304 00:15:55,630 --> 00:15:58,397 But if you do a search, we will tell you 305 00:15:58,397 --> 00:16:00,889 what is the cheapest route but it's a transit. 306 00:16:00,889 --> 00:16:04,884 So in this model, you are given the origin and destination 307 00:16:04,884 --> 00:16:06,700 and price of several flights. 308 00:16:06,700 --> 00:16:09,437 And for example, here you want to go from Boston 309 00:16:09,437 --> 00:16:10,259 to Los Angeles. 310 00:16:10,259 --> 00:16:12,507 You can use the breadth first search 311 00:16:12,507 --> 00:16:18,720 to see that this is actually the cheapest route you can find. 312 00:16:18,720 --> 00:16:21,568 And another example that I have here 313 00:16:21,568 --> 00:16:24,010 is the minimizing the signal delay. 314 00:16:24,010 --> 00:16:27,320 So if you want to call a friend--like Alice wants 315 00:16:27,320 --> 00:16:31,334 to call Bob, wants to call Bob, so the signal's actually going 316 00:16:31,334 --> 00:16:35,129 to bounce off a lot of cellphone towers and to reaching 317 00:16:35,129 --> 00:16:39,194 the destination and from the signal to go from one tower 318 00:16:39,194 --> 00:16:41,819 to another tower, it has some delays. 319 00:16:41,819 --> 00:16:45,329 So we can we can model this as a graph 320 00:16:45,329 --> 00:16:49,726 with the node to be the cell phone towers and the edge 321 00:16:49,726 --> 00:16:54,020 to represent the delays from tower to tower. 322 00:16:54,020 --> 00:16:56,001 And we can use the breadth first search 323 00:16:56,001 --> 00:16:59,673 to see like what should be the fastest route that signal 324 00:16:59,673 --> 00:17:02,560 actually minimize the delay. 325 00:17:02,560 --> 00:17:03,899 Yeah. 326 00:17:03,899 --> 00:17:07,510 Akin: Is the example clear to everybody? 327 00:17:07,510 --> 00:17:09,480 Student: Yep. 328 00:17:09,480 --> 00:17:11,449 Akin: Yeah. 329 00:17:11,449 --> 00:17:13,984 That's pretty much all I have for today. 330 00:17:13,984 --> 00:17:15,359 Just want to recap everything up. 331 00:17:15,359 --> 00:17:18,660 Today we learned what the graph is. 332 00:17:18,660 --> 00:17:21,174 And we see how to solve the shortest path 333 00:17:21,174 --> 00:17:24,640 problems by the breadth first search, but on the one 334 00:17:24,640 --> 00:17:27,660 without the weight and weighted on. 335 00:17:27,660 --> 00:17:31,632 And we also saw some applications in real life 336 00:17:31,632 --> 00:17:34,280 like route planning and minimizing delays. 337 00:17:34,280 --> 00:17:37,400 Akin: And yeah, that's all I have for today. 338 00:17:37,400 --> 00:17:38,820 You guys have any questions? 339 00:17:38,820 --> 00:17:42,270 I'll be happy to answer it. 340 00:17:42,270 --> 00:17:47,440 Student: I think everything is clear. 341 00:17:47,440 --> 00:17:48,440 Student: Yeah. 342 00:17:48,440 --> 00:17:49,880 Clear for me too. 343 00:17:49,880 --> 00:17:51,760 No questions from me. 344 00:17:51,760 --> 00:17:53,140 Student: Same. 345 00:17:53,140 --> 00:17:58,690 Akin: That's, yeah, that's all I have today. 346 00:17:58,690 --> 00:18:00,070 Thank you. 347 00:18:00,070 --> 00:18:03,405 Thank you, you guys.