Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これを見つけましたブーストライブラリのスター検索実装。この実装は、開始頂点から他のすべての頂点までの最短距離を見つけると言います。ただし、開始頂点から終了までの最短距離のみが必要です。どうすればこれを達成できますか?
実装では、おそらく条件付きのループがあります
while (openQueue != empty) ...pop bestCostVertex, etc.
条件をいじれば
while (openQueue != empty && bestCostVertex != endVertex)
ここで、bestCostVertex は openQueue からポップされる頂点です。openQueue 内の頂点は、endVertex が見つかるまでのみ処理されます。