【发布时间】:2020-06-05 16:19:49
【问题描述】:
我有以下图表。 graph I created in code
目前,它在 MatLab 代码中使用以下数据:
function [] = TestKShortestPath(case_number)
switch case_number
case 1
netCostMatrix = [inf 1 inf 1 ; 1 inf 1 1 ;inf 1 inf inf ;inf inf inf inf ];
source=3;
destination=4;
k = 5;
otherwise
error('The only case options available are 1');
end
我的问题是,我想更改要输入文件的数据(.csv),这样做如何修改上面的代码(尤其是第 4 行)?这里我有我的数据文件(在 .csv 中,其中行表示边,第 1 列和第 2 列表示节点,第 3 列表示与上述数据相同的成本,案例 1):
1,2,1
2,1,1
2,4,1
1,4,1
2,3,1
3,2,1
非常感谢
【问题讨论】:
标签: matlab matrix graph file-io shortest-path