GraphDistance[g,s,t]
グラフ g 上のソース頂点 s からターゲット頂点 t までの距離を返す.
GraphDistance[g,s]
グラフ g 上の頂点 s からすべての頂点までの距離を返す.
GraphDistance[{vw,…},…]
規則 vw を使ってグラフ g を指定する.


GraphDistance
GraphDistance[g,s,t]
グラフ g 上のソース頂点 s からターゲット頂点 t までの距離を返す.
GraphDistance[g,s]
グラフ g 上の頂点 s からすべての頂点までの距離を返す.
GraphDistance[{vw,…},…]
規則 vw を使ってグラフ g を指定する.
詳細とオプション

- GraphDistanceは測地距離としても知られている.
- GraphDistance[g,s,t] は s と t 間の最短経路の長さを与える.
- s から t までの経路がない場合の距離はInfinityである.
- 重み付きグラフの場合,距離は s から t までの任意の経路に沿った重みの総和の最小のものである.
- 使用可能なオプション
-
Method Automatic 使用するメソッド - Methodの可能な設定値には,"Dijkstra","BellmanFord","UnitWeight"がある.

例題
すべて開く すべて閉じるスコープ (7)
GraphDistanceは無向グラフに使うことができる:
GraphDistanceは大きいグラフに使うことができる:
オプション (4)
アプリケーション (5)
サイズ{6,6}のGridGraphの相対するコーナーの間の距離を求める:
次元のサイズが{6,6,…,6}のGridGraphの相対するコーナーの間の距離を求める:
確率 のベルヌーイ(Bernoulli)グラフの2頂点間の距離の期待値は
である:
アルファベットを使った短い単語のDamerauLevenshteinDistanceを示す:
特性と関係 (3)
2つの頂点間の距離はFindShortestPathで求めることができる:
連結グラフでは,VertexEccentricityはGraphDistanceで計算できる:
異なる連結成分に属する2つの頂点間の距離はInfinityである:
関連するガイド
-
▪
- グラフの測定基準 ▪
- グラフとネットワーク ▪
- 経路,閉路,フロー ▪
- グラフの特性と測定 ▪
- 距離と類似度の測定基準
テキスト
Wolfram Research (2010), GraphDistance, Wolfram言語関数, https://reference.wolfram.com/language/ref/GraphDistance.html (2015年に更新).
CMS
Wolfram Language. 2010. "GraphDistance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/GraphDistance.html.
APA
Wolfram Language. (2010). GraphDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphDistance.html
BibTeX
@misc{reference.wolfram_2025_graphdistance, author="Wolfram Research", title="{GraphDistance}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/GraphDistance.html}", note=[Accessed: 05-October-2025]}
BibLaTeX
@online{reference.wolfram_2025_graphdistance, organization={Wolfram Research}, title={GraphDistance}, year={2015}, url={https://reference.wolfram.com/language/ref/GraphDistance.html}, note=[Accessed: 05-October-2025]}