Dijkstura algorithm solves the shortest path problem

The shortest path algorithm , the shortest path planning problem is involved in the traveling salesman problem and the postman problem, here is the code of the Dijkstura algorithm .
When building the code, you need to build a network diagram based on actual problems, and write its adjacency matrix based on the network diagram!
Let's look at a case code. The adjacency matrix in the given code has been established, and then the network diagram can be drawn based on the adjacency matrix.

clc
clear
%初始值--dijkstura算法
w=[0 2 1 8 inf inf inf inf;
    2 0 inf 6 1 inf inf inf;
    1 inf 0 

Guess you like

Origin blog.csdn.net/weixin_51631044/article/details/112922520