⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dijtest.m

📁 Mathematical Methods by Moor n Stiling.
💻 M
字号:
% Test Sisjstras and Warshall's algorithms
% Copyright 1999 by Todd K. Moon

cost = [0 inf inf inf inf inf inf inf
        3 0 inf inf inf inf inf inf
        10 8 0 inf inf inf inf inf
        inf inf 12 0 inf inf inf inf
        inf inf inf 15 0 2.5 9 inf
        inf inf inf 10 inf 0 inf 14
        inf inf inf inf inf inf 0 10
        17 inf inf inf inf inf inf 0]
node = 5

[d,p] = dijkstra(5,cost)

% test Warshall
A = [1 1 0 0 0 1 1 0 0 0 0 0 0 
     0 1 0 0 0 0 0 0 0 0 0 0 0
     1 0 1 0 0 0 0 0 0 0 0 0 0
     0 0 0 1 0 1 0 0 0 0 0 0 0
     0 0 0 1 1 0 0 0 0 0 0 0 0
     0 0 0 0 1 1 0 0 0 0 0 0 0
     0 0 1 0 1 0 1 0 0 1 0 0 0
     0 0 0 0 0 0 1 1 1 0 0 0 0
     0 0 0 0 0 0 0 1 1 0 0 0 0
     0 0 0 0 0 0 0 0 0 1 1 1 1
     0 0 0 0 0 0 0 0 0 0 1 0 0
     0 0 0 0 0 0 1 0 0 0 0 1 1
     0 0 0 0
     0 0 0 0 0 0 0 1 1]
warshall(A);

cost = [0 0 0 0 0 0 0 0
        1 0 0 0 0 0 0 0
        1 1 0 0 0 0 0 0
        0 0 1 0 0 0 0 0
        0 0 0 1 0 1 1 0
        0 0 0 1 0 0 0 1
        0 0 0 0 0 0 0 1
        1 0 0 0 0 0 0 0];

warshall(cost)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -