GraphCoordinates[g,options]
視覚的にアピールするグラフ g の頂点の2Dレイアウトを計算し,頂点の座標を返す.
GraphCoordinates
GraphCoordinates[g,options]
視覚的にアピールするグラフ g の頂点の2Dレイアウトを計算し,頂点の座標を返す.
詳細とオプション
- GraphCoordinatesの機能はWolfram言語の組込み関数GraphEmbeddingで利用できるようになった.
- GraphCoordinatesを使うためには,まずグラフユーティリティパッケージをロードしなくてはならない.それにはNeeds["GraphUtilities`"]を実行する必要がある.
- GraphCoordinatesはグラフ描画アルゴリズムを使って計算されるときに,頂点の座標を返す.これは,同じレイアウトで異なるスタイルを使ってグラフを繰り返し描画する必要があるときに便利である.
- GraphCoordinatesはGraphPlotと同じオプションを取る.
例題
すべて開く すべて閉じる例 (2)
Needs["GraphUtilities`"]Needs["GraphUtilities`"]g = {1 -> 2, 2 -> 3, 3 -> 1, 1 -> 4, 2 -> 5, 5 -> 6, 6 -> 7};GraphPlot[g]GraphCoordinates[g]GraphCoordinatesの代わりにGraphEmbeddingが使われるようになった:
g = Graph[{1 -> 2, 2 -> 3, 3 -> 1, 1 -> 4, 2 -> 5, 5 -> 6, 6 -> 7}]GraphEmbedding[g]スコープ (1)
Needs["GraphUtilities`"]g = {10 -> 11, 11 -> 12, 12 -> 7, 1 -> 7, 2 -> 8, 3 -> 9, 4 -> 10, 5 -> 11, 6 -> 12, 7 -> 13, 9 -> 13, 11 -> 13, 1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 6, 6 -> 1, 7 -> 8, 8 -> 9, 9 -> 10};GraphPlot[g]coords = GraphCoordinates[g]すでに計算されたレイアウトを用いて,2つの異なるスタイルのグラフをプロットする:
Row[{GraphPlot[g, VertexLabeling -> True, VertexCoordinateRules -> coords], GraphPlot[g, DirectedEdges -> True, VertexCoordinateRules -> coords]}]Thread[Rule[VertexList[g], coords]]特性と関係 (1)
Needs["GraphUtilities`"]g = {5 -> 4, 6 -> 2, 6 -> 3, 6 -> 5, 7 -> 1, 7 -> 3, 7 -> 4, 7 -> 6};GraphPlot[g, VertexLabeling -> True]coord = GraphCoordinates[g]Thread[VertexList[g] -> coord]座標は,再計算せずに描画を生成するために再利用することができる:
GraphPlot[g, VertexLabeling -> True, VertexCoordinateRules -> coord]考えられる問題 (1)
以下は有向グラフのLayeredGraphPlotである:
Needs["GraphUtilities`"]g = {1 -> 2, 2 -> 3, 1 -> 3, 1 -> 3, 3 -> 3};LayeredGraphPlot[g, VertexLabeling -> True]coord = GraphCoordinates[g, Method -> "LayeredDigraphDrawing"]LayeredGraphPlot[g, VertexCoordinateRules -> coord, VertexLabeling -> True]インタラクティブな例題 (1)
Needs["GraphUtilities`"]DynamicModule[{g, coord, path, edges}, g = {1 -> 2, 1 -> 3, 1 -> 17, 2 -> 5, 2 -> 15, 3 -> 4, 3 -> 19, 4 -> 5, 4 -> 20, 5 -> 13, 6 -> 7, 6 -> 8, 6 -> 18, 7 -> 10, 7 -> 11, 8 -> 9, 8 -> 16, 9 -> 10, 9 -> 14, 10 -> 12, 11 -> 13, 11 -> 20, 12 -> 13, 12 -> 15, 14 -> 15, 14 -> 17, 16 -> 17, 16 -> 19, 18 -> 19, 18 -> 20};
coord = GraphCoordinates[g];
path = GraphPath[Flatten[{g, Map[Reverse, g]}], 1, 7];
edges = Transpose[{Drop[path, -1], Drop[path, 1]}];
Manipulate[pe = Take[edges, length];
GraphPlot[g, VertexLabeling -> True, VertexCoordinateRules -> coord, EdgeRenderingFunction -> ({If[MemberQ[pe, #2] || MemberQ[pe, Reverse[#2]], Sequence@@{Thickness[0.01], Red}, Black], Line[#1]}&), ImageSize -> 300], {length, 1, Length[edges], 1}]]テクニカルノート
関連するガイド
-
▪
- グラフユーティリティパッケージ ▪
- グラフとネットワーク ▪
- グラフの可視化 ▪
- グラフ上の計算 ▪
- グラフの構築と表現 ▪
- グラフと行列 ▪
- グラフの特性と測定 ▪
- グラフの操作と変更 ▪
- ランダムグラフ ▪
- ソーシャルネットワーク分析 ▪
- グラフの特性 ▪
- 数学データ形式 ▪
- 離散数学
テキスト
Wolfram Research (2007), GraphCoordinates, Wolfram言語関数, https://reference.wolfram.com/language/GraphUtilities/ref/GraphCoordinates.html.
CMS
Wolfram Language. 2007. "GraphCoordinates." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphUtilities/ref/GraphCoordinates.html.
APA
Wolfram Language. (2007). GraphCoordinates. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphUtilities/ref/GraphCoordinates.html
BibTeX
@misc{reference.wolfram_2026_graphcoordinates, author="Wolfram Research", title="{GraphCoordinates}", year="2007", howpublished="\url{https://reference.wolfram.com/language/GraphUtilities/ref/GraphCoordinates.html}", note=[Accessed: 09-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_graphcoordinates, organization={Wolfram Research}, title={GraphCoordinates}, year={2007}, url={https://reference.wolfram.com/language/GraphUtilities/ref/GraphCoordinates.html}, note=[Accessed: 09-August-2026]}