Optimization_Toolbox使用问题

17 ビュー (過去 30 日間)
蒙恩
蒙恩 2025 年 4 月 28 日
コメント済み: 蒙恩 2025 年 4 月 28 日
显示已经成功安装了Optimization_Toolbox工具箱和全局Optimization_Toolbox工具箱,但是在调用graphallshortestpaths时出现如下报错:“函数或变量 'graphallshortestpaths' 无法识别。”在命令行中输入“>> which graphallshortestpaths"显示“未找到 'graphallshortestpaths'。”

回答 (2 件)

Sam Chak
Sam Chak 2025 年 4 月 28 日
編集済み: Sam Chak 2025 年 4 月 28 日
This graphallshortestpaths command has been removed since R2022b.
  1 件のコメント
蒙恩
蒙恩 2025 年 4 月 28 日
感谢您的评论

サインインしてコメントする。


Sam Chak
Sam Chak 2025 年 4 月 28 日
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:

カテゴリ

Help Center および File ExchangeLanguage Support についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by