[Computer Network Experiment 3] Dijkstra Algorithm of Routing

xiaoxiao2021-03-05  51

The principles are there.

"Computer Network Engineering Tutorial" Huang Shuwu Yang Yiping Tsinghua University Press 1999 version in page 64

But it is not enough, add another few more

Below this picture, people look comfortable, but the computer can do not understand, you have to turn it into a matrix.

A = 1 2 3 4 5 61 0 2 5 1 INF INF 2 0 3 2 INF INF3 0 3 1 54 0 1 45 0 26 0

This matrix is ​​symmetrical, so the next is generally not written, and it is actually useless, because any two points are either not connected (represented by INF), or only one side.

Define an array p [] used to store the node, that is, the collection n in the book. A array S is defined to store nodes on the shortest path. Also, how did the number indicated in the computer in the computer? I can only replace it with a big number (I don't know if there is any other way to solve this problem), such as this topic, you can use 100, That's Enough

The program also wants to modify it later.

转载请注明原文地址:https://www.9cbs.com/read-34623.html

New Post(0)