Now let's move on to the case of three hops and here

we're showing the two hop graph which we'll build off of again.

because that's what the Bellman-Ford algorithm tells us to do.

So we'll look at the case of two hops and then try to expand

now to the case of three hops and see how the costs get less.

so we'll do node, node by node again and consider each of them.

let's start with A. A again can go to D B, or C.

So, we'll start with B.

from A to B the cost is four and then now B

can get in two hops he can get to the destination through E.

And notice again notice this is important to note that this cost of 14

does not reflect the new updated cost for E, because E's new cost now is

nine, which would mean that this really, if he was going to E, which would,

would be, 13, that wouldn't be reflected now until we're dealing with a three Hop,

because this was done last iteration.

so, that's all happening really instantaneously before

they can see the next number of hops.

So, this is still, 14-9, still valid here.

So, for A, this cost, that he sees is 4 plus

14 to get to B, and that is, or to get to F through B rather, and

that is 18. Then for C if he goes to

C, the cost is 2 plus 10, which is 12. And if he goes to D the cost is, draw out

the lines here, and if he goes to D the cost is 6 plus 8 which is 14.

So the lowest of these is going to be the

12 here, so now A will choose to forward to C.

And the total cost, the cost of A then would

be 12 to get there, to the destination. So now let's consider node B.

So now for B, B can go again he can go to C and he can go to E.

If he goes to C, now C can get there at a cost

of ten, so to C the cost is 5 plus 10, which is 15.

And then if he goes to E to E, the cost is 4 plus 9.

Now, notice now we're using the new nine, because that's what E can do in two hops,

so now B in three hops would be based upon that nine.

Is going to be 13. So, the minimum cost of these is

going to be E, the 13. So B is going to choose to go to E, still.

And the cost of B is going to be 13. Now, we'll go to C, and we can

say for C that C can get to D or E. So

if C decides to go directly to D, then that cost is going to be two plus eight.

And two plus eight is ten.

And if he decides to go to E then that cost is going to be three

plus nine which is 12. So the minimum cost here is going to be

this, this D so C is going to decide to go to D just as

he did before still, so we say cost of D is going to be ten.

And then we can go to D, and now D has choice

either to go to A or he can go to F directly.

So, if he decides to go to A, now A does have

a cost within two hops, but this is going through D, so obviously

this will never be selected.

But the routers don't know that, they're kind of, they're

dumb in a sense, they only have a local view.

So D does not know that A is forwarding to D, for instance.

So D is going to assume that A is forwarding,

possibly to somewhere else and might have a better path.

So, he has to considerate it anyway, even though, we look

at this and we say, why would you ever consider that.

But, so that cost would be 6 plus 14,

which is 20, and the direct cost, obviously from

D is just going to be 8 plus 0.

So, if he goes directly to F, then, that cost, which is 8.

So, he'll stick with that and, D will go directly to F.

And the cost of, of, D will be 8. And, now,

finally, we can consider E. And E has, two options:

he can go to D or he can go directly to F.

no update, here, to place it all, so, it's

still going to, still going to choose the path of 9.

we can just write that out, anyway.

As you would in general keep doing the calculations.

So for D it would be 1 plus 8 which is 9, and for F it would just be 10.

And again, we're just going to choose the 9 because it's smaller.

so, for E, E is going to

go to D, and the cost of E is going to be