結合行列 m のグラフを返す.
IncidenceGraph[{v1,v2,…},m]
頂点 vi,結合行列 m のグラフを与える.
IncidenceGraph
結合行列 m のグラフを返す.
IncidenceGraph[{v1,v2,…},m]
頂点 vi,結合行列 m のグラフを与える.
詳細とオプション
- IncidenceGraph[m]は頂点が{1,2,…,n}のグラフを返す.ただし,m の次元は
×
で結果のグラフの結合行列は m である. - IncidenceGraphにはGraphと同じオプションが使える.
全オプションのリスト
例題
すべて開く すべて閉じる例 (4)
IncidenceGraph[{{0, 1, 1}, {1, 0, 1}, {1, 1, 0}}]EdgeList[%]IncidenceGraph[{{0, -1, 1}, {1, 0, -1}, {-1, 1, 0}}]EdgeList[%]IncidenceGraph[{{2, 0, 1, 1}, {0, 1, 0, 1}, {0, 1, 1, 0}}]EdgeList[%]IncidenceGraph[{{2, 0, -1, 1}, {0, 1, 0, -1}, {0, -1, 1, 0}}]EdgeList[%]スコープ (6)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |)]IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |)]{IncidenceGraph[(| | | | |
| - | - | - | - |
| 0 | 1 | 1 | 2 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |)], IncidenceGraph[(| | | | |
| -- | -- | -- | - |
| 0 | -1 | 1 | 0 |
| 1 | 0 | -1 | 2 |
| -1 | 1 | 0 | 0 |)]}SparseArrayオブジェクトを使って結合行列を指定する:
IncidenceGraph[SparseArray[{Band[{1, 1}] -> 1, Band[{2, 1}] -> 1, {1, 5} -> 1}, {5, 5}]]VertexList@IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |)]VertexList@IncidenceGraph[{a, b, c}, (| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |)]IncidenceGraphは大きい行列にも使える:
SparseArray[{Band[{1, 1}] -> 1, Band[{2, 1}] -> 1, {1, 10^6} -> 1}, {10^6, 10^6}]Timing[IncidenceGraph[%]//EdgeCount]オプション (78)
AnnotationRules (2)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), AnnotationRules -> {1 -> {VertexLabels -> "hello"}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), AnnotationRules -> {12 -> {EdgeLabels -> "hello"}}]EdgeLabels (7)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {12 -> "Hello"}]el = {12, 23, 31};IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> Table[el[[i]] -> Subscript["e", i], {i, Length[el]}]]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {12 -> [image], 23 -> [image], 13 -> [image]}]Placedを記号位置と一緒に使って辺に沿ったラベルの置き方を制御する:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {23 -> Placed["■■■", p]}, PlotLabel -> p], {p, {"Start", "Middle", "End"}}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {23 -> Placed["■■■", p]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {0, 1 / 4, 1 / 3}}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {23 -> Placed["■■■", {1 / 2, p}]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {31 -> Placed[{"lbl1", "lbl2"}, {"Start", "End"}]}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> {31 -> Placed[{"lbl1", "lbl2", "lbl3"}, {"Start", "Middle", "End"}]}]TooltipとStatusAreaの値で自動的にラベルを付ける:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> Placed["Name", Tooltip]]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeLabels -> Placed["Name", StatusArea]]EdgeShapeFunction (6)
EdgeShapeFunctionの組込み設定のリストを得る:
ResourceData["EdgeShapeFunction"]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeShapeFunction -> "Line"]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]Table[IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |), EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]Table[IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |), EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]Table[IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |), EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |), EdgeShapeFunction -> {13 -> "FilledArrow"}]IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |), EdgeShapeFunction -> {13 -> "FilledArrow", "CarvedArrow"}]ef[pts_List, e_] :=
Block[{s = 0.015, g = [image]}, {Arrowheads[{{s, 0.33, g}, {s, 0.67, g}}], Arrow[pts]}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeShapeFunction -> ef]EdgeShapeFunctionはEdgeStyleと組み合せることができる:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeStyle -> Blue, EdgeShapeFunction -> (Line[#1]&)]EdgeShapeFunctionはEdgeStyleより優先順位が高い:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeStyle -> Blue, EdgeShapeFunction -> ({Red, Line[#1]}&)]EdgeStyle (2)
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeStyle -> style, PlotLabel -> style], {style, {Gray, Dashed, Thick}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeStyle -> {12 -> Blue, 13 -> Dashed}]EdgeWeight (2)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeWeight -> RandomInteger[5, 3]]WeightedAdjacencyMatrix[%]//MatrixFormIncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), EdgeWeight -> {a, b, c}]WeightedAdjacencyMatrix[%]//MatrixFormGraphHighlight (3)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> Tiny, GraphHighlight -> {1}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> Tiny, GraphHighlight -> {23}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> Tiny, GraphHighlight -> {1, 2, 12, 13}]GraphHighlightStyle (2)
GraphHighlightStyleの組込み設定のリストを得る:
ResourceData["GraphHighlightStyle"]GraphHighlightStyleの組込み設定を使う:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), GraphHighlight -> {1, 23}, VertexSize -> Small, GraphHighlightStyle -> #, PlotLabel -> #]& /@ Select[ResourceData["GraphHighlightStyle"], # =!= Automatic&]GraphLayout (5)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), GraphLayout -> Automatic]m = IncidenceMatrix[GridGraph[{10, 10}]];Table[IncidenceGraph[m, GraphLayout -> l, PlotLabel -> l], {l, {"CircularEmbedding", "SpiralEmbedding"}}]m = IncidenceMatrix[GridGraph[{10, 10}]];Table[IncidenceGraph[m, GraphLayout -> l, PlotLabel -> l], {l, {"SpringEmbedding", "SpringElectricalEmbedding", "HighDimensionalEmbedding"}}]VertexCoordinatesはGraphLayoutの座標を無効にする:
{IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), GraphLayout -> "SpringElectricalEmbedding"],
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), GraphLayout -> "SpringElectricalEmbedding", VertexCoordinates -> Table[{i, i}, {i, 0, 2}]]}AbsoluteOptionsを使ってレイアウトアルゴリズムで計算されたVertexCoordinatesを抽出する:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |)]AbsoluteOptions[%, VertexCoordinates]PlotTheme (4)
基本テーマ (2)
特徴テーマ (2)
VertexCoordinates (3)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |)]AbsoluteOptionsを使って結果の頂点座標を抽出する:
AbsoluteOptions[%, VertexCoordinates]ellipseLayout[n_, {a_, b_}] := Table[{a Cos[2Pi / n u], b Sin[2Pi / n u]}, {u, 1, n}]Graphics[Point[ellipseLayout[20, {2, 1}]]]m = IncidenceMatrix[PathGraph[Range[20]]];IncidenceGraph[m, VertexCoordinates -> ellipseLayout[20, {2, 1}]]VertexCoordinatesはGraphLayoutより優先順位が高い:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexCoordinates -> Table[{i, i}, {i, 3}], GraphLayout -> "CircularEmbedding"]VertexLabels (13)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> "Name"]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> {1 -> "one"}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> Table[i -> Subscript[v, i], {i, 3}]]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> {1 -> [image], 2 -> [image], 3 -> [image]}, ImagePadding -> 30]Placedを記号位置と一緒に使って外側の位置を含むラベルの置き方を制御する:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], PlotLabel -> p, ImagePadding -> 20], {p, {Before, After, Below, Above}}]pl = {{Before, Below}, {After, Below}, {Before, Above}, {After, Above}};Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.1, VertexShapeFunction -> "Square", ImagePadding -> 20, VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], PlotLabel -> p], {p, pl}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.25, VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], VertexShapeFunction -> "Square", PlotLabel -> p], {p, {Left, Top, Right, Bottom}}]pl = {{Left, Bottom}, {Right, Bottom}, {Left, Top}, {Right, Top}};Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 3}], PlotLabel -> p], {p, pl}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]すべてのラベルを頂点の右上のコーナー位置に置き,ラベル内の座標を変化させる:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.35, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], {{1, 1}, p}], {i, 3}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> {1 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> {1 -> Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]}]Placedの引数を使ってTooltipを含むフォーマットを制御する:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> Placed["Name", Tooltip]]あるいはStatusAreaを含むフォーマットを制御する:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> Placed["Name", StatusArea]]rotateLabel[lab_] := Rotate[lab, 45Degree]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> Table[i -> Placed["xxx", Below, rotateLabel], {i, 3}]]panelLabel[lab_] := Panel[lab, FrameMargins -> 0, Background -> Lighter[Yellow, 0.7]]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> Table[i -> Placed["xxx", Center, panelLabel], {i, 3}]]hyperlinkLabel[lab_] := Hyperlink[lab, "http://www.wolfram.com"]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexLabels -> Table[i -> Placed["xxx", Center, hyperlinkLabel], {i, 3}]]VertexShape (5)
Graphics,ImageあるいはGraphics3Dを頂点の形として使う:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShape -> s, VertexSize -> Medium], {s, {[image], [image], [image]}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShape -> {2 -> [image]}, VertexSize -> Small]VertexShapeはVertexSizeと組み合せることができる:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {Small, Large}}]VertexShapeはVertexStyleの影響を受けない:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexShape -> [image], VertexStyle -> Blue]VertexShapeFunctionはVertexShapeより優先順位が高い:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexShape -> [image]]VertexShapeFunction (10)
VertexShapeFunctionの組込みコレクションのリストを得る:
ResourceData["VertexShapeFunction"]"Basic"コレクションのVertexShapeFunctionの組込み設定を使う:
ResourceData["VertexShapeFunction", "Basic"]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"Triangle", "Square", "Rectangle", "Pentagon", "Hexagon", "Octagon"}}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"DownTrapezoid", "UpTrapezoid", "Parallelogram", "FiveDown", "Circle", "Diamond", "Star", "Capsule"}}]"Rounded"コレクションのVertexShapeFunctionの組込み設定を使う:
ResourceData["VertexShapeFunction", "Rounded"]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Rounded"]}]"Concave"コレクションのVertexShapeFunctionの組込み設定を使う:
ResourceData["VertexShapeFunction", "Concave"]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Concave"]}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> { 1 -> "Square"}, VertexSize -> 0.2]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> { 1 -> "Square", "Triangle"}, VertexSize -> 0.2]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> (Inset[[image], #]&)]vf[{xc_, yc_}, name_, {w_, h_}] :=
Block[{xmin = xc - w, xmax = xc + w, ymin = yc - h, ymax = yc + h},
Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}]
];IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> vf, VertexSize -> 0.2]VertexShapeFunctionはVertexStyleと組み合せることができる:
vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]VertexShapeFunctionはVertexStyleより優先順位が高い:
vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]VertexShapeFunctionはVertexSizeと組み合せることができる:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexShapeFunction -> "Star", VertexSize -> {1 -> Small, Medium}]VertexShapeFunctionはVertexShapeより優先順位が高い:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.3, VertexShapeFunction -> "Star", VertexShape -> [image]]VertexSize (8)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> Automatic]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> s, PlotLabel -> s], {s, 0.1, 1, 0.3}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> {"Scaled", s}, PlotLabel -> {"Scaled", s}], {s, 0.1, 1, 0.3}]Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> s, PlotLabel -> s], {s, {{0.1, 0.2}, {0.2, 0.1}}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> {1 -> 0.2, 2 -> 0.3}]VertexSizeはVertexShapeFunctionと組み合せることができる:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> s, VertexShapeFunction -> "Square", PlotLabel -> s], {s, {0.05, 0.1, 0.2}}]VertexSizeはVertexShapeと組み合せることができる:
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {0.1, 0.2, 0.4}}]VertexStyle (4)
Table[IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexStyle -> style, VertexSize -> 0.3, PlotLabel -> style], {style, {Yellow, EdgeForm[Dashed]}}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexStyle -> {1 -> Blue, 2 -> Red}, VertexSize -> 0.2]VertexShapeFunctionはVertexStyleと組み合せることができる:
vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]VertexShapeFunctionはVertexStyleより優先順位が高い:
vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]VertexShapeはVertexStyleの影響を受けない:
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexSize -> 0.2, VertexShape -> [image], VertexStyle -> Blue]VertexWeight (2)
IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexWeight -> {2, 3, 4}]AnnotationValue[{%, 1}, VertexWeight]IncidenceGraph[(| | | |
| - | - | - |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |), VertexWeight -> {a, b, c}]AnnotationValue[{%, 1}, VertexWeight]特性と関係 (4)
VertexCountとEdgeCountを使って頂点と辺を数える:
g = IncidenceGraph[(| | | | | |
| - | - | - | - | - |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 |)]{VertexCount[g], EdgeCount[g]}VertexListとEdgeListを使って頂点と辺を標準的な順で列挙する:
g = IncidenceGraph[(| | | | | |
| - | - | - | - | - |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 0 | 0 | 0 | 1 | 1 |)]{VertexList[g], EdgeList[g]}グラフからAdjacencyMatrixを計算する:
g = IncidenceGraph[(| | | |
| -- | -- | -- |
| 0 | -1 | 1 |
| 1 | 0 | -1 |
| -1 | 1 | 0 |)];(a = AdjacencyMatrix[g]//Normal)//MatrixFormCompleteGraph[5]IncidenceMatrix[%]IncidenceGraph [%]関連するガイド
-
▪
- グラフと行列 ▪
- グラフプログラミング
テキスト
Wolfram Research (2010), IncidenceGraph, Wolfram言語関数, https://reference.wolfram.com/language/ref/IncidenceGraph.html.
CMS
Wolfram Language. 2010. "IncidenceGraph." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IncidenceGraph.html.
APA
Wolfram Language. (2010). IncidenceGraph. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IncidenceGraph.html
BibTeX
@misc{reference.wolfram_2026_incidencegraph, author="Wolfram Research", title="{IncidenceGraph}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/IncidenceGraph.html}", note=[Accessed: 13-July-2026]}
BibLaTeX
@online{reference.wolfram_2026_incidencegraph, organization={Wolfram Research}, title={IncidenceGraph}, year={2010}, url={https://reference.wolfram.com/language/ref/IncidenceGraph.html}, note=[Accessed: 13-July-2026]}