-
関数
- Algorithm
- AlternatingGroup
- AlternatingGroupIndex
- BinarySearch
- BinarySubsets
- Brelaz
- Center
- Circle
- CoarserSetPartitionQ
- Compositions
- ConstructTableau
- CycleIndex
- Cycles
- CycleStructure
- Cyclic
- CyclicGroup
- CyclicGroupIndex
- DeleteFromTableau
- DerangementQ
- Derangements
- Dihedral
- DihedralGroup
- DihedralGroupIndex
- Disk
- DistinctPermutations
- Distribution
- DurfeeSquare
- Element
- EncroachingListSet
- Eulerian
- FerrersDiagram
- FirstLexicographicTableau
- FromCycles
- FromInversionVector
- GrayCodeKSubsets
- GrayCodeSubsets
- Heapify
- HeapSort
- HideCycles
- IdentityPermutation
- Index
- InsertIntoTableau
- Invariants
- InversePermutation
- Inversions
- InvolutionQ
- Involutions
- Josephus
- KSetPartitions
- KSubsetGroup
- KSubsetGroupIndex
- KSubsets
- Large
- LastLexicographicTableau
- LexicographicPermutations
- LexicographicSubsets
- LNorm
- LongestIncreasingSubsequence
- LowerLeft
- LowerRight
- MinimumChangePermutations
- MultiplicationTable
- NextBinarySubset
- NextComposition
- NextGrayCodeSubset
- NextKSubset
- NextLexicographicSubset
- NextPartition
- NextPermutation
- NextSubset
- NextTableau
- Normal
- NormalDashed
- NthSubset
- NumberOfCompositions
- NumberOfDerangements
- NumberOfInvolutions
- NumberOfPartitions
- NumberOfPermutationsByCycles
- NumberOfPermutationsByInversions
- NumberOfPermutationsByType
- NumberOfTableaux
- One
- Optimum
- OrbitInventory
- OrbitRepresentatives
- Orbits
- Ordered
- PairGroup
- PairGroupIndex
- Parent
- PartitionQ
- PermutationGraph
- PermutationGroupQ
- PermutationQ
- PermutationToTableaux
- PermutationType
- PermutationWithCycle
- Permute
- PlotRange
- RandomComposition
- RandomHeap
- RandomKSetPartition
- RandomKSubset
- RandomPartition
- RandomPermutation
- RandomRGF
- RandomSetPartition
- RandomSubset
- RandomTableau
- RankBinarySubset
- RankGrayCodeSubset
- RankKSetPartition
- RankKSubset
- RankPermutation
- RankRGF
- RankSetPartition
- RankSubset
- ReflexiveQ
- RevealCycles
- RGFQ
- RGFs
- RGFToSetPartition
- Runs
- SamenessRelation
- SelectionSort
- SetPartitionListViaRGF
- SetPartitionQ
- SetPartitions
- SetPartitionToRGF
- SignaturePermutation
- Small
- StirlingSecond
- Strings
- Strong
- Subsets
- SymmetricGroup
- SymmetricGroupIndex
- TableauClasses
- TableauQ
- Tableaux
- TableauxToPermutation
- ToCanonicalSetPartition
- ToCycles
- ToInversionVector
- TransitiveQ
- TransposePartition
- TransposeTableau
- Undirected
- UnrankBinarySubset
- UnrankGrayCodeSubset
- UnrankKSetPartition
- UnrankKSubset
- UnrankPermutation
- UnrankRGF
- UnrankSetPartition
- UnrankSubset
- UpperLeft
- UpperRight
- テクニカルノート
-
-
関数
- Algorithm
- AlternatingGroup
- AlternatingGroupIndex
- BinarySearch
- BinarySubsets
- Brelaz
- Center
- Circle
- CoarserSetPartitionQ
- Compositions
- ConstructTableau
- CycleIndex
- Cycles
- CycleStructure
- Cyclic
- CyclicGroup
- CyclicGroupIndex
- DeleteFromTableau
- DerangementQ
- Derangements
- Dihedral
- DihedralGroup
- DihedralGroupIndex
- Disk
- DistinctPermutations
- Distribution
- DurfeeSquare
- Element
- EncroachingListSet
- Eulerian
- FerrersDiagram
- FirstLexicographicTableau
- FromCycles
- FromInversionVector
- GrayCodeKSubsets
- GrayCodeSubsets
- Heapify
- HeapSort
- HideCycles
- IdentityPermutation
- Index
- InsertIntoTableau
- Invariants
- InversePermutation
- Inversions
- InvolutionQ
- Involutions
- Josephus
- KSetPartitions
- KSubsetGroup
- KSubsetGroupIndex
- KSubsets
- Large
- LastLexicographicTableau
- LexicographicPermutations
- LexicographicSubsets
- LNorm
- LongestIncreasingSubsequence
- LowerLeft
- LowerRight
- MinimumChangePermutations
- MultiplicationTable
- NextBinarySubset
- NextComposition
- NextGrayCodeSubset
- NextKSubset
- NextLexicographicSubset
- NextPartition
- NextPermutation
- NextSubset
- NextTableau
- Normal
- NormalDashed
- NthSubset
- NumberOfCompositions
- NumberOfDerangements
- NumberOfInvolutions
- NumberOfPartitions
- NumberOfPermutationsByCycles
- NumberOfPermutationsByInversions
- NumberOfPermutationsByType
- NumberOfTableaux
- One
- Optimum
- OrbitInventory
- OrbitRepresentatives
- Orbits
- Ordered
- PairGroup
- PairGroupIndex
- Parent
- PartitionQ
- PermutationGraph
- PermutationGroupQ
- PermutationQ
- PermutationToTableaux
- PermutationType
- PermutationWithCycle
- Permute
- PlotRange
- RandomComposition
- RandomHeap
- RandomKSetPartition
- RandomKSubset
- RandomPartition
- RandomPermutation
- RandomRGF
- RandomSetPartition
- RandomSubset
- RandomTableau
- RankBinarySubset
- RankGrayCodeSubset
- RankKSetPartition
- RankKSubset
- RankPermutation
- RankRGF
- RankSetPartition
- RankSubset
- ReflexiveQ
- RevealCycles
- RGFQ
- RGFs
- RGFToSetPartition
- Runs
- SamenessRelation
- SelectionSort
- SetPartitionListViaRGF
- SetPartitionQ
- SetPartitions
- SetPartitionToRGF
- SignaturePermutation
- Small
- StirlingSecond
- Strings
- Strong
- Subsets
- SymmetricGroup
- SymmetricGroupIndex
- TableauClasses
- TableauQ
- Tableaux
- TableauxToPermutation
- ToCanonicalSetPartition
- ToCycles
- ToInversionVector
- TransitiveQ
- TransposePartition
- TransposeTableau
- Undirected
- UnrankBinarySubset
- UnrankGrayCodeSubset
- UnrankKSetPartition
- UnrankKSubset
- UnrankPermutation
- UnrankRGF
- UnrankSetPartition
- UnrankSubset
- UpperLeft
- UpperRight
- テクニカルノート
-
関数
Combinatorica
Combinatorica とは,組合せ論とグラフ理論における450以上の関数によってWolfram言語を拡張するものである.このような関数には,グラフやその他の組合せのオブジェクトを構成するもの,これらのオブジェクトの不変量を計算するもの,さらにはその結果を表示するものがある.このドキュメントはこれらの関数の一部をカバーするに過ぎない.このパッケージの最善のガイドブックとなるのは,Steven Skiena,Sriram Pemmaraju共著の「Computational Discrete Mathematics: Combinatorics and Graph Theory with Mathematica 」(2003年Cambridge University Press)であろう.新しい Combinatorica は1990年のオリジナルバージョンにかなり手を加えたものである.新バージョンでは,以前のものよりもずっと速く実行でき,グラフィックスも改善され新機能も大幅に加得られている.
Webのwww.combinatorica.comには,パッケージの最新リリース,Combinatorica グラフのエディタ,興味深い追加ファイル等が掲載されている.
<<Combinatorica`置換と組合せ
置換と部分集合は,最も基本的な組合せのオブジェクトである.Combinatorica はランダムに,または確定的に規則的にオブジェクトを構築する関数を提供することにより,それらのオブジェクトの順番を付けたり外したり,その対象を番号付け・番号呼びしたり,その不変量を計算したりする.ここではこのような関数の使用方法の例を示す.
MinimumChangePermutations[{a, b, c}]RankPermutation /@ Permutations[{1, 2, 3, 4}]Table[RandomPermutation[3], {20}]InversePermutation[{4, 8, 5, 2, 1, 3, 7, 6}]ToCycles[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}]NecklacePolynomial[8, m, Cyclic]p = RandomPermutation[50];{Inversions[p], Inversions[InversePermutation[p]]}Table[UnrankSubset[n, {a, b, c, d}], {n, 0, 15}]GrayCodeSubsets[{1, 2, 3, 4}]KSubsets[{1, 2, 3, 4, 5}, 3]Combinatorica の置換関数
Combinatorica の部分集合関数
Combinatorica の群論関数
分割,合成,ヤング盤
正の整数
の分割は,合計が
となるような
個の厳密に正である整数の集合である.
の合成は,和が
になる非負整数の配置である.
個の要素の集合分割はすべての要素を,空でなく相交わらない部分集合にグループ分けしたものである.ヤング盤は,整数
からなる構造であり,各行の要素(成分)の個数はある
の整数分割によって定められる.さらに,各行および各列の要素は増加する順に並び,行は左端にそろっている.この4つの関連した組合せのオブジェクトは,多数の面白い応用法と性質を持つ.
IntegerPartitions[6]Length[IntegerPartitions[20]]FerrersDiagram[RandomPartition[100]]Compositions[5, 3]SetPartitions[3]Tableaux[{2, 2, 1}]Tableaux[3]NumberOfTableaux[10]TableForm[RandomTableau[{6, 5, 5, 4, 3, 2}]]LongestIncreasingSubsequence[RandomPermutation[50]]| Compositions | DominatingIntegerPartitionQ |
| DominationLattice | DurfeeSquare |
| FerrersDiagram | NextComposition |
| NextPartition | PartitionQ |
| RandomComposition | RandomPartition |
| TransposePartition |
Combinatorica の整数分割関数
Combinatorica の集合分割関数
Combinatorica のヤング盤関数
Combinatorica の数を返す関数
グラフの表現
グラフは,辺の集合を伴った頂点の集合として定義される.つまり,1つの辺は2つの頂点として定義される.グラフの表現は,その意図する相手が人間かマシンかに応じて要求条件が異なる.コンピュータは,隣接行列や隣接リストのようなデータ構造としてのグラフを一番よく理解する.一方,人間たちは,線で結ばれた点の集まりとしての構造の視覚化をより好むが,これはグラフに幾何的な情報を付け加えなければならないことを意味する.
ShowGraph[CompleteGraph[5]]CompleteGraph[5]TableForm[ToAdjacencyMatrix[CompleteGraph[5]]]Vertices[CompleteGraph[5]]V[CompleteGraph[5]]M[CompleteGraph[5]]g = SetGraphOptions[CompleteGraph[4], VertexColor -> Red, EdgeColor -> Blue]ShowGraph[SetGraphOptions[CompleteGraph[4], {{1, 2, VertexColor -> Green, VertexStyle -> Disk[Large]}, {3, 4, VertexColor -> Blue}}, EdgeColor -> Red]]ShowGraph[AddEdge[Star[10], {1, 2}]]ShowGraph[GraphSum[Star[10], Star[10]]]TableForm[ToAdjacencyLists[CompleteGraph[5]]]ToOrderedPairs[CompleteGraph[5]]ShowGraph[InduceSubgraph[CompleteGraph[20], RandomSubset[Range[20]]]]ShowGraph[Contract[CompleteGraph[6, 6], {1, 7}]]BreadthFirstTraversal[Cycle[20], 1]DepthFirstTraversal[Cycle[20], 1]ShowGraph[RankedEmbedding[GridGraph[5, 5], {13}]]ShowGraph[RandomTree[10]]ShowGraph[RootedEmbedding[RandomTree[10], 1]]ShowGraph[SpringEmbedding[GraphJoin[EmptyGraph[2], CompleteGraph[7]]]]Combinatorica のグラフ変更関数
| Edges | FromAdjacencyLists |
| FromAdjacencyMatrix | FromOrderedPairs |
| FromUnorderedPairs | IncidenceMatrix |
| ToAdjacencyLists | ToAdjacencyMatrix |
| ToOrderedPairs | ToUnorderedPairs |
Combinatorica のグラフ形式解釈関数
Combinatorica のグラフ関数のオプション
| GetEdgeLabels | GetEdgeWeights |
| GetVertexLabels | GetVertexWeights |
| SetEdgeLabels | SetEdgeWeights |
| SetGraphOptions | SetVertexLabels |
| SetVertexWeights |
Combinatorica のグラフのラベルと重みについての関数
Combinatorica のグラフ描画関数
グラフの生成
多くのグラフは,重要な二項関係のモデルであるという点,あるいは独特なグラフ理論的性質を備えているという点において常に興味深いものとなっている.しばしば,これらのグラフは,
頂点の上の完全グラフ
のように,パラメータをつけて表すことができ,グラフの無限系列を表現する簡潔な記号が与えられる.まず,グラフに作用していろいろなグラフを与えるいくつかの操作を行う.これらの操作は,私たちが与えるパラメータ付きのグラフとともに,実質的にすべての興味深いグラフを構成する手段となる.
ShowGraph[GraphUnion[CompleteGraph[3], CompleteGraph[5, 5]]]ShowGraph[GraphProduct[CompleteGraph[3], CompleteGraph[5]]]ShowGraph[LineGraph[CompleteGraph[5]]]ShowGraph[CirculantGraph[21, RandomKSubset[Range[10], 3]]]ShowGraph[DeBruijnGraph[2, 5]]ShowGraph[Highlight[Hypercube[4], {Partition[HamiltonianCycle[Hypercube[4]], 2, 1]}]]ShowGraphArray[Partition[FiniteGraphs, 5, 5]]Combinatorica のグラフ構築関数
グラフの性質
グラフ理論は,グラフに固有の性質,すなわち,グラフの不変量についての学問である.興味深い性質には,連結性,循環構造,および彩色数等がある.ここでは,いくつかの異なるグラフの不変量の計算方法を論じる.
ConnectedQ[DeleteEdge[Star[10], {1, 10}]]ConnectedComponents[GraphUnion[CompleteGraph[3], CompleteGraph[4]]]ShowGraph[OrientGraph[Wheel[10]]]BiconnectedComponents[RealizeDegreeSequence[{4, 4, 3, 3, 3, 2, 1}]]ArticulationVertices[Star[10]]Bridges[RandomTree[10]]VertexConnectivity[Wheel[10]]EdgeConnectivity[CompleteGraph[3, 4]]Isomorphism[CompleteGraph[3, 2], CompleteGraph[2, 3], All]SelfComplementaryQ[Cycle[5]] && SelfComplementaryQ[Path[4]]AcyclicQ[RandomGraph[100, 0.5, Type -> Directed]]Girth[CageGraph[3, 6]]EulerianCycle[CompleteGraph[4, 4]]Combinatorica のグラフ叙述関数
HamiltonianCycle[CompleteGraph[3, 3], All]ShowGraph[g = MakeGraph[Range[8], Mod[#1, #2] == 0&], VertexNumber -> True]PartialOrderQ[g]ShowGraph[TransitiveReduction[g], VertexNumber -> True]ShowGraph[HasseDiagram[MakeGraph[Subsets[4], #2⋂#1 === #1 && #1 ≠ #2&]]]TopologicalSort[MakeGraph[Range[10], #1 > #2&]]ChromaticPolynomial[GraphUnion[CompleteGraph[2, 2], Cycle[3]], z]Combinatorica のグラフ不定量関数
アルゴリズム的グラフ理論
最後にグラフの不定量の中で,それを計算するアルゴリズムのため特におもしろいものを紹介する.
ShowGraph[ShortestPathSpanningTree[GridGraph[5, 5], 1]]ShortestPath[GridGraph[5, 5], 1, 25]ShowGraph[MinimumSpanningTree[CompleteGraph[6, 6, 6]]]NumberOfSpanningTrees[CompleteGraph[10]]NetworkFlow[CompleteGraph[4, 4], 1, 8]BipartiteMatching[Cycle[8]]MaximalMatching[CompleteGraph[8]]Combinatorica のグラフアルゴリズム関数