MaximalBipartiteMatching[g]
二部グラフ g の最大マッチングを返す.
MaximalBipartiteMatching
MaximalBipartiteMatching[g]
二部グラフ g の最大マッチングを返す.
詳細とオプション
- MaximalBipartiteMatchingの機能はWolfram言語の組込み関数FindIndependentEdgeSetで利用できるようになった.
- MaximalBipartiteMatchingを使うためには,まずグラフユーティリティパッケージをロードしなくてはならない.それにはNeeds["GraphUtilities`"]を実行する必要がある.
- MaximalBipartiteMatchingは二部グラフの2つの頂点集合間の非隣接辺の最大集合を与える.
- m×n 行列により表される二部グラフは行頂点集合R={1,2,…,m}と列頂点集合C={1,2,…,n}で構成される.ここで行列要素が gij≠0ならば,頂点 i∈Rと j∈Cは連結されている.
- 規則のリスト{i1->j1,i2->j2,…}で表される二部グラフは,頂点集合R=Union[{i1,i2,…}]とC=Union[{j1,j2,…}]で構成される.ここで規則 i->j が規則のリストに含まれるなら,頂点 i∈Rと j∈Cは連結されている.
- MaximalBipartiteMatchingは,ペアの数 k がどちらの頂点集合よりも小さくなる頂点ペアのリスト{{i1,j1},…,{ik,jk}}を返す.
例題
すべて開く すべて閉じる例 (2)
Needs["GraphUtilities`"]g = {Tom -> Coke, Tom -> Coffee, Rob -> Coke, Rob -> Tea, Adam -> Tea, Adam -> Juice, Anton -> Juice};MaximalBipartiteMatching[g]MaximalBipartiteMatchingの代わりにFindIndependentEdgeSetが使われるようになった:
g = Graph[{Tom -> Coke, Tom -> Coffee, Rob -> Coke, Rob -> Tea, Adam -> Tea, Adam -> Juice, Anton -> Juice}];FindIndependentEdgeSet[g]List@@@%アプリケーション (1)
以下で,要素のほぼ4%が非零であるような乱数の30×40疎行列を定義する:
Needs["GraphUtilities`"]m = SparseArray[Floor[RandomReal[{0, 1} + .04, {30, 40}]]]MatrixPlot[m]matched = MaximalBipartiteMatching[m]r = matched[[All, 1]]c = matched[[All, 2]]r2 = Complement[Range[Dimensions[m][[1]]], r];
c2 = Complement[Range[Dimensions[m][[2]]], c];マッチする行と列を最初に主対角ブロックに置換することで,行列に順序を付ける:
MatrixPlot[m[[Join[r, r2], Join[c, c2]]]]テクニカルノート
関連するガイド
-
▪
- グラフユーティリティパッケージ ▪
- グラフとネットワーク ▪
- グラフの可視化 ▪
- グラフ上の計算 ▪
- グラフの構築と表現 ▪
- グラフと行列 ▪
- グラフの特性と測定 ▪
- グラフの操作と変更 ▪
- ランダムグラフ ▪
- ソーシャルネットワーク分析 ▪
- グラフの特性 ▪
- 数学データ形式 ▪
- 離散数学
テキスト
Wolfram Research (2007), MaximalBipartiteMatching, Wolfram言語関数, https://reference.wolfram.com/language/GraphUtilities/ref/MaximalBipartiteMatching.html.
CMS
Wolfram Language. 2007. "MaximalBipartiteMatching." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphUtilities/ref/MaximalBipartiteMatching.html.
APA
Wolfram Language. (2007). MaximalBipartiteMatching. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphUtilities/ref/MaximalBipartiteMatching.html
BibTeX
@misc{reference.wolfram_2026_maximalbipartitematching, author="Wolfram Research", title="{MaximalBipartiteMatching}", year="2007", howpublished="\url{https://reference.wolfram.com/language/GraphUtilities/ref/MaximalBipartiteMatching.html}", note=[Accessed: 12-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_maximalbipartitematching, organization={Wolfram Research}, title={MaximalBipartiteMatching}, year={2007}, url={https://reference.wolfram.com/language/GraphUtilities/ref/MaximalBipartiteMatching.html}, note=[Accessed: 12-August-2026]}