Optimization_Toolbox使用问题

显示已经成功安装了Optimization_Toolbox工具箱和全局Optimization_Toolbox工具箱,但是在调用graphallshortestpaths时出现如下报错:“函数或变量 'graphallshortestpaths' 无法识别。”在命令行中输入“>> which graphallshortestpaths"显示“未找到 'graphallshortestpaths'。”

답변 (2개)

Sam Chak
Sam Chak 2025년 4월 28일
편집: Sam Chak 2025년 4월 28일

1 개 추천

This graphallshortestpaths command has been removed since R2022b.
Sam Chak
Sam Chak 2025년 4월 28일

1 개 추천

You can use the distances() function as the alternative.
W = [.41 .99 .51 .32 .15 .45 .38 .32 .36 .29 .21];
DG = sparse([6 1 2 2 3 4 4 5 5 6 1],[2 6 3 5 4 1 6 3 4 3 5], W);
G = digraph(DG);
plot(G)
d = distances(G)
d = 6×6
0 1.3600 0.5300 0.5700 0.2100 0.9500 1.1100 0 0.5100 0.6600 0.3200 1.0400 0.6000 0.9400 0 0.1500 0.8100 0.5300 0.4500 0.7900 0.6700 0 0.6600 0.3800 0.8100 1.1500 0.3200 0.3600 0 0.7400 0.8900 0.4100 0.2900 0.4400 0.7300 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Compare result with graphallshortestpaths:

카테고리

도움말 센터File Exchange에서 Language Support에 대해 자세히 알아보기

제품

릴리스

R2023b

질문:

2025년 4월 28일

댓글:

2025년 4월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by