(* :Title: Combinatorica *) (* :Authors: Sriram V. Pemmaraju and Steven S. Skiena*) (* :Summary: This package contains all the programs from the book, "Computational Discrete Mathematics: Combinatorics and Graph Theory in Mathematica", by Sriram V. Pemmaraju and Steven S. Skiena, Cambridge University Press, 2003. *) (* :Discussion: The programs from the book "Computational Discrete Mathematics: Combinatorics and Graph Theory with Mathematica" are available at www.combinatorica.com. Any comments or bug reports should be forwarded to one of the following: Sriram Pemmaraju Department of Computer Science University of Iowa Iowa City, IA 52242 sriram@cs.uiowa.edu (319)-353-2956 Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794-4400 skiena@cs.sunysb.edu (631)-632-9026 *) (* :Context: DiscreteMath`Combinatorica` *) (* :Package Version: 2.0.0 *) (* :Copyright: Copyright 2000-2003 by Sriram V. Pemmaraju and Steven S. Skiena *) (* This package may be copied in its entirety for nonprofit purposes only. Sale, other than for the direct cost of the media, is prohibited. This copyright notice must accompany all copies. The authors, Wolfram Research, and Cambridge University Press make no representations, express or implied, with respect to this documentation, or the software it describes and contains, including without limitations, any implied warranties of mechantability or fitness for a particular purpose, all of which are expressly disclaimed. The authors, Wolfram Research, or Cambridge University Press, their licensees, distributors and dealers shall in no event be liable for any indirect, incidental, or consequential damages. *) (* :History: Version 2.0 most code rewritten Sriram V. Pemmaraju, 2000-2002 Too many changes to describe here. Read the book! Version 1.1 modification by ECM, March 1996. Replaced K with CompleteGraph because K is now the default generic name for the summation index in symbolic sum. Added CombinatorialFunctions.m and Permutations.m to BeginPackage, and commented out CatalanNumber, PermutationQ, ToCycles, FromCycles, and RandomPermutation so there would be no shadowing of symbols among the DiscreteMath packages. Replaced old BinarySearch with new code by Paul Abbott correctly implementing binary search. Version 1.0 by Steven S. Skiena, April 1995. Version .9 by Steven S. Skiena, February 1992. Version .8 by Steven S. Skiena, July 1991. Version .7 by Steven S. Skiena, January 1991. Version .6 by Steven S. Skiena, June 1990. *) (* Acknowledgements: WRI people who helped: John Novak, Eric Weisstein, Arnoud Buzing, Shiral Devmal, Anna Pakin, Andy Shiekh, Darren Glosemeyer, Ranjani Krishnan, Daniel Lichtblau, Robby Villegas, Stephen Wolfram Others who helped: Eugene Curtin, Levon LLoyd, Joan Trias, Kaushal Kurapati, students at Iowa, students at IIT Bombay *) (* :Keywords: adjacency, automorphism, chromatic, clique, coloring, combination, composition, connected components, connectivity, cycle, de Bruijn, degree, derangement, Dijkstra, Durfee, embedding, equivalence, Eulerian, Ferrers, geodesic, graph, Gray code, group, Hamiltonian cycle, Harary, Hasse, heap, hypercube, interval, inversion, involution, isomorphism, Josephus, network, partition, perfect, permutation, planar graph, pseudograph, self-loop, sequence, signature, simple, spanning tree, stable marriage, star, Stirling, transitive closure, traveling salesman tour, tree, Turan, vertex cover, wheel, Young tableau *) (* :Source: Sriram V. Pemmaraju and Steven S. Skiena Computational Discrete Mathematics: Combinatorics and Graph Theory in Mathematica, *) (* :Mathematica Version: 4.0 *) BeginPackage["DiscreteMath`Combinatorica`", "DiscreteMath`CombinatorialFunctions`", (* needed for CatalanNumber *) "Graphics`Colors`", (* needed for the enhanced graphics routines such as ShowGraph *) "Graphics`Arrow`", (* needed for drawing directed edges *) "Statistics`DiscreteDistributions`" (* needed for generating random graph*) ] Unprotect[ AcyclicQ, AddEdge, AddEdges, AddVertex, AddVertices, Algorithm, AllPairsShortestPath, AlternatingGroup, AlternatingGroupIndex, AlternatingPaths, AnimateGraph, AntiSymmetricQ, Approximate, ApproximateVertexCover, ArticulationVertices, Automorphisms, Backtrack, BellB, BellmanFord, BiconnectedComponents, BiconnectedQ, BinarySearch, BinarySubsets, BipartiteMatching, BipartiteMatchingAndCover, BipartiteQ, BooleanAlgebra, Box, BreadthFirstTraversal, Brelaz, BrelazColoring, Bridges, ButterflyGraph, ToCanonicalSetPartition, CageGraph, CartesianProduct, Center, ChangeEdges, ChangeVertices, ChromaticNumber, ChromaticPolynomial, ChvatalGraph, CirculantGraph, CircularEmbedding, CircularVertices, CliqueQ, CoarserSetPartitionQ, CodeToLabeledTree, Cofactor, CompleteBinaryTree, CompleteKaryTree, CompleteKPartiteGraph, CompleteGraph, CompleteQ, Compositions, ConnectedComponents, ConnectedQ, ConstructTableau, Contract, CostOfPath, CoxeterGraph, CubeConnectedCycle, CubicalGraph, Cut, Cycle, Cycles, CycleIndex, CycleStructure, Cyclic, CyclicGroup, CyclicGroupIndex, DeBruijnGraph, DeBruijnSequence, Degrees, DegreesOf2Neighborhood, DegreeSequence, DeleteCycle, DeleteEdge, DeleteEdges, DeleteFromTableau, DeleteVertex, DeleteVertices, DepthFirstTraversal, DerangementQ, Derangements, Diameter, Dihedral, DihedralGroup, DihedralGroupIndex, Dijkstra, DilateVertices, Directed, Distances, DistinctPermutations, Distribution, DodecahedralGraph, DominatingIntegerPartitionQ, DominationLattice, DurfeeSquare, Eccentricity, Edge, EdgeChromaticNumber, EdgeColor, EdgeColoring, EdgeConnectivity, EdgeDirection, EdgeLabel, EdgeLabelColor, EdgeLabelPosition, Edges, EdgeStyle, EdgeWeight, Element, EmptyGraph, EmptyQ, EncroachingListSet, EquivalenceClasses, EquivalenceRelationQ, Equivalences, Euclidean, Eulerian, EulerianCycle, EulerianQ, ExactRandomGraph, ExpandGraph, ExtractCycles, FerrersDiagram, FindCycle, FindSet, FiniteGraphs, FirstLexicographicTableau, FolkmanGraph, FranklinGraph, FruchtGraph, FromAdjacencyLists, FromAdjacencyMatrix, FromCycles, FromInversionVector, FromOrderedPairs, FromUnorderedPairs, FunctionalGraph, GeneralizedPetersenGraph, GetEdgeLabels, GetEdgeWeights, GetVertexLabels, GetVertexWeights, Girth, GraphCenter, GraphComplement, GraphDifference, GraphicQ, GraphIntersection, GraphJoin, GraphOptions, GraphPolynomial, GraphPower, GraphProduct, GraphSum, GraphUnion, GrayCode, GrayCodeSubsets, GrayCodeKSubsets, GrayGraph, Greedy, GreedyVertexCover, GridGraph, GrotztschGraph, HamiltonianCycle, HamiltonianPath, HamiltonianQ, Harary, HasseDiagram, Heapify, HeapSort, HeawoodGraph, HerschelGraph, HideCycles, HighlightedEdgeColors, HighlightedEdgeStyle, HighlightedVertexColors, HighlightedVertexStyle, Highlight, Hypercube, IcosahedralGraph, IdenticalQ, IdentityPermutation, IncidenceMatrix, InDegree, IndependentSetQ, Index, InduceSubgraph, InitializeUnionFind, InsertIntoTableau, IntervalGraph, Invariants, InversePermutation, InversionPoset, Inversions, InvolutionQ, Involutions, IsomorphicQ, Isomorphism, IsomorphismQ, Josephus, KnightsTourGraph, KSetPartitions, KSubsetGroup, KSubsetGroupIndex, KSubsets, LNorm, LabeledTreeToCode, Large, LastLexicographicTableau, LexicographicPermutations, LexicographicSubsets, LeviGraph, LineGraph, ListGraphs, ListNecklaces, LongestIncreasingSubsequence, LoopPosition, LowerLeft, LowerRight, M, MakeDirected, MakeGraph, MakeSimple, MakeUndirected, MaximalMatching, MaximumAntichain, MaximumClique, MaximumIndependentSet, MaximumSpanningTree, McGeeGraph, MeredithGraph, MinimumChainPartition, MinimumChangePermutations, MinimumSpanningTree, MinimumVertexColoring, MinimumVertexCover, MultipleEdgesQ, MultiplicationTable, MycielskiGraph, NecklacePolynomial, Neighborhood, NetworkFlow, NetworkFlowEdges, NextBinarySubset, NextComposition, NextGrayCodeSubset, NextKSubset, NextLexicographicSubset, NextPartition, NextPermutation, NextSubset, NextTableau, NoMultipleEdges, NonLineGraphs, NoPerfectMatchingGraph, Normal, NormalDashed, NormalizeVertices, NoSelfLoops, NthPair, NthPermutation, NthSubset, NumberOfCompositions, NumberOfDerangements, NumberOfDirectedGraphs, NumberOfGraphs, NumberOfInvolutions, NumberOf2Paths, NumberOfKPaths, NumberOfNecklaces, NumberOfPartitions, NumberOfPermutationsByCycles, NumberOfPermutationsByInversions, NumberOfPermutationsByType, NumberOfSpanningTrees, NumberOfTableaux, OctahedralGraph, OddGraph, One, Optimum, OrbitInventory, OrbitRepresentatives, Orbits, Ordered, OrientGraph, OutDegree, PairGroup, PairGroupIndex, Parent, ParentsToPaths, PartialOrderQ, PartitionLattice, PartitionQ, Partitions, Path, PerfectQ, PermutationGraph, PermutationGroupQ, PermutationQ, PermutationToTableaux, PermutationType, PermutationWithCycle, Permute, PermuteSubgraph, PetersenGraph, PlanarQ, PlotRange, Polya, PseudographQ, RadialEmbedding, Radius, RandomComposition, RandomGraph, RandomHeap, RandomInteger, RandomKSetPartition, RandomKSubset, RandomPartition, RandomPermutation, RandomRGF, RandomSetPartition, RandomSubset, RandomTableau, RandomTree, RandomVertices, RankBinarySubset, RankedEmbedding, RankGraph, RankGrayCodeSubset, RankKSetPartition, RankKSubset, RankPermutation, RankRGF, RankSetPartition, RankSubset, ReadGraph, RealizeDegreeSequence, ReflexiveQ, RegularGraph, RegularQ, RemoveMultipleEdges, RemoveSelfLoops, ResidualFlowGraph, RevealCycles, ReverseEdges, RGFQ, RGFs, RGFToSetPartition, RobertsonGraph, RootedEmbedding, RotateVertices, Runs, SamenessRelation, SelectionSort, SelfComplementaryQ, SelfLoopsQ, SetEdgeWeights, SetGraphOptions, SetPartitions, SetPartitionListViaRGF, SetPartitionQ, SetPartitionToRGF, SetEdgeLabels, SetVertexLabels, SetVertexWeights, ShakeGraph, ShortestPath, ShortestPathSpanningTree, ShowLabeledGraph, ShowGraph, ShowGraphArray, ShuffleExchangeGraph, SignaturePermutation, Simple, SimpleQ, Small, SmallestCyclicGroupGraph, Spectrum, SpringEmbedding, StableMarriage, Star, StirlingFirst, StirlingSecond, Strings, Strong, StronglyConnectedComponents, Subsets, SymmetricGroup, SymmetricGroupIndex, SymmetricQ, TableauClasses, TableauQ, Tableaux, TableauxToPermutation, TetrahedralGraph, Thick, ThickDashed, Thin, ThinDashed, ThomassenGraph, ToAdjacencyLists, ToAdjacencyMatrix, ToCycles, ToInversionVector, ToOrderedPairs, TopologicalSort, ToUnorderedPairs, TransitiveClosure, TransitiveQ, TransitiveReduction, TranslateVertices, TransposePartition, TransposeTableau, TravelingSalesmanBounds, TravelingSalesman, TreeIsomorphismQ, TreeQ, TreeToCertificate, TriangleInequalityQ, Turan, TutteGraph, TwoColoring, Type, Undirected, UndirectedQ, UnionSet, Uniquely3ColorableGraph, UnitransitiveGraph, UnrankBinarySubset, UnrankGrayCodeSubset, UnrankKSetPartition, UnrankKSubset, UnrankPermutation, UnrankRGF, UnrankSetPartition, UnrankSubset, UnweightedQ, UpperLeft, UpperRight, V, VertexColor, VertexColoring, VertexConnectivity, VertexConnectivityGraph, VertexCover, VertexCoverQ, VertexLabel, VertexLabelColor, VertexNumber, VertexNumberColor, VertexStyle, VertexWeight, Vertices, WaltherGraph, Weak, WeaklyConnectedComponents, WeightingFunction, WeightRange, Wheel, WriteGraph, Zoom ] AcyclicQ::usage = "AcyclicQ[g] yields True if graph g is acyclic." AddEdge::usage = "AddEdge[g, e] returns a graph g with the new edge e added. e can have the form {a, b} or the form {{a, b}, options}." AddEdges::usage = "AddEdges[g, edgeList] gives graph g with the new edges in edgeList added. edgeList can have the form {a, b} to add a single edge {a, b} or the form {{a, b}, {c, d}, ...}, to add edges {a, b}, {c, d}, ... or the form { {{a, b}, x}, {{c, d}, y}, ...}, where x and y can specify graphics information associated with {a, b} and {c, d}, respectively." AddVertex::usage = "AddVertex[g] adds one disconnected vertex to graph g. AddVertex[g, v] adds to g a vertex with coordinates specified by v." AddVertices::usage = "AddVertices[g, n] adds n disconnected vertices to graph g. AddVertices[g, vList] adds vertices in vList to g. vList contains embedding and graphics information and can have the form {x, y} or {{x1, y1}, {x2, y2}...} or the form {{{x1, y1}, g1}, {{x2, y2}, g2},...}, where {x, y}, {x1, y1}, and {x2, y2} are point coordinates and g1 and g2 are graphics information associated with vertices." Algorithm::usage = "Algorithm is an option that informs functions such as ShortestPath, VertexColoring, and VertexCover about which algorithm to use." AllPairsShortestPath::usage = "AllPairsShortestPath[g] gives a matrix, where the (i, j)th entry is the length of a shortest path in g between vertices i and j. AllPairsShortestPath[g, Parent] returns a three-dimensional matrix with dimensions 2 * V[g] * V[g], in which the (1, i, j)th entry is the length of a shortest path from i to j and the (2, i, j)th entry is the predecessor of j in a shortest path from i to j." $NewMessage[ All, "usage"] (* reset the usage of All to the System usage *) If[StringQ[All::usage], All::usage = StringJoin[ All::usage, " All is also an option to certain Combinatorica functions specifying that all solutions should be returned, instead of just the first one."]] AlternatingGroup::usage = "AlternatingGroup[n] generates the set of even-size n permutations, the alternating group on n symbols. AlternatingGroup[l] generates the set of even permutations of the list l." AlternatingGroupIndex::usage = "AlternatingGroupIndex[n, x] gives the cycle index of the alternating group of size n permutations as a polynomial in the symbols x[1], x[2], ..., x[n]." AlternatingPaths::usage = "AlternatingPaths[g, start, ME] returns the alternating paths in graph g with respect to the matching ME, starting at the vertices in the list start. The paths are returned in the form of a forest containing trees rooted at vertices in start." AnimateGraph::usage = "AnimateGraph[g, l] displays graph g with each element in the list l successively highlighted. Here l is a list containing vertices and edges of g. An optional flag, which takes on the values All and One, can be used to inform the function about whether objects highlighted earlier will continue to be highlighted or not. The default value of flag is All. All the options allowed by the function Highlight are permitted by AnimateGraph, as well. See the usage message of Highlight for more details." AntiSymmetricQ::usage = "AntiSymmetricQ[g] yields True if the adjacency matrix of g represents an anti-symmetric binary relation." Approximate::usage = "Approximate is a value that the option Algorithm can take in calls to functions such as VertexCover, telling it to use an approximation algorithm." ApproximateVertexCover::usage = "ApproximateVertexCover[g] produces a vertex cover of graph g whose size is guaranteed to be within twice the optimal size." ArticulationVertices::usage = "ArticulationVertices[g] gives a list of all articulation vertices in graph g. These are vertices whose removal will disconnect the graph." Automorphisms::usage = "Automorphisms[g] gives the automorphism group of the graph g." Backtrack::usage = "Backtrack[s, partialQ, solutionQ] performs a backtrack search of the state space s, expanding a partial solution so long as partialQ is True and returning the first complete solution, as identified by solutionQ." BellB::usage = "BellB[n] returns the nth Bell number." BellmanFord::usage = "BellmanFord[g, v] gives a shortest-path spanning tree and associated distances from vertex v of graph g. The shortest-path spanning tree is given by a list in which element i is the predecessor of vertex i in the shortest-path spanning tree. BellmanFord works correctly even when the edge weights are negative, provided there are no negative cycles." BiconnectedComponents::usage = "BiconnectedComponents[g] gives a list of the biconnected components of graph g. If g is directed, the underlying undirected graph is used." BiconnectedQ::usage = "BiconnectedQ[g] yields True if graph g is biconnected. If g is directed, the underlying undirected graph is used." BinarySearch::usage = "BinarySearch[l, k] searches sorted list l for key k and gives the position of l containing k, if k is present in l. Otherwise, if k is absent in l, the function returns (p + 1/2) where k falls between the elements of l in positions p and p+1. BinarySearch[l, k, f] gives the position of k in the list obtained from l by applying f to each element in l." BinarySubsets::usage = "BinarySubsets[l] gives all subsets of l ordered according to the binary string defining each subset. For any positive integer n, BinarySubsets[n] gives all subsets of {1, 2,.., n} ordered according to the binary string defining each subset." BipartiteMatching::usage = "BipartiteMatching[g] gives the list of edges associated with a maximum matching in bipartite graph g. If the graph is edge weighted, then the function returns a matching with maximum total weight." BipartiteMatchingAndCover::usage = "BipartiteMatchingAndCover[g] takes a bipartite graph g and returns a matching with maximum weight along with the dual vertex cover. If the graph is not weighted, it is assumed that all edge weights are 1." BipartiteQ::usage = "BipartiteQ[g] yields True if graph g is bipartite." BooleanAlgebra::usage = "BooleanAlgebra[n] gives a Hasse diagram for the Boolean algebra on n elements. The function takes two options: Type and VertexLabel, with default values Undirected and False, respectively. When Type is set to Directed, the function produces the underlying directed acyclic graph. When VertexLabel is set to True, labels are produced for the vertices." Box::usage = "Box is a value that the option VertexStyle, used in ShowGraph, can be set to." BreadthFirstTraversal::usage = "BreadthFirstTraversal[g, v] performs a breadth-first traversal of graph g starting from vertex v, and gives the breadth-first numbers of the vertices. BreadthFirstTraversal[g, v, Edge] returns the edges of the graph that are traversed by breadth-first traversal. BreadthFirstTraversal[g, v, Tree] returns the breadth-first search tree. BreadthFirstTraversal[g, v, Level] returns the level number of the vertices." Brelaz::usage = "Brelaz is a value that the option Algorithm can take when used in the function VertexColoring." BrelazColoring::usage = "BrelazColoring[g] returns a vertex coloring in which vertices are greedily colored with the smallest available color in decreasing order of vertex degree." Bridges::usage = "Bridges[g] gives a list of the bridges of graph g, where each bridge is an edge whose removal disconnects the graph." ButterflyGraph::usage = "ButterflyGraph[n] returns the n-dimensional butterfly graph, a directed graph whose vertices are pairs (w, i), where w is a binary string of length n and i is an integer in the range 0 through n and whose edges go from vertex (w, i) to (w', i+1), if w' is identical to w in all bits with the possible exception of the (i+1)th bit. Here bits are counted left to right. An option VertexLabel, with default setting False, is allowed. When this option is set to True, vertices are labeled with strings (w, i)." CageGraph::usage = "CageGraph[k, r] gives a smallest k-regular graph of girth r for certain small values of k and r. CageGraph[r] gives CageGraph[3, r]. For k = 3, r can be 3, 4, 5, 6, 7, 8, or 10. For k = 4 or 5, r can be 3, 4, 5, or 6." CartesianProduct::usage = "CartesianProduct[l1, l2] gives the Cartesian product of lists l1 and l2." Center::usage = "Center is a value that options VertexNumberPosition, VertexLabelPosition, and EdgeLabelPosition can take on in ShowGraph." ChangeEdges::usage = "ChangeEdges[g, e] replaces the edges of graph g with the edges in e. e can have the form {{s1, t1}, {s2, t2}, ...} or the form { {{s1, t1}, gr1}, {{s2, t2}, gr2}, ...}, where {s1, t1}, {s2, t2}, ... are endpoints of edges and gr1, gr2, ... are graphics information associated with edges." ChangeVertices::usage = "ChangeVertices[g, v] replaces the vertices of graph g with the vertices in the given list v. v can have the form {{x1, y1}, {x2, y2}, ...} or the form {{{x1, y1}, gr1}, {{x2, y2}, gr2}, ...}, where {x1, y1}, {x2, y2}, ... are coordinates of points and gr1, gr2, ... are graphics information associated with vertices." ChromaticNumber::usage = "ChromaticNumber[g] gives the chromatic number of the graph, which is the fewest number of colors necessary to color the graph." ChromaticPolynomial::usage = "ChromaticPolynomial[g, z] gives the chromatic polynomial P(z) of graph g, which counts the number of ways to color g with, at most, z colors." ChvatalGraph::usage = "ChvatalGraph returns a smallest triangle-free, 4-regular, 4-chromatic graph." CirculantGraph::usage = "CirculantGraph[n, l] constructs a circulant graph on n vertices, meaning the ith vertex is adjacent to the (i+j)th and (i-j)th vertices, for each j in list l. CirculantGraph[n, l], where l is an integer, returns the graph with n vertices in which each i is adjacent to (i+l) and (i-l)." CircularEmbedding::usage = "CircularEmbedding[n] constructs a list of n points equally spaced on a circle. CircularEmbedding[g] embeds the vertices of g equally spaced on a circle." CircularVertices::usage = "CircularVertices[n] constructs a list of n points equally spaced on a circle. CircularVertices[g] embeds the vertices of g equally spaced on a circle. This function is obsolete; use CircularEmbedding instead." CliqueQ::usage = "CliqueQ[g, c] yields True if the list of vertices c defines a clique in graph g." CoarserSetPartitionQ::usage = "CoarserSetPartitionQ[a, b] yields True if set partition b is coarser than set partition a, that is, every block in a is contained in some block in b." CodeToLabeledTree::usage = "CodeToLabeledTree[l] constructs the unique labeled tree on n vertices from the Prufer code l, which consists of a list of n-2 integers between 1 and n." Cofactor::usage = "Cofactor[m, {i, j}] calculates the (i, j)th cofactor of matrix m." CompleteBinaryTree::usage = "CompleteBinaryTree[n] returns a complete binary tree on n vertices." CompleteGraph::usage = "CompleteGraph[n] creates a complete graph on n vertices. An option Type that takes on the values Directed or Undirected is allowed. The default setting for this option is Type -> Undirected. CompleteGraph[a, b, c,...] creates a complete k-partite graph of the prescribed shape. The use of CompleteGraph to create a complete k-partite graph is obsolete; use CompleteKPartiteGraph instead." CompleteKaryTree::usage = "CompleteKaryTree[n, k] returns a complete k-ary tree on n vertices." CompleteKPartiteGraph::usage = "CompleteKPartiteGraph[a, b, c, ...] creates a complete k-partite graph of the prescribed shape, provided the k arguments a, b, c, ... are positive integers. An option Type that takes on the values Directed or Undirected is allowed. The default setting for this option is Type -> Undirected." CompleteQ::usage = "CompleteQ[g] yields True if graph g is complete. This means that between any pair of vertices there is an undirected edge or two directed edges going in opposite directions." Compositions::usage = "Compositions[n, k] gives a list of all compositions of integer n into k parts." ConnectedComponents::usage = "ConnectedComponents[g] gives the vertices of graph g partitioned into connected components." ConnectedQ::usage = "ConnectedQ[g] yields True if undirected graph g is connected. If g is directed, the function returns True if the underlying undirected graph is connected. ConnectedQ[g, Strong] and ConnectedQ[g, Weak] yield True if the directed graph g is strongly or weakly connected, respectively." ConstructTableau::usage = "ConstructTableau[p] performs the bumping algorithm repeatedly on each element of permutation p, resulting in a distinct Young tableau." Contract::usage = "Contract[g, {x, y}] gives the graph resulting from contracting the pair of vertices {x, y} of graph g." CostOfPath::usage = "CostOfPath[g, p] sums up the weights of the edges in graph g defined by the path p." CoxeterGraph::usage = "CoxeterGraph gives a non-Hamiltonian graph with a high degree of symmetry such that there is a graph automorphism taking any path of length 3 to any other." CubeConnectedCycle::usage = "CubeConnectedCycle[d] returns the graph obtained by replacing each vertex in a d-dimensional hypercube by a cycle of length d. Cube-connected cycles share many properties with hypercubes but have the additional desirable property that for d > 1 every vertex has degree 3." CubicalGraph::usage = "CubicalGraph returns the graph corresponding to the cube, a Platonic solid." Cut::usage = "Cut is a tag that can be used in a call to NetworkFlow to tell it to return the minimum cut." CycleIndex::usage = "CycleIndex[pg, x] returns the polynomial in x[1], x[2], ..., x[index[g]] that is the cycle index of the permutation group pg. Here index[pg] refers to the length of each permutation in pg." Cycle::usage = "Cycle[n] constructs the cycle on n vertices, the 2-regular connected graph. An option Type that takes on values Directed or Undirected is allowed. The default setting is Type -> Undirected." Cycles::usage = "Cycles is an optional argument for the function Involutions." CycleStructure::usage = "CycleStructure[p, x] returns the monomial in x[1], x[2], ..., x[Length[p]] that is the cycle structure of the permutation p." Cyclic::usage = "Cyclic is an argument to the Polya-theoretic functions ListNecklaces, NumberOfNecklace, and NecklacePolynomial, which count or enumerate distinct necklaces. Cyclic refers to the cyclic group acting on necklaces to make equivalent necklaces that can be obtained from each other by rotation." CyclicGroup::usage = "CyclicGroup[n] returns the cyclic group of permutations on n symbols." CyclicGroupIndex::usage = "CyclicGroupIndex[n, x] returns the cycle index of the cyclic group on n symbols, expressed as a polynomial in x[1], x[2], ..., x[n]." DeBruijnGraph::usage = "DeBruijnGraph[m, n] constructs the n-dimensional De Bruijn graph with m symbols for integers m > 0 and n > 1. DeBruijnGraph[alph, n] constructs the n-dimensional De Bruijn graph with symbols from alph. Here alph is nonempty and n > 1 is an integer. In the latter form, the function accepts an option VertexLabel, with default value False, which can be set to True, if users want to associate strings on alph to the vertices as labels." DeBruijnSequence::usage = "DeBruijnSequence[a, n] returns a De Bruijn sequence on the alphabet a, a shortest sequence in which every string of length n on alphabet a occurs as a contiguous subsequence." DegreeSequence::usage = "DegreeSequence[g] gives the sorted degree sequence of graph g." Degrees::usage = "Degrees[g] returns the degrees of vertex 1, 2, 3, ... in that order." DegreesOf2Neighborhood::usage = "DegreesOf2Neighborhood[g, v] returns the sorted list of degrees of vertices of graph g within a distance of 2 from v." DeleteCycle::usage = "DeleteCycle[g, c] deletes a simple cycle c from graph g. c is specified as a sequence of vertices in which the first and last vertices are identical. g can be directed or undirected. If g does not contain c, it is returned unchanged; otherwise g is returned with c deleted." DeleteEdge::usage = "DeleteEdge[g, e] gives graph g minus e. If g is undirected, then e is treated as an undirected edge, otherwise it is treated as a directed edge. If there are multiple edges between the specified vertices, only one edge is deleted. DeleteEdge[g, e, All] will delete all edges between the specified pair of vertices. Using the tag Directed as a third argument in DeleteEdge is now obsolete." DeleteEdges::usage = "DeleteEdges[g, edgeList] gives graph g minus the list of edges edgeList. If g is undirected, then the edges in edgeList are treated as undirected edges, or otherwise they are treated as directed edges. If there are multiple edges that qualify, then only one edge is deleted. DeleteEdges[g, edgeList, All] will delete all edges that qualify. If only one edge is to be deleted, then edgeList can have the form {s, t}, or otherwise it has the form {{s1, t1}, {s2, t2}, ...}." DeleteFromTableau::usage = "DeleteFromTableau[t, r] deletes the last element of row r from Young tableaux t." DeleteVertex::usage = "DeleteVertex[g, v] deletes a single vertex v from graph g. Here v is a vertex number." DeleteVertices::usage = "DeleteVertices[g, vList] deletes vertices in vList from graph g. vList has the form {i, j, ...}, where i, j, ... are vertex numbers." DepthFirstTraversal::usage = "DepthFirstTraversal[g, v] performs a depth-first traversal of graph g starting from vertex v, and gives a list of vertices in the order in which they were encountered. DepthFirstTraversal[g, v, Edge] returns the edges of the graph that are traversed by the depth-first traversal in the order in which they are traversed. DepthFirstTraversal[g, v, Tree] returns the depth-first tree of the graph." DerangementQ::usage = "DerangementQ[p] tests whether permutation p is a derangement, that is, a permutation without a fixed point." Derangements::usage = "Derangements[p] constructs all derangements of permutation p." Diameter::usage = "Diameter[g] gives the diameter of graph g, the maximum length, among all pairs of vertices in g, of a shortest path between each pair." Dihedral::usage = "Dihedral is an argument to the Polya-theoretic functions ListNecklaces, NumberOfNecklace, and NecklacePolynomial, which count or enumerate distinct necklaces. Dihedral refers to the dihedral group acting on necklaces to make equivalent necklaces that can be obtained from each other by a rotation or a flip." DihedralGroup::usage = "DihedralGroup[n] returns the dihedral group on n symbols. Note that the order of this group is 2n." DihedralGroupIndex::usage = "DihedralGroupIndex[n, x] returns the cycle index of the dihedral group on n symbols, expressed as a polynomial in x[1], x[2], ..., x[n]." Dijkstra::usage = "Dijkstra[g, v] gives a shortest-path spanning tree and associated distances from vertex v of graph g. The shortest-path spanning tree is given by a list in which element i is the predecessor of vertex i in the shortest-path spanning tree. Dijkstra does not work correctly when the edge weights are negative; BellmanFord should be used in this case." DilateVertices::usage = "DilateVertices[v, d] multiplies each coordinate of each vertex position in list v by d, thus dilating the embedding. DilateVertices[g, d] dilates the embedding of graph g by the factor d." Directed::usage = "Directed is an option value for Type." $NewMessage[Disk, "usage"] (* reset the usage of Disk to the system usage *) If[StringQ[Disk::usage], Disk::usage = StringJoin[Disk::usage, " Disk is also a value taken by the VertexStyle option in ShowGraph."]] Distances::usage = "Distances[g, v] returns the distances in nondecreasing order from vertex v to all vertices in g, treating g as an unweighted graph." DistinctPermutations::usage = "DistinctPermutations[l] gives all permutations of the multiset described by list l." Distribution::usage = "Distribution[l, set] lists the frequency of each element of set in list l." DodecahedralGraph::usage = "DodecahedralGraph returns the graph corresponding to the dodecahedron, a Platonic solid." DominatingIntegerPartitionQ::usage = "DominatingIntegerPartitionQ[a, b] yields True if integer partition a dominates integer partition b, that is, the sum of a size-t prefix of a is no smaller than the sum of a size-t prefix of b for every t." DominationLattice::usage = "DominationLattice[n] returns a Hasse diagram of the partially ordered set on integer partitions of n in which p < q if q dominates p. The function takes two options: Type and VertexLabel, with default values Undirected and False, respectively. When Type is set to Directed, the function produces the underlying directed acyclic graph. When VertexLabel is set to True, labels are produced for the vertices." DurfeeSquare::usage = "DurfeeSquare[p] gives the number of rows involved in the Durfee square of partition p, the side of the largest-sized square contained within the Ferrers diagram of p." Eccentricity::usage = "Eccentricity[g] gives the eccentricity of each vertex v of graph g, the maximum length among all shortest paths from v." Edge::usage = "Edge is an optional argument to inform certain functions to work with edges instead of vertices." EdgeChromaticNumber::usage = "EdgeChromaticNumber[g] gives the fewest number of colors necessary to color each edge of graph g, so that no two edges incident on the same vertex have the same color." EdgeColor::usage = "EdgeColor is an option that allows the user to associate colors with edges. Black is the default color. EdgeColor can be set as part of the graph data structure or in ShowGraph." EdgeColoring::usage = "EdgeColoring[g] uses Brelaz's heuristic to find a good, but not necessarily minimal, edge coloring of graph g." EdgeConnectivity::usage = "EdgeConnectivity[g] gives the minimum number of edges whose deletion from graph g disconnects it. EdgeConnectivity[g, Cut] gives a set of edges of minimum size whose deletion disconnects the graph." EdgeDirection::usage = "EdgeDirection is an option that takes on values True or False allowing the user to specify whether the graph is directed or not. EdgeDirection can be set as part of the graph data structure or in ShowGraph." EdgeLabel::usage = "EdgeLabel is an option that can take on values True or False, allowing the user to associate labels to edges. By default, there are no edge labels. The EdgeLabel option can be set as part of the graph data structure or in ShowGraph." EdgeLabelColor::usage = "EdgeLabelColor is an option that allows the user to associate different colors to edge labels. Black is the default color. EdgeLabelColor can be set as part of the graph data structure or in ShowGraph." EdgeLabelPosition::usage = "EdgeLabelPosition is an option that allows the user to place an edge label in a certain position relative to the midpoint of the edge. LowerLeft is the default value of this option. EdgeLabelPosition can be set as part of the graph data structure or in ShowGraph." Edges::usage = "Edges[g] gives the list of edges in g. Edges[g, All] gives the edges of g along with the graphics options associated with each edge. Edges[g, EdgeWeight] returns the list of edges in g along with their edge weights." EdgeStyle::usage = "EdgeStyle is an option that allows the user to associate different sizes and shapes to edges. A line segment is the default edge. EdgeStyle can be set as part of the graph data structure or in ShowGraph." EdgeWeight::usage = "EdgeWeight is an option that allows the user to associate weights with edges. 1 is the default weight. EdgeWeight can be set as part of the graph data structure." $NewMessage[ Element, "usage"] (* reset the usage of Element to the System usage *) If[StringQ[Element::usage], Element::usage = StringJoin[ Element::usage, " The use of the function Element in Combinatorica is now obsolete, though the function call Element[a, p] still gives the pth element of nested list a, where p is a list of indices."]] EmptyGraph::usage = "EmptyGraph[n] generates an empty graph on n vertices. An option Type that can take on values Directed or Undirected is provided. The default setting is Type -> Undirected." EmptyQ::usage = "EmptyQ[g] yields True if graph g contains no edges." EncroachingListSet::usage = "EncroachingListSet[p] constructs the encroaching list set associated with permutation p." EquivalenceClasses::usage = "EquivalenceClasses[r] identifies the equivalence classes among the elements of matrix r." EquivalenceRelationQ::usage = "EquivalenceRelationQ[r] yields True if the matrix r defines an equivalence relation. EquivalenceRelationQ[g] tests whether the adjacency matrix of graph g defines an equivalence relation." Equivalences::usage = "Equivalences[g, h] lists the vertex equivalence classes between graphs g and h defined by their vertex degrees. Equivalences[g] lists the vertex equivalences for graph g defined by the vertex degrees. Equivalences[g, h, f1, f2, ...] and Equivalences[g, f1, f2, ...] can also be used, where f1, f2, ... are functions that compute other vertex invariants. It is expected that for each function fi, the call fi[g, v] returns the corresponding invariant at vertex v in graph g. The functions f1, f2, ... are evaluated in order, and the evaluation stops either when all functions have been evaluated or when an empty equivalence class is found. Three vertex invariants, DegreesOf2Neighborhood, NumberOf2Paths, and Distances are Combinatorica functions and can be used to refine the equivalences." Euclidean::usage = "Euclidean is an option for SetEdgeWeights." Eulerian::usage = "Eulerian[n, k] gives the number of permutations of length n with k runs." EulerianCycle::usage = "EulerianCycle[g] finds an Eulerian cycle of g if one exists." EulerianQ::usage = "EulerianQ[g] yields True if graph g is Eulerian, meaning there exists a tour that includes each edge exactly once." ExactRandomGraph::usage = "ExactRandomGraph[n, e] constructs a random labeled graph of exactly e edges and n vertices." ExpandGraph::usage = "ExpandGraph[g, n] expands graph g to n vertices by adding disconnected vertices. This is obsolete; use AddVertices[g, n] instead." ExtractCycles::usage = "ExtractCycles[g] gives a maximal list of edge-disjoint cycles in graph g." FerrersDiagram::usage = "FerrersDiagram[p] draws a Ferrers diagram of integer partition p." FindCycle::usage = "FindCycle[g] finds a list of vertices that define a cycle in graph g." FindSet::usage = "FindSet[n, s] gives the root of the set containing n in union-find data structure s." FiniteGraphs::usage = "FiniteGraphs produces a convenient list of all the interesting, finite, parameterless graphs built into Combinatorica." FirstLexicographicTableau::usage = "FirstLexicographicTableau[p] constructs the first Young tableau with shape described by partition p." FolkmanGraph::usage = "FolkmanGraph returns a smallest graph that is edge-transitive but not vertex-transitive." FranklinGraph::usage = "FranklinGraph returns a 12-vertex graph that represents a 6-chromatic map on the Klein bottle. It is the sole counterexample to Heawood's map coloring conjecture." FromAdjacencyLists::usage = "FromAdjacencyLists[l] constructs an edge list representation for a graph from the given adjacency lists l, using a circular embedding. FromAdjacencyLists[l, v] uses v as the embedding for the resulting graph. An option called Type that takes on the values Directed or Undirected can be used to affect the type of graph produced. The default value of Type is Undirected." FromAdjacencyMatrix::usage = "FromAdjacencyMatrix[m] constructs a graph from a given adjacency matrix m, using a circular embedding. FromAdjacencyMatrix[m, v] uses v as the embedding for the resulting graph. An option Type that takes on the values Directed or Undirected can be used to affect the type of graph produced. The default value of Type is Undirected. FromAdjacencyMatrix[m, EdgeWeight] interprets the entries in m as edge weights, with infinity representing missing edges, and from this constructs a weighted graph using a circular embedding. FromAdjacencyMatrix[m, v, EdgeWeight] uses v as the embedding for the resulting graph. The option Type can be used along with the EdgeWeight tag." FromCycles::usage = "FromCycles[{c1, c2, ...}] gives the permutation that has the given cycle structure." FromInversionVector::usage = "FromInversionVector[v] reconstructs the unique permutation with inversion vector v." FromOrderedPairs::usage = "FromOrderedPairs[l] constructs an edge list representation from a list of ordered pairs l, using a circular embedding. FromOrderedPairs[l, v] uses v as the embedding for the resulting graph. The option Type that takes on values Undirected or Directed can be used to affect the kind of graph produced. The default value of Type is Directed. Type -> Undirected results in the underlying undirected graph." FromUnorderedPairs::usage = "FromUnorderedPairs[l] constructs an edge list representation from a list of unordered pairs l, using a circular embedding. FromUnorderedPairs[l, v] uses v as the embedding for the resulting graph. The option Type that takes on values Undirected or Directed can be used to affect the kind of graph produced." FruchtGraph::usage = "FruchtGraph returns the smallest 3-regular graph whose automorphism group consists of only the identity." FunctionalGraph::usage = "FunctionalGraph[f, v] takes a set v and a function f from v to v and constructs a directed graph with vertex set v and edges (x, f(x)) for each x in v. FunctionalGraph[f, v], where f is a list of functions, constructs a graph with vertex set v and edge set (x, fi(x)) for every fi in f. An option called Type that takes on the values Directed and Undirected is allowed. Type -> Directed is the default, while Type -> Undirected returns the corresponding underlying undirected graph. FunctionalGraph[f, n] takes a nonnegative integer nand a function f from {0,1,..., n-1} onto itself and produces the directed graphwith vertex set {0, 1,..., n-1} and edge set {x, f(x)} for each vertex x." GeneralizedPetersenGraph::usage = "GeneralizedPetersenGraph[n, k] returns the generalized Petersen graph, for integers n > 1 and k > 0, which is the graph with vertices {u1, u2, ..., un} and {v1, v2, ..., vn} and edges {ui, u(i+1)}, {vi, v(i+k)}, and {ui, vi}. The Petersen graph is identical to the generalized Petersen graph with n = 5 and k = 2." GetEdgeLabels::usage = "GetEdgeLabels[g] returns the list of labels of the edges of g. GetEdgeLabels[g, es] returns the list of labels in graph g of the edges in es." GetEdgeWeights::usage = "GetEdgeWeights[g] returns the list of weights of the edges of g. GetEdgeWeights[g, es] returns the list of weights in graph g of the edges in es." GetVertexLabels::usage = "GetVertexLabels[g] returns the list of labels of vertices of g. GetVertexLabels[g, vs] returns the list of labels in graph g of the vertices specified in list vs." GetVertexWeights::usage = "GetVertexWeights[g] returns the list of weights of vertices of g. GetVertexWeights[g, vs] returns the list of weights in graph g of the vertices in vs." Girth::usage = "Girth[g] gives the length of a shortest cycle in a simple graph g." Graph::usage = "Graph[e, v, opts] represents a graph object where e is the list of edges annotated with graphics options, v is a list of vertices annotated with graphics options, and opts is a set of global graph options. e has the form {{{i1, j1}, opts1}, {{i2, j2}, opts2},...}, where {i1, j1}, {i2, j2},... are edges of the graph and opts1, opts2,... are options that respectively apply to these edges. v has the form {{{x1, y1}, opts1}, {{x2, y2}, opts2},...}, where {x1, y1}, {x2, y2},... respectively denote the coordinates in the plane of vertex 1, vertex 2,... and opts1, opts2,... are options that respectively apply to these vertices. Permitted edge options are EdgeWeight, EdgeColor, EdgeStyle, EdgeLabel, EdgeLabelColor, and EdgeLabelPosition. Permitted vertex options are VertexWeight, VertexColor, VertexStyle, VertexNumber, VertexNumberColor, VertexNumberPosition, VertexLabel, VertexLabelColor, and VertexLabelPosition. The third item in a Graph object is opts, a sequence of zero or more global options that apply to all vertices or all edges or to the graph as a whole. All of the edge options and vertex options can be used as global options also. If a global option and a local edge option or vertex option differ, then the local edge or vertex option is used for that particular edge or vertex. In addition to these options, the following two options can also be specified as part of the global options: LoopPosition and EdgeDirection. Furthermore, all the options of the Mathematica function Plot can be used as global options in a Graph object. These can be used to specify how the graph looks when it is drawn. Also, all options of the graphics primitive Arrow can also be specified as part of global graph options. These can be used to affect the look of arrows that represent directed edges. See the usage message of individual options to find out more about values these options can take on. Whether a graph is undirected or directed is given by the option EdgeDirection. This has default value False. For undirected graphs, the edges {i1, j1}, {i2, j2},... have to satisfy i1 <= j1, i2 <= j2,... and for directed graphs the edges {i1, j1}, {i2, j2},... are treated as ordered pairs, each specifying the direction of the edge as well." GraphCenter::usage = "GraphCenter[g] gives a list of the vertices of graph g with minimum eccentricity." GraphComplement::usage = "GraphComplement[g] gives the complement of graph g." GraphDifference::usage = "GraphDifference[g, h] constructs the graph resulting from subtracting the edges of graph h from the edges of graph g." GraphicQ::usage = "GraphicQ[s] yields True if the list of integers s is a graphic sequence, and thus represents a degree sequence of some graph." GraphIntersection::usage = "GraphIntersection[g1, g2, ...] constructs the graph defined by the edges that are in all the graphs g1, g2, ...." GraphJoin::usage = "GraphJoin[g1, g2, ...] constructs the join of graphs g1, g2, and so on. This is the graph obtained by adding all possible edges between different graphs to the graph union of g1, g2, ...." GraphOptions::usage = "GraphOptions[g] returns the display options associated with g. GraphOptions[g, v] returns the display options associated with vertex v in g. GraphOptions[g, {u, v}] returns the display options associated with edge {u, v} in g." GraphPolynomial::usage = "GraphPolynomial[n, x] returns a polynomial in x in which the coefficient of x^m is the number of nonisomorphic graphs with n vertices and m edges. GraphPolynomial[n, x, Directed] returns a polynomial in x in which the coefficient of x^m is the number of nonisomorphic directed graphs with n vertices and m edges." GraphPower::usage = "GraphPower[g, k] gives the kth power of graph g. This is the graph whose vertex set is identical to the vertex set of g and that contains an edge between vertices i and j if g contains a path between i and j of length, at most, k." GraphProduct::usage = "GraphProduct[g1, g2, ...] constructs the product of graphs g1, g2, and so forth." GraphSum::usage = "GraphSum[g1, g2, ...] constructs the graph resulting from joining the edge lists of graphs g1, g2, and so forth." GraphUnion::usage = "GraphUnion[g1, g2, ...] constructs the union of graphs g1, g2, and so forth. GraphUnion[n, g] constructs n copies of graph g, for any nonnegative integer n." GrayCode::usage = "GrayCode[l] constructs a binary reflected Gray code on set l. GrayCode is obsolete, so use GrayCodeSubsets instead." GrayCodeKSubsets::usage = "GrayCodeKSubsets[l, k] generates k-subsets of l in Gray code order." GrayCodeSubsets::usage = "GrayCodeSubsets[l] constructs a binary reflected Gray code on set l." GrayGraph::usage = "GrayGraph returns a 3-regular, 54-vertex graph that is edge-transitive but not vertex-transitive; the smallest known such example." Greedy::usage = "Greedy is a value that the option Algorithm can take in calls to functions such as VertexCover, telling the function to use a greedy algorithm." GreedyVertexCover::usage = "GreedyVertexCover[g] returns a vertex cover of graph g constructed using the greedy algorithm. This is a natural heuristic for constructing a vertex cover, but it can produce poor vertex covers." GridGraph::usage = "GridGraph[n, m] constructs an n*m grid graph, the product of paths on n and m vertices. GridGraph[p, q, r] constructs a p*q*r grid graph, the product of GridGraph[p, q] and a path of length r." GrotztschGraph::usage = "GrotztschGraph returns the smallest triangle-free graph with chromatic number 4. This is identical to MycielskiGraph[4]." HamiltonianCycle::usage = "HamiltonianCycle[g] finds a Hamiltonian cycle in graph g if one exists. HamiltonianCycle[g, All] gives all Hamiltonian cycles of graph g." HamiltonianPath::usage = "HamiltonianPath[g] finds a Hamiltonian path in graph g if one exists. HamiltonianPath[g, All] gives all Hamiltonian paths of graph g." HamiltonianQ::usage = "HamiltonianQ[g] yields True if there exists a Hamiltonian cycle in graph g, or in other words, if there exists a cycle that visits each vertex exactly once." Harary::usage = "Harary[k, n] constructs the minimal k-connected graph on n vertices." HasseDiagram::usage = "HasseDiagram[g] constructs a Hasse diagram of the relation defined by directed acyclic graph g." Heapify::usage = "Heapify[p] builds a heap from permutation p." HeapSort::usage = "HeapSort[l] performs a heap sort on the items of list l." HeawoodGraph::usage = "HeawoodGraph returns a smallest (6, 3)-cage, a 3-regular graph with girth 6." HerschelGraph::usage = "HerschelGraph returns a graph object that represents a Herschel graph." HideCycles::usage = "HideCycles[c] canonically encodes the cycle structure c into a unique permutation." Highlight::usage = "Highlight[g, p] displays g with elements in p highlighted. The second argument p has the form {s1, s2,...}, where the sis are disjoint subsets of vertices and edges of g. The options, HighlightedVertexStyle, HighlightedEdgeStyle, HighlightedVertexColors, and HighlightedEdgeColors are used to determine the appearance of the highlighted elements of the graph. The default settings of the style options are HighlightedVertexStyle->Disk[Large] and HighlightedEdgeStyle->Thick. The options HighlightedVertexColors and HighlightedEdgeColors are both set to {Black, Red, Blue, Green, Yellow, Purple, Brown, Orange, Olive, Pink, DeepPink, DarkGreen, Maroon, Navy}. The colors are chosen from the palette of colors with color 1 used for s1, color 2 used for s2, and so on. If there are more parts than colors, then the colors are used cyclically. The function permits all the options that SetGraphOptions permits, for example, VertexColor, VertexStyle, EdgeColor, and EdgeStyle. These options can be used to control the appearance of the non-highlighted vertices and edges." HighlightedEdgeColors::usage = "HighlightedEdgeColors is an option to Highlight that determines which colors are used for the highlighted edges." HighlightedEdgeStyle::usage = "HighlightedEdgeStyle is an option to Highlight that determines how the highlighted edges are drawn." HighlightedVertexColors::usage = "HighlightedVertexColors is an option to Highlight that determines which colors are used for the highlighted vertices." HighlightedVertexStyle::usage = "HighlightedVertexStyle is an option to Highlight that determines how the highlighted vertices are drawn." Hypercube::usage = "Hypercube[n] constructs an n-dimensional hypercube." IcosahedralGraph::usage = "IcosahedralGraph returns the graph corresponding to the icosahedron, a Platonic solid." IdenticalQ::usage = "IdenticalQ[g, h] yields True if graphs g and h have identical edge lists, even though the associated graphics information need not be the same." IdentityPermutation::usage = "IdentityPermutation[n] gives the size-n identity permutation." IncidenceMatrix::usage = "IncidenceMatrix[g] returns the (0, 1)-matrix of graph g, which has a row for each vertex and a column for each edge and (v, e) = 1 if and only if vertex v is incident upon edge e. For a directed graph, (v, e) = 1 if edge e is outgoing from v." InDegree::usage = "InDegree[g, n] returns the in-degree of vertex n in directed graph g. InDegree[g] returns the sequence of in-degrees of the vertices in directed graph g." IndependentSetQ::usage = "IndependentSetQ[g, i] yields True if the vertices in list i define an independent set in graph g." Index::usage = "Index[p] gives the index of permutation p, the sum of all subscripts j such that p[j] is greater than p[j+1]." InduceSubgraph::usage = "InduceSubgraph[g, s] constructs the subgraph of graph g induced by the list of vertices s." InitializeUnionFind::usage = "InitializeUnionFind[n] initializes a union-find data structure for n elements." InsertIntoTableau::usage = "InsertIntoTableau[e, t] inserts integer e into Young tableau t using the bumping algorithm. InsertIntoTableau[e, t, All] inserts e into Young tableau t and returns the new tableau as well as the row whose size is expanded as a result of the insertion." IntervalGraph::usage = "IntervalGraph[l] constructs the interval graph defined by the list of intervals l." Invariants::usage = "Invariants is an option to the functions Isomorphism and IsomorphicQ that informs these functions about which vertex invariants to use in computing equivalences between vertices." InversePermutation::usage = "InversePermutation[p] yields the multiplicative inverse of permutation p." InversionPoset::usage = "InversionPoset[n] returns a Hasse diagram of the partially ordered set on size-n permutations in which p < q if q can be obtained from p by an adjacent transposition that places the larger element before the smaller. The function takes two options: Type and VertexLabel, with default values Undirected and False, respectively. When Type is set to Directed, the function produces the underlying directed acyclic graph. When VertexLabel is set to True, labels are produced for the vertices." Inversions::usage = "Inversions[p] counts the number of inversions in permutation p." InvolutionQ::usage = "InvolutionQ[p] yields True if permutation p is its own inverse." Involutions::usage = "Involutions[l] gives the list of involutions of the elements in the list l. Involutions[l, Cycles] gives the involutions in their cycle representation. Involution[n] gives size-n involutions. Involutions[n, Cycles] gives size-n involutions in their cycle representation." IsomorphicQ::usage = "IsomorphicQ[g, h] yields True if graphs g and h are isomorphic. This function takes an option Invariants -> {f1, f2, ...}, where f1, f2, ... are functions that are used to compute vertex invariants. These functions are used in the order in which they are specified. The default value of Invariants is {DegreesOf2Neighborhood, NumberOf2Paths, Distances}." Isomorphism::usage = "Isomorphism[g, h] gives an isomorphism between graphs g and h if one exists. Isomorphism[g, h, All] gives all isomorphisms between graphs g and h. Isomorphism[g] gives the automorphism group of g. This function takes an option Invariants -> {f1, f2, ...}, where f1, f2, ... are functions that are used to compute vertex invariants. These functions are used in the order in which they are specified. The default value of Invariants is {DegreesOf2Neighborhood, NumberOf2Paths, Distances}." IsomorphismQ::usage = "IsomorphismQ[g, h, p] tests if permutation p defines an isomorphism between graphs g and h." Josephus::usage = "Josephus[n, m] generates the inverse of the permutation defined by executing every mth member in a circle of n members." KnightsTourGraph::usage = "KnightsTourGraph[m, n] returns a graph with m*n vertices in which each vertex represents a square in an m x n chessboard and each edge corresponds to a legal move by a knight from one square to another." KSetPartitions::usage = "KSetPartitions[set, k] returns the list of set partitions of set with k blocks. KSetPartitions[n, k] returns the list of set partitions of {1, 2, ..., n} with k blocks. If all set partitions of a set are needed, use the function SetPartitions." KSubsetGroup::usage = "KSubsetGroup[pg, s] returns the group induced by a permutation group pg on the set s of k-subsets of [n], where n is the index of pg. The optional argument Type can be Ordered or Unordered and depending on the value of Type s is treated as a set of k-subsets or k-tuples." KSubsetGroupIndex::usage = "KSubsetGroupIndex[g, s, x] returns the cycle index of the k-subset group on s expressed as a polynomial in x[1], x[2], .... This function also takes the optional argument Type that tells the function whether the elements of s should be treated as sets or tuples." KSubsets::usage = "KSubsets[l, k] gives all subsets of set l containing exactly k elements, ordered lexicographically." $NewMessage[ K, "usage"] (* reset the usage of K to the System usage *) If[StringQ[K::usage], K::usage = StringJoin[ K::usage, " The use of K to create a complete graph is obsolete. Use CompleteGraph to create a complete graph."]] LabeledTreeToCode::usage = "LabeledTreeToCode[g] reduces the tree g to its Prufer code." Large::usage = "Large is a symbol used to denote the size of the object that represents a vertex. The option VertexStyle can be set to Disk[Large] or Box[Large] either inside the graph data structure or in ShowGraph." LastLexicographicTableau::usage = "LastLexicographicTableau[p] constructs the last Young tableau with shape described by partition p." Level::usage = "Level is an option for the function BreadthFirstTraversal that makes the function return levels of vertices." LeviGraph::usage = "LeviGraph returns the unique (8, 3)-cage, a 3-regular graph whose girth is 8." LexicographicPermutations::usage = "LexicographicPermutations[l] constructs all permutations of list l in lexicographic order." LexicographicSubsets::usage = "LexicographicSubsets[l] gives all subsets of set l in lexicographic order. LexicographicSubsets[n] returns all subsets of {1, 2,..., n} in lexicographic order." LineGraph::usage = "LineGraph[g] constructs the line graph of graph g." ListGraphs::usage = "ListGraphs[n, m] returns all nonisomorphic undirected graphs with n vertices and m edges. ListGraphs[n, m, Directed] returns all nonisomorphic directed graphs with n vertices and m edges. ListGraphs[n] returns all nonisomorphic undirected graphs with n vertices. ListGraphs[n, Directed] returns all nonisomorphic directed graphs with n vertices." ListNecklaces::usage = "ListNecklaces[n, c, Cyclic] returns all distinct necklaces whose beads are colored by colors from c. Here c is a list of n, not necessarily distinct colors, and two colored necklaces are considered equivalent if one can be obtained by rotating the other. ListNecklaces[n, c, Dihedral] is similar except that two necklaces are considered equivalent if one can be obtained from the other by a rotation or a flip." LNorm::usage = "LNorm[p] is a value that the option WeightingFunction, used in the function SetEdgeWeights, can take. Here p can be any integer or Infinity." LongestIncreasingSubsequence::usage = "LongestIncreasingSubsequence[p] finds the longest increasing scattered subsequence of permutation p." LoopPosition::usage = "LoopPosition is an option to ShowGraph whose values tell ShowGraph where to position a loop around a vertex. This option can take on values UpperLeft, UpperRight, LowerLeft, and LowerRight." LowerLeft::usage = "LowerLeft is a value that options VertexNumberPosition, VertexLabelPosition, and EdgeLabelPosition can take on in ShowGraph." LowerRight::usage = "LowerRight is a value that options VertexNumberPosition, VertexLabelPosition, and EdgeLabelPosition can take on in ShowGraph." M::usage = "M[g] gives the number of edges in the graph g. M[g, Directed] is obsolete because M[g] works for directed as well as undirected graphs." MakeDirected::usage = "MakeDirected[g] constructs a directed graph from a given undirected graph g by replacing each undirected edge in g by two directed edges pointing in opposite directions. The local options associated with edges are not inherited by the corresponding directed edges. Calling the function with the tag All, as MakeDirected[g, All], ensures that local options associated with each edge are inherited by both corresponding directed edges." MakeGraph::usage = "MakeGraph[v, f] constructs the graph whose vertices correspond to v and edges between pairs of vertices x and y in v for which the binary relation defined by the Boolean function f is True. MakeGraph takes two options, Type and VertexLabel. Type can be set to Directed or Undirected and this tells MakeGraph whether to construct a directed or an undirected graph. The default setting is Directed. VertexLabel can be set to True or False, with False being the default setting. Using VertexLabel -> True assigns labels derived from v to the vertices of the graph." MakeSimple::usage = "MakeSimple[g] gives the undirected graph, free of multiple edges and self-loops derived from graph g." MakeUndirected::usage = "MakeUndirected[g] gives the underlying undirected graph of the given directed graph g." MaximalMatching::usage = "MaximalMatching[g] gives the list of edges associated with a maximal matching of graph g." MaximumAntichain::usage = "MaximumAntichain[g] gives a largest set of unrelated vertices in partial order g." MaximumClique::usage = "MaximumClique[g] finds a largest clique in graph g. MaximumClique[g, k] returns a k-clique, if such a thing exists in g; otherwise it returns {}." MaximumIndependentSet::usage = "MaximumIndependentSet[g] finds a largest independent set of graph g." MaximumSpanningTree::usage = "MaximumSpanningTree[g] uses Kruskal's algorithm to find a maximum spanning tree of graph g." McGeeGraph::usage = "McGeeGraph returns the unique (7, 3)-cage, a 3-regular graph with girth 7." MeredithGraph::usage = "MeredithGraph returns a 4-regular, 4-connected graph that is not Hamiltonian, providing a counterexample to a conjecture by C. St. J. A. Nash-Williams." MinimumChainPartition::usage = "MinimumChainPartition[g] partitions partial order g into a minimum number of chains." MinimumChangePermutations::usage = "MinimumChangePermutations[l] constructs all permutations of list l such that adjacent permutations differ by only one transposition." MinimumSpanningTree::usage = "MinimumSpanningTree[g] uses Kruskal's algorithm to find a minimum spanning tree of graph g." MinimumVertexColoring::usage = "MinimumVertexColoring[g] returns a minimum vertex coloring of g. MinimumVertexColoring[g, k] returns a k-coloring of g, if one exists." MinimumVertexCover::usage = "MinimumVertexCover[g] finds a minimum vertex cover of graph g. For bipartite graphs, the function uses the polynomial-time Hungarian algorithm. For everything else, the function uses brute force." MultipleEdgesQ::usage = "MultipleEdgesQ[g] yields True if g has multiple edges between pairs of vertices. It yields False otherwise." MultiplicationTable::usage = "MultiplicationTable[l, f] constructs the complete transition table defined by the binary relation function f on the elements of list l." MycielskiGraph::usage = "MycielskiGraph[k] returns a triangle-free graph with chromatic number k, for any positive integer k." NecklacePolynomial::usage = "NecklacePolynomial[n, c, Cyclic] returns a polynomial in the colors in c whose coefficients represent numbers of ways of coloring an n-bead necklace with colors chosen from c, assuming that two colorings are equivalent if one can be obtained from the other by a rotation. NecklacePolynomial[n, c, Dihedral] is different in that it considers two colorings equivalent if one can be obtained from the other by a rotation or a flip or both." Neighborhood::usage = "Neighborhood[g, v, k] returns the subset of vertices in g that are at a distance of k or less from vertex v. Neighborhood[al, v, k] behaves identically, except that it takes as input an adjacency list al." NetworkFlow::usage = "NetworkFlow[g, source, sink] returns the value of a maximum flow through graph g from source to sink. NetworkFlow[g, source, sink, Edge] returns the edges in g that have positive flow along with their flows in a maximum flow from source to sink. NetworkFlow[g, source, sink, Cut] returns a minimum cut between source and sink. NetworkFlow[g, source, sink, All] returns the adjacency list of g along with flows on each edge in a maximum flow from source to sink. g can be a directed or an undirected graph." NetworkFlowEdges::usage = "NetworkFlowEdges[g, source, sink] returns the edges of the graph with positive flow, showing the distribution of a maximum flow from source to sink in graph g. This is obsolete, and NetworkFlow[g, source, sink, Edge] should be used instead." NextBinarySubset::usage = "NextBinarySubset[l, s] constructs the subset of l following subset s in the order obtained by interpreting subsets as binary string representations of integers." NextComposition::usage = "NextComposition[l] constructs the integer composition that follows l in a canonical order." NextGrayCodeSubset::usage = "NextGrayCodeSubset[l, s] constructs the successor of s in the Gray code of set l." NextKSubset::usage = "NextKSubset[l, s] gives the k-subset of list l, following the k-subset s in lexicographic order." NextLexicographicSubset::usage = "NextLexicographicSubset[l, s] gives the lexicographic successor of subset s of set l." NextPartition::usage = "NextPartition[p] gives the integer partition following p in reverse lexicographic order." NextPermutation::usage = "NextPermutation[p] gives the permutation following p in lexicographic order." NextSubset::usage = "NextSubset[l, s] constructs the subset of l following subset s in canonical order." NextTableau::usage = "NextTableau[t] gives the tableau of shape t, following t in lexicographic order." NoMultipleEdges::usage = "NoMultipleEdges is an option value for Type." NonLineGraphs::usage = "NonLineGraphs returns a graph whose connected components are the 9 graphs whose presence as a vertex-induced subgraph in a graph g makes g a nonline graph." NoPerfectMatchingGraph::usage = "NoPerfectMatchingGraph returns a connected graph with 16 vertices that contains no perfect matching." Normal::usage = "Normal is a value that options VertexStyle, EdgeStyle, and PlotRange can take on in ShowGraph." NormalDashed::usage = "NormalDashed is a value that the option EdgeStyle can take on in the graph data structure or in ShowGraph." NormalizeVertices::usage = "NormalizeVertices[v] gives a list of vertices with a similar embedding as v but with all coordinates of all points scaled to be between 0 and 1." NoSelfLoops::usage = "NoSelfLoops is an option value for Type." NthPair::usage = "NthPair[n] returns the nth unordered pair of distinct positive integers, when sequenced to minimize the size of the larger integer. Pairs that have the same larger integer are sequenced in increasing order of their smaller integer." NthPermutation::usage = "NthPermutation[n, l] gives the nth lexicographic permutation of list l. This function is obsolete; use UnrankPermutation instead." NthSubset::usage = "NthSubset[n, l] gives the nth subset of list l in canonical order." NumberOf2Paths::usage = "NumberOf2Paths[g, v] returns a sorted list that contains the number of paths of length 2 to different vertices of g from v." NumberOfCompositions::usage = "NumberOfCompositions[n, k] counts the number of distinct compositions of integer n into k parts." NumberOfDerangements::usage = "NumberOfDerangements[n] counts the derangements on n elements, that is, the permutations without any fixed points." NumberOfDirectedGraphs::usage = "NumberOfDirectedGraphs[n] returns the number of nonisomorphic directed graphs with n vertices. NumberOfDirectedGraphs[n, m] returns the number of nonisomorphic directed graphs with n vertices and m edges." NumberOfGraphs::usage = "NumberOfGraphs[n] returns the number of nonisomorphic undirected graphs with n vertices. NumberOfGraphs[n, m] returns the number of nonisomorphic undirected graphs with n vertices and m edges." NumberOfInvolutions::usage = "NumberOfInvolutions[n] counts the number of involutions on n elements." NumberOfKPaths::usage = "NumberOfKPaths[g, v, k] returns a sorted list that contains the number of paths of length k to different vertices of g from v. NumberOfKPaths[al, v, k] behaves identically, except that it takes an adjacency list al as input." NumberOfNecklaces::usage = "NumberOfNecklaces[n, nc, Cyclic] returns the number of distinct ways in which an n-bead necklace can be colored with nc colors, assuming that two colorings are equivalent if one can be obtained from the other by a rotation. NumberOfNecklaces[n, nc, Dihedral] returns the number of distinct ways in which an n-bead necklace can be colored with nc colors, assuming that two colorings are equivalent if one can be obtained from the other by a rotation or a flip." NumberOfPartitions::usage = "NumberOfPartitions[n] counts the number of integer partitions of n." NumberOfPermutationsByCycles::usage = "NumberOfPermutationsByCycles[n, m] gives the number of permutations of length n with exactly m cycles." NumberOfPermutationsByInversions::usage = "NumberOfPermutationsByInversions[n, k] gives the number of permutations of length n with exactly k inversions. NumberOfPermutationsByInversions[n] gives a table of the number of length-n permutations with k inversions, for all k." NumberOfPermutationsByType::usage = "NumberOfPermutationsByTypes[l] gives the number of permutations of type l." NumberOfSpanningTrees::usage = "NumberOfSpanningTrees[g] gives the number of labeled spanning trees of graph g." NumberOfTableaux::usage = "NumberOfTableaux[p] uses the hook length formula to count the number of Young tableaux with shape defined by partition p." OctahedralGraph::usage = "OctahedralGraph returns the graph corresponding to the octahedron, a Platonic solid." OddGraph::usage = "OddGraph[n] returns the graph whose vertices are the size-(n-1) subsets of a size-(2n-1) set and whose edges connect pairs of vertices that correspond to disjoint subsets. OddGraph[3] is the Petersen graph." One::usage = "One is a tag used in several functions to inform the functions that only one object need be considered or only one solution be produced, as opposed to all objects or all solutions." Optimum::usage = "Optimum is a value that the option Algorithm can take on when used in functions VertexColoring and VertexCover." OrbitInventory::usage = "OrbitInventory[ci, x, w] returns the value of the cycle index ci when each formal variable x[i] is replaced by w. OrbitInventory[ci, x, weights] returns the inventory of orbits induced on a set of functions by the action of a group with cycle index ci. It is assumed that each element in the range of the functions is assigned a weight in list weights." OrbitRepresentatives::usage = "OrbitRepresentatives[pg, x] returns a representative of each orbit of x induced by the action of the group pg on x. pg is assumed to be a set of permutations on the first n natural numbers and x is a set of functions whose domain is the first n natural numbers. Each function in x is specified as an n-tuple." Orbits::usage = "Orbits[pg, x] returns the orbits of x induced by the action of the group pg on x. pg is assumed to be a set of permutations on the first n natural numbers and x is a set of functions whose domain is the first n natural numbers. Each function in x is specified as an n-tuple." Ordered::usage = "Ordered is an option to the functions KSubsetGroup and KSubsetGroupIndex that tells the functions whether they should treat the input as sets or tuples." OrientGraph::usage = "OrientGraph[g] assigns a direction to each edge of a bridgeless, undirected graph g, so that the graph is strongly connected." OutDegree::usage = "OutDegree[g, n] returns the out-degree of vertex n in directed graph g. OutDegree[g] returns the sequence of out-degrees of the vertices in directed graph g." PairGroup::usage = "PairGroup[g] returns the group induced on 2-sets by the permutation group g. PairGroup[g, Ordered] returns the group induced on ordered pairs with distinct elements by the permutation group g." PairGroupIndex::usage = "PairGroupIndex[g, x] returns the cycle index of the pair group induced by g as a polynomial in x[1], x[2], .... PairGroupIndex[ci, x] takes the cycle index ci of a group g with formal variables x[1], x[2], ..., and returns the cycle index of the pair group induced by g. PairGroupIndex[g, x, Ordered] returns the cycle index of the ordered pair group induced by g as a polynomial in x[1], x[2], .... PairGroupIndex[ci, x, Ordered] takes the cycle index ci of a group g with formal variables x[1], x[2], ..., and returns the cycle index of the ordered pair group induced by g." Parent::usage = "Parent is a tag used as an argument to the function AllPairsShortestPath in order to inform this function that information about parents in the shortest paths is also wanted." ParentsToPaths::usage = "ParentsToPaths[l, i, j] takes a list of parents l and returns the path from i to j encoded in the parent list. ParentsToPaths[l, i] returns the paths from i to all vertices." PartialOrderQ::usage = "PartialOrderQ[g] yields True if the binary relation defined by edges of the graph g is a partial order, meaning it is transitive, reflexive, and antisymmetric. PartialOrderQ[r] yields True if the binary relation defined by the square matrix r is a partial order." PartitionLattice::usage = "PartitionLattice[n] returns a Hasse diagram of the partially ordered set on set partitions of 1 through n in which p < q if q is finer than p, that is, each block in q is contained in some block in p. The function takes two options: Type and VertexLabel, with default values Undirected and False, respectively. When Type is set to Directed, the function produces the underlying directed acyclic graph. When VertexLabel is set to True, labels are produced for the vertices." PartitionQ::usage = "PartitionQ[p] yields True if p is an integer partition. PartitionQ[n, p] yields True if p is a partition of n." Partitions::usage = "Partitions[n] constructs all partitions of integer n in reverse lexicographic order. Partitions[n, k] constructs all partitions of the integer n with maximum part at most k, in reverse lexicographic order." If[$VersionNumber < 4, Path::usage=" "]; $NewMessage[Path, "usage"] (* reset the usage of Path to the system usage *) If[StringQ[Path::usage], Path::usage = StringJoin[Path::usage, " Path[n] constructs a tree consisting only of a path on n vertices. Path[n] permits an option Type that takes on the values Directed and Undirected. The default setting is Type -> Undirected."]] PathConditionGraph::usage = "The usage of PathConditionGraph is obsolete. This functionality is no longer supported in Combinatorica." PerfectQ::usage = "PerfectQ[g] yields True if g is a perfect graph, meaning that for every induced subgraph of g the size of a largest clique equals the chromatic number." PermutationGraph::usage = "PermutationGraph[p] gives the permutation graph for the permutation p." PermutationGroupQ::usage = "PermutationGroupQ[l] yields True if the list of permutations l forms a permutation group." PermutationQ::usage = "PermutationQ[p] yields True if p is a list representing a permutation and False otherwise." PermutationToTableaux::usage = "PermutationToTableaux[p] returns the tableaux pair that can be constructed from p using the Robinson-Schensted-Knuth correspondence." PermutationType::usage = "PermutationType[p] returns the type of permutation p." PermutationWithCycle::usage = "PermutationWithCycle[n, {i, j, ...}] gives a size-n permutation in which {i, j, ...} is a cycle and all other elements are fixed points." Permute::usage = "Permute[l, p] permutes list l according to permutation p." PermuteSubgraph::usage = "PermuteSubgraph[g, p] permutes the vertices of a subgraph of g induced by p according to p." PetersenGraph::usage = "PetersenGraph returns the Petersen graph, a graph whose vertices can be viewed as the size-2 subsets of a size-5 set with edges connecting disjoint subsets." PlanarQ::usage = "PlanarQ[g] yields True if graph g is planar, meaning it can be drawn in the plane so no two edges cross." PointsAndLines::usage = "PointsAndLines is now obsolete." Polya::usage = "Polya[g, m] returns the polynomial giving the number of colorings, with m colors, of a structure defined by the permutation group g. Polya is obsolete; use OrbitInventory instead." PseudographQ::usage = "PseudographQ[g] yields True if graph g is a pseudograph, meaning it contains self-loops." RadialEmbedding::usage = "RadialEmbedding[g, v] constructs a radial embedding of the graph g in which vertices are placed on concentric circles around v depending on their distance from v. RadialEmbedding[g] constructs a radial embedding of graph g, radiating from the center of the graph." Radius::usage = "Radius[g] gives the radius of graph g, the minimum eccentricity of any vertex of g." RandomComposition::usage = "RandomComposition[n, k] constructs a random composition of integer n into k parts." RandomGraph::usage = "RandomGraph[n, p] constructs a random labeled graph on n vertices with an edge probability of p. An option Type is provided, which can take on values Directed and Undirected, and whose default value is Undirected. Type->Directed produces a corresponding random directed graph. The usages Random[n, p, Directed], Random[n, p, range], and Random[n, p, range, Directed] are all obsolete. Use SetEdgeWeights to set random edge weights." RandomHeap::usage = "RandomHeap[n] constructs a random heap on n elements." RandomInteger::usage = "RandomInteger is a value that the WeightingFunction option of the function SetEdgeWeights can take." RandomKSetPartition::usage = "RandomKSetPartition[set, k] returns a random set partition of set with k blocks. RandomKSetPartition[n, k] returns a random set partition of the first n natural numbers into k blocks." RandomKSubset::usage = "RandomKSubset[l, k] gives a random subset of set l with exactly k elements." RandomPartition::usage = "RandomPartition[n] constructs a random partition of integer n." RandomPermutation::usage = "RandomPermutation[n] generates a random permutation of the first n natural numbers." RandomPermutation1::usage = "RandomPermutation1 is now obsolete. Use RandomPermutation instead." RandomPermutation2::usage = "RandomPermutation2 is now obsolete. Use RandomPermutation instead." RandomRGF::usage = "RandomRGF[n] returns a random restricted growth function (RGF) defined on the first n natural numbers. RandomRGF[n, k] returns a random RGF defined on the first n natural numbers having maximum element equal to k." RandomSetPartition::usage = "RandomSetPartition[set] returns a random set partition of set. RandomSetPartition[n] returns a random set partition of the first n natural numbers." RandomSubset::usage = "RandomSubset[l] creates a random subset of set l." RandomTableau::usage = "RandomTableau[p] constructs a random Young tableau of shape p." RandomTree::usage = "RandomTree[n] constructs a random labeled tree on n vertices." RandomVertices::usage = "RandomVertices[g] assigns a random embedding to graph g." RankBinarySubset::usage = "RankBinarySubset[l, s] gives the rank of subset s of set l in the ordering of subsets of l, obtained by interpreting these subsets as binary string representations of integers." RankedEmbedding::usage = "RankedEmbedding[l] takes a set partition l of vertices {1, 2,..., n} and returns an embedding of the vertices in the plane such that the vertices in each block occur on a vertical line with block 1 vertices on the leftmost line, block 2 vertices in the next line, and so on. RankedEmbedding[g, l] takes a graph g and a set partition l of the vertices of g and returns the graph g with vertices embedded according to RankedEmbedding[l]. RankedEmbedding[g, s] takes a graph g and a set s of vertices of g and returns a ranked embedding of g in which vertices in s are in block 1, vertices at distance 1 from any vertex in block 1 are in block 2, and so on." RankGraph::usage = "RankGraph[g, l] partitions the vertices into classes based on the shortest geodesic distance to a member of list l." RankGrayCodeSubset::usage = "RankGrayCodeSubset[l, s] gives the rank of subset s of set l in the Gray code ordering of the subsets of l." RankKSetPartition::usage = "RankKSetPartition[sp, s] ranks sp in the list of all k-block set partitions of s. RankSetPartition[sp] ranks sp in the list of all k-block set partitions of the set of elements that appear in any subset in sp." RankKSubset::usage = "RankKSubset[s, l] gives the rank of k-subset s of set l in the lexicographic ordering of the k-subsets of l." RankPermutation::usage = "RankPermutation[p] gives the rank of permutation p in lexicographic order." RankRGF::usage = "RankRGF[f] returns the rank of a restricted growth function (RGF) f in the lexicographic order of all RGFs." RankSetPartition::usage = "RankSetPartition[sp, s] ranks sp in the list of all set partitions of set s. RankSetPartition[sp] ranks sp in the list of all set partitions of the set of elements that appear in any subset in sp." RankSubset::usage = "RankSubset[l, s] gives the rank, in canonical order, of subset s of set l." ReadGraph::usage = "ReadGraph[f] reads a graph represented as edge lists from file f and returns a graph object." RealizeDegreeSequence::usage = "RealizeDegreeSequence[s] constructs a semirandom graph with degree sequence s." ReflexiveQ::usage = "ReflexiveQ[g] yields True if the adjacency matrix of g represents a reflexive binary relation." RegularGraph::usage = "RegularGraph[k, n] constructs a semirandom k-regular graph on n vertices, if such a graph exists." RegularQ::usage = "RegularQ[g] yields True if g is a regular graph." RemoveMultipleEdges::usage = "RemoveMultipleEdges[g] returns the graph obtained by deleting multiple edges from g." RemoveSelfLoops::usage = "RemoveSelfLoops[g] returns the graph obtained by deleting self-loops in g." ResidualFlowGraph::usage = "ResidualFlowGraph[g, flow] returns the directed residual flow graph for graph g with respect to flow." RevealCycles::usage = "RevealCycles[p] unveils the canonical hidden cycle structure of permutation p." ReverseEdges::usage = "ReverseEdges[g] flips the directions of all edges in a directed graph." RGFQ::usage = "RGFQ[l] yields True if l is a restricted growth function. It yields False otherwise." RGFs::usage = "RGFs[n] lists all restricted growth functions on the first n natural numbers in lexicographic order." RGFToSetPartition::usage = "RGFToSetPartition[rgf, set] converts the restricted growth function rgf into the corresponding set partition of set. If the optional second argument, set, is not supplied, then rgf is converted into a set partition of {1, 2, ..., Length[rgf]}." RobertsonGraph::usage = "RobertsonGraph returns a 19-vertex graph that is the unique (4, 5)-cage graph." RootedEmbedding::usage = "RootedEmbedding[g, v] constructs a rooted embedding of graph g with vertex v as the root. RootedEmbedding[g] constructs a rooted embedding with a center of g as the root." RotateVertices::usage = "RotateVertices[v, theta] rotates each vertex position in list v by theta radians about the origin (0, 0). RotateVertices[g, theta] rotates the embedding of the graph g by theta radians about the origin (0, 0)." Runs::usage = "Runs[p] partitions p into contiguous increasing subsequences." SamenessRelation::usage = "SamenessRelation[l] constructs a binary relation from a list l of permutations, which is an equivalence relation if l is a permutation group." SelectionSort::usage = "SelectionSort[l, f] sorts list l using ordering function f." SelfComplementaryQ::usage = "SelfComplementaryQ[g] yields True if graph g is self-complementary, meaning it is isomorphic to its complement." SelfLoopsQ::usage = "SelfLoopsQ[g] yields True if graph g has self-loops." SetEdgeLabels::usage = "SetEdgeLabels[g, l] assigns the labels in l to edges of g. If l is shorter than the number of edges in g, then labels get assigned cyclically. If l is longer than the number of edges in g, then the extra labels are ignored." SetEdgeWeights::usage = "SetEdgeWeights[g] assigns random real weights in the range [0, 1] to edges in g. SetEdgeWeights accepts options WeightingFunction and WeightRange. WeightingFunction can take values Random, RandomInteger, Euclidean, or LNorm[n] for nonnegative n, or any pure function that takes two arguments, each argument having the form {Integer, {Number, Number}}. WeightRange can be an integer range or a real range. The default value for WeightingFunction is Random and the default value for WeightRange is [0, 1]. SetEdgeWeights[g, e] assigns edge weights to the edges in the edge list e. SetEdgeWeights[g, w] assigns the weights in the weight list w to the edges of g. SetEdgeWeights[g, e, w] assigns the weights in the weight list w to the edges in edge list e." SetGraphOptions::usage = "SetGraphOptions[g, opts] returns g with the options opts set. SetGraphOptions[g, {v1, v2, ..., vopts}, gopts] returns the graph with the options vopts set for vertices v1, v2, ... and the options gopts set for the graph g. SetGraphOptions[g, {e1, e2,..., eopts}, gopts], with edges e1, e2,..., works similarly. SetGraphOptions[g, {{elements1, opts1}, {elements2, opts2},...}, opts] returns g with the options opts1 set for the elements in the sequence elements1, the options opts2 set for the elements in the sequence elements2, and so on. Here, elements can be a sequence of edges or a sequence of vertices. A tag that takes on values One or All can also be passed in as an argument before any options. The default value of the tag is All and it is useful if the graph has multiple edges. It informs the function about whether all edges that connect a pair of vertices are to be affected or only one edge is affected." SetPartitionListViaRGF::usage = "SetPartitionListViaRGF[n] lists all set partitions of the first n natural numbers, by first listing all restricted growth functions (RGFs) on these and then mapping the RGFs to corresponding set partitions. SetPartitionListViaRGF[n, k] lists all RGFs on the first n natural numbers whose maximum element is k and then maps these RGFs into the corresponding set partitions, all of which contain exactly k blocks." SetPartitionQ::usage = "SetPartitionQ[sp, s] determines if sp is a set partition of set s. SetPartitionQ[sp] tests if sp is a set of disjoint sets." SetPartitions::usage = "SetPartitions[set] returns the list of set partitions of set. SetPartitions[n] returns the list of set partitions of {1, 2, ..., n}. If all set partitions with a fixed number of subsets are needed use KSetPartitions." SetPartitionToRGF::usage = "SetPartitionToRGF[sp, set] converts the set partition sp of set into the corresponding restricted growth function. If the optional argument set is not specified, then it is assumed that Mathematica knows the underlying order on the set for which sp is a set partition." SetVertexLabels::usage = "SetVertexLabels[g, l] assigns the labels in l to vertices of g. If l is shorter than the number of vertices in g, then labels get assigned cyclically. If l is longer than the number of vertices in g, then the extra labels are ignored." SetVertexWeights::usage = "SetVertexWeights[g] assigns random real weights in the range [0, 1] to vertices in g. SetVertexWeights accepts options WeightingFunction and WeightRange. WeightingFunction can take values Random, RandomInteger, or any pure function that takes two arguments, an integer as the first argument and a pair {number, number} as the second argument. WeightRange can be an integer range or a real range. The default value for WeightingFunction is Random and the default value for WeightRange is [0, 1]. SetVertexWeights[g, w] assigns the weights in the weight list w to the vertices of g. SetVertexWeights[g, vs, w] assigns the weights in the weight list w to the vertices in the vertex list vs." ShakeGraph::usage = "ShakeGraph[g, d] performs a random perturbation of the vertices of graph g, with each vertex moving, at most, a distance d from its original position." ShortestPath::usage = "ShortestPath[g, start, end] finds a shortest path between vertices start and end in graph g. An option Algorithm that takes on the values Automatic, Dijkstra, or BellmanFord is provided. This allows a choice between using Dijkstra's algorithm and the Bellman-Ford algorithm. The default is Algorithm -> Automatic. In this case, depending on whether edges have negative weights and depending on the density of the graph, the algorithm chooses between Bellman-Ford and Dijkstra." ShortestPathSpanningTree::usage = "ShortestPathSpanningTree[g, v] constructs a shortest-path spanning tree rooted at v, so that a shortest path in graph g from v to any other vertex is a path in the tree. An option Algorithm that takes on the values Automatic, Dijkstra, or BellmanFord is provided. This allows a choice between Dijkstra's algorithm and the Bellman-Ford algorithm. The default is Algorithm -> Automatic. In this case, depending on whether edges have negative weights and depending on the density of the graph, the algorithm chooses between Bellman-Ford and Dijkstra." ShowGraph::usage = "ShowGraph[g] displays the graph g. ShowGraph[g, options] modifies the display using the given options. ShowGraph[g, Directed] is obsolete and it is currently identical to ShowGraph[g]. All options that affect the look of a graph can be specified as options in ShowGraph. The list of options is: VertexColor, VertexStyle, VertexNumber, VertexNumberColor, VertexNumberPosition, VertexLabel, VertexLabelColor, VertexLabelPosition, EdgeColor, EdgeStyle, EdgeLabel, EdgeLabelColor, EdgeLabelPosition, LoopPosition, and EdgeDirection. In addition, options of the Mathematica function Plot and options of the graphics primitive Arrow can also be specified here. If an option specified in ShowGraph differ from options explicitly set within a graph object, then options specified inside the graph object are used." ShowGraphArray::usage = "ShowGraphArray[{g1, g2, ...}] displays a row of graphs. ShowGraphArray[{ {g1, ...}, {g2, ...}, ...}] displays a two-dimensional table of graphs. ShowGraphArray accepts all the options accepted by ShowGraph, and the user can also provide the option GraphicsSpacing -> d." ShowLabeledGraph::usage = "ShowLabeledGraph[g] displays graph g according to its embedding, with each vertex labeled with its vertex number. ShowLabeledGraph[g, l] uses the ith element of list l as the label for vertex i." ShuffleExchangeGraph::usage = "ShuffleExchangeGraph[n] returns the n-dimensional shuffle-exchange graph whose vertices are length n binary strings with an edge from w to w' if (i) w' differs from w in its last bit or (ii) w' is obtained from w by a cyclic shift left or a cyclic shift right. An option VertexLabel is provided, with default setting False, which can be set to True, if the user wants to associate the binary strings to the vertices as labels." SignaturePermutation::usage = "SignaturePermutation[p] gives the signature of permutation p." Simple::usage = "Simple is an option value for Type." SimpleQ::usage = "SimpleQ[g] yields True if g is a simple graph, meaning it has no multiple edges and contains no self-loops." Small::usage = "Small is a symbol used to denote the size of the object that represents a vertex. The option VertexStyle can be set to Disk[Small] or Box[Small] either inside the graph data structure or in ShowGraph." SmallestCyclicGroupGraph::usage = "SmallestCyclicGroupGraph returns a smallest nontrivia al graph whose automorphism group is cyclic." Spectrum::usage = "Spectrum[g] gives the eigenvalues of graph g." SpringEmbedding::usage = "SpringEmbedding[g] beautifies the embedding of graph g by modeling the embedding as a system of springs. SpringEmbedding[g, step, increment] can be used to refine the algorithm. The value of step tells the function for how many iterations to run the algorithm. The value of increment tells the function the distance to move the vertices at each step. The default values are 10 and 0.15 for step and increment, respectively." StableMarriage::usage = "StableMarriage[mpref, fpref] finds the male optimal stable marriage defined by lists of permutations describing male and female preferences." Star::usage = "Star[n] constructs a star on n vertices, which is a tree with one vertex of degree n-1." StirlingFirst::usage = "StirlingFirst[n, k] returns a Stirling number of the first kind. This is obsolete. Use the built-in Mathematica function StirlingS1 instead." StirlingSecond::usage = "StirlingSecond[n, k] returns a Stirling number of the second kind." Strings::usage = "Strings[l, n] constructs all possible strings of length n from the elements of list l." StronglyConnectedComponents::usage = "StronglyConnectedComponents[g] gives the strongly connected components of directed graph g as lists of vertices." Strong::usage = "Strong is an option to ConnectedQ that seeks to determine if a directed graph is strongly connected." Subsets::usage = "Subsets[l] gives all subsets of set l." SymmetricGroup::usage = "SymmetricGroup[n] returns the symmetric group on n symbols." SymmetricGroupIndex::usage = "SymmetricGroupIndex[n, x] returns the cycle index of the symmetric group on n symbols, expressed as a polynomial in x[1], x[2], ..., x[n]." SymmetricQ::usage = "SymmetricQ[r] tests if a given square matrix r represents a symmetric relation. SymmetricQ[g] tests if the edges of a given graph represent a symmetric relation." TableauClasses::usage = "TableauClasses[p] partitions the elements of permutation p into classes according to their initial columns during Young tableaux construction." TableauQ::usage = "TableauQ[t] yields True if and only if t represents a Young tableau." Tableaux::usage = "Tableaux[p] constructs all tableaux having a shape given by integer partition p." TableauxToPermutation::usage = "TableauxToPermutation[t1, t2] constructs the unique permutation associated with Young tableaux t1 and t2, where both tableaux have the same shape." TetrahedralGraph::usage = "TetrahedralGraph returns the graph corresponding to the the Tetrahedron, a Platonic solid." Thick::usage = "Thick is a value that the option EdgeStyle can take on in the graph data structure or in ShowGraph." ThickDashed::usage = "ThickDashed is a value that the option EdgeStyle can take on in the graph data structure or in ShowGraph." Thin::usage = "Thin is a value that the option EdgeStyle can take on in the graph data structure or in ShowGraph." ThinDashed::usage = "ThinDashed is a value that the option EdgeStyle can take on in the graph data structure or in ShowGraph." ThomassenGraph::usage = "ThomassenGraph returns a hypotraceable graph, a graph G that has no Hamiltonian path but whose subgraph G-v for every vertex v has a Hamiltonian path." ToAdjacencyLists::usage = "ToAdjacencyLists[g] constructs an adjacency list representation for graph g. It allows an option called Type that takes on values All or Simple. Type -> All is the default setting of the option, and this permits self-loops and multiple edges to be reported in the adjacency lists. Type -> Simple deletes self-loops and multiple edges from the constructed adjacency lists. ToAdjacencyLists[g, EdgeWeight] returns an adjacency list representation along with edge weights." ToAdjacencyMatrix::usage = "ToAdjacencyMatrix[g] constructs an adjacency matrix representation for graph g. An option Type that takes on values All or Simple can be used to affect the matrix constructed. Type -> All is the default, and Type -> Simple ignores any self-loops or multiple edges g may have. ToAdjacencyMatrix[g, EdgeWeight] returns edge weights as entries of the adjacency matrix with Infinity representing missing edges." ToCanonicalSetPartition::usage = "ToCanonicalSetPartition[sp, set] reorders sp into a canonical order with respect to set. In the canonical order, the elements of each subset of the set partition are ordered as they appear in set, and the subsets themselves are ordered by their first elements. ToCanonicalSetPartition[sp] reorders sp into canonical order, assuming that Mathematica knows the underlying order on the set for which sp is a set partition." ToCycles::usage = "ToCycles[p] gives the cycle structure of permutation p as a list of cyclic permutations." ToInversionVector::usage = "ToInversionVector[p] gives the inversion vector associated with permutation p." ToOrderedPairs::usage = "ToOrderedPairs[g] constructs a list of ordered pairs representing the edges of the graph g. If g is undirected each edge is interpreted as two ordered pairs. An option called Type that takes on values Simple or All can be used to affect the constructed representation. Type -> Simple forces the removal of multiple edges and self-loops. Type -> All keeps all information and is the default option." TopologicalSort::usage = "TopologicalSort[g] gives a permutation of the vertices of directed acyclic graph g such that an edge (i, j) implies that vertex i appears before vertex j." ToUnorderedPairs::usage = "ToUnorderedPairs[g] constructs a list of unordered pairs representing the edges of graph g. Each edge, directed or undirected, results in a pair in which the smaller vertex appears first. An option called Type that takes on values All or Simple can be used, and All is the default value. Type -> Simple ignores multiple edges and self-loops in g." TransitiveClosure::usage = "TransitiveClosure[g] finds the transitive closure of graph g, the supergraph of g that contains edge {x, y} if and only if there is a path from x to y." TransitiveQ::usage = "TransitiveQ[g] yields True if graph g defines a transitive relation." TransitiveReduction::usage = "TransitiveReduction[g] finds a smallest graph that has the same transitive closure as g." TranslateVertices::usage = "TranslateVertices[v, {x, y}] adds the vector {x, y} to the vertex embedding location of each vertex in list v. TranslateVertices[g, {x, y}] translates the embedding of the graph g by the vector {x, y}." TransposePartition::usage = "TransposePartition[p] reflects a partition p of k parts along the main diagonal, creating a partition with maximum part k." TransposeTableau::usage = "TransposeTableau[t] reflects a Young tableau t along the main diagonal, creating a different tableau." TravelingSalesman::usage = "TravelingSalesman[g] finds an optimal traveling salesman tour in graph g." TravelingSalesmanBounds::usage = "TravelingSalesmanBounds[g] gives upper and lower bounds on a minimum cost traveling salesman tour of graph g." Tree::usage = "Tree is an option that informs certain functions for which the user wants the output to be a tree." TreeIsomorphismQ::usage = "TreeIsomorphismQ[t1, t2] yields True if the trees t1 and t2 are isomorphic. It yields False otherwise." TreeQ::usage = "TreeQ[g] yields True if graph g is a tree." TreeToCertificate::usage = "TreeToCertificate[t] returns a binary string that is a certificate for the tree t such that trees have the same certificate if and only if they are isomorphic." TriangleInequalityQ::usage = "TriangleInequalityQ[g] yields True if the weights assigned to the edges of graph g satisfy the triangle inequality." Turan::usage = "Turan[n, p] constructs the Turan graph, the extremal graph on n vertices that does not contain CompleteGraph[p]." TutteGraph::usage = "TutteGraph returns the Tutte graph, the first known example of a 3-connected, 3-regular, planar graph that is non-Hamiltonian." TwoColoring::usage = "TwoColoring[g] finds a two-coloring of graph g if g is bipartite. It returns a list of the labels 1 and 2 corresponding to the vertices. This labeling is a valid coloring if and only the graph is bipartite." Type::usage = "Type is an option for many functions that transform graphs. Depending on the functions it is being used in, it can take on values such as Directed, Undirected, Simple, etc." UndirectedQ::usage = "UndirectedQ[g] yields True if graph g is undirected." Undirected::usage = "Undirected is an option to inform certain functions that the graph is undirected." UnionSet::usage = "UnionSet[a, b, s] merges the sets containing a and b in union-find data structure s." Uniquely3ColorableGraph::usage = "Uniquely3ColorableGraph returns a 12-vertex, triangle-free graph with chromatic number 3 that is uniquely 3-colorable." UnitransitiveGraph::usage = "UnitransitiveGraph returns a 20-vertex, 3-unitransitive graph discovered by Coxeter, that is not isomorphic to a 4-cage or a 5-cage." UnrankBinarySubset::usage = "UnrankBinarySubset[n, l] gives the nth subset of list l, listed in increasing order of integers corresponding to the binary representations of the subsets." UnrankGrayCodeSubset::usage = "UnrankGrayCodeSubset[n, l] gives the nth subset of list l, listed in Gray code order." UnrankKSetPartition::usage = "UnrankSetPartition[r, s, k] finds a k-block set partition of s with rank r. UnrankSetPartition[r, n, k] finds a k-block set partition of {1, 2,..., n} with rank r." UnrankKSubset::usage = "UnrankKSubset[m, k, l] gives the mth k-subset of set l, listed in lexicographic order." UnrankPermutation::usage = "UnrankPermutation[r, l] gives the rth permutation in the lexicographic list of permutations of list l. UnrankPermutation[r, n] gives the rth permutation in the lexicographic list of permutations of {1, 2,..., n}." UnrankRGF::usage = "UnrankRGF[r, n] returns a restricted growth function defined on the first n natural numbers whose rank is r." UnrankSetPartition::usage = "UnrankSetPartition[r, set] finds a set partition of set with rank r. UnrankSetPartition[r, n] finds a set partition of {1, 2, ..., n} with rank r." UnrankSubset::usage = "UnrankSubset[n, l] gives the nth subset of list l, listed in some canonical order." UnweightedQ::usage = "UnweightedQ[g] yields True if all edge weights are 1 and False otherwise." UpperLeft::usage = "UpperLeft is a value that options VertexNumberPosition, VertexLabelPosition, and EdgeLabelPosition can take on in ShowGraph." UpperRight::usage = "UpperRight is a value that options VertexNumberPosition, VertexLabelPosition, and EdgeLabelPosition can take on in ShowGraph." V::usage = "V[g] gives the order or number of vertices of the graph g." Value::usage = "Value is an option for the function NetworkFlow that makes the function return the value of the maximum flow." VertexColor::usage = "VertexColor is an option that allows the user to associate colors with vertices. Black is the default color. VertexColor can be set as part of the graph data structure and it can be used in ShowGraph." VertexColoring::usage = "VertexColoring[g] uses Brelaz's heuristic to find a good, but not necessarily minimal, vertex coloring of graph g. An option Algorithm that can take on the values Brelaz or Optimum is allowed. The setting Algorithm -> Brelaz is the default, while the setting Algorithm -> Optimum forces the algorithm to do an exhaustive search to find an optimum vertex coloring." VertexConnectivity::usage = "VertexConnectivity[g] gives the minimum number of vertices whose deletion from graph g disconnects it. VertexConnectivity[g, Cut] gives a set of vertices of minimum size, whose removal disconnects the graph." VertexConnectivityGraph::usage = "VertexConnectivityGraph[g] returns a directed graph that contains an edge corresponding to each vertex in g and in which edge disjoint paths correspond to vertex disjoint paths in g." VertexCover::usage = "VertexCover[g] returns a vertex cover of the graph g. An option Algorithm that can take on values Greedy, Approximate, or Optimum is allowed. The default setting is Algorithm -> Approximate. Different algorithms are used to compute a vertex cover depending on the setting of the option Algorithm." VertexCoverQ::usage = "VertexCoverQ[g, c] yields True if the vertices in list c define a vertex cover of graph g." VertexLabel::usage = "VertexLabel is an option that can take on values True or False, allowing the user to set and display vertex labels. By default, there are no vertex labels. VertexLabel can be set as part of the graph data structure or in ShowGraph." VertexLabelColor::usage = "VertexLabelColor is an option that allows the user to associate different colors to vertex labels. Black is the default color. VertexLabelColor can be set as part of the graph data structure or in ShowGraph." VertexLabelPosition::usage = "VertexLabelPosition is an option that allows the user to place a vertex label in a certain position relative to the vertex. The default position is upper right. VertexLabelPosition can be set as part of the graph data structure or in ShowGraph." VertexNumber::usage = "VertexNumber is an option that can take on values True or False. This can be used in ShowGraph to display or suppress vertex numbers. By default, the vertex numbers are hidden. VertexNumber can be set as part of the graph data structure or in ShowGraph." VertexNumberColor::usage = "VertexNumberColor is an option that can be used in ShowGraph to associate different colors to vertex numbers. Black is the default color. VertexNumberColor can be set as part of the graph data structure or in ShowGraph." VertexNumberPosition::usage = "VertexNumberPosition is an option that can be used in ShowGraph to display a vertex number in a certain position relative to the vertex. By default, vertex numbers are positioned to the lower left of vertices. VertexNumberPosition can be set as part of the graph data structure or in ShowGraph." VertexStyle::usage = "VertexStyle is an option that allows the user to associate different sizes and shapes to vertices. A disk is the default shape. VertexStyle can be set as part of the graph data structure and it can be used in ShowGraph." VertexWeight::usage = "VertexWeight is an option that allows the user to associate weights with vertices. 0 is the default weight. VertexWeight can be set as part of the graph data structure." Vertices::usage = "Vertices[g] gives the embedding of graph g, that is, the coordinates of each vertex in the plane. Vertices[g, All] gives the embedding of the graph along with graphics options associated with each vertex." WaltherGraph::usage = "WaltherGraph returns the Walther graph." Weak::usage = "Weak is an option to ConnectedQ that seeks to determine if a directed graph is weakly connected." WeaklyConnectedComponents::usage = "WeaklyConnectedComponents[g] gives the weakly connected components of directed graph g as lists of vertices." WeightingFunction::usage = "WeightingFunction is an option to the functions SetEdgeWeights and SetVertexWeights and it tells the functions how to compute edge weights and vertex weights, respectively. The default value for this option is Random." WeightRange::usage = "WeightRange is an option to the functions SetEdgeWeights and SetVertexWeights that gives the range for these weights. The default range is [0, 1] for real as well as integer weights." Wheel::usage = "Wheel[n] constructs a wheel on n vertices, which is the join of CompleteGraph[1] and Cycle[n-1]." WriteGraph::usage = "WriteGraph[g, f] writes graph g to file f using an edge list representation." Zoom::usage = "Zoom[{i, j, k, ...}] is a value that the PlotRange option can take on in ShowGraph. Setting PlotRange to this value zooms the display to contain the specified subset of vertices, i, j, k, ...." Begin["`Private`"] AcyclicQ[g_Graph] := SameQ[FindCycle[g],{}] AddEdge::obsolete = "Usage of Directed as a second argument to AddEdge is obsolete." AddEdge[g_Graph, edge:{_Integer,_Integer}, Directed] := (Message[AddEdge::obsolete]; AddEdges[g, {{edge}}]) AddEdge[g_Graph, edge:{_Integer,_Integer}] := AddEdges[g, {{edge}}] AddEdge[g_Graph, edge:{{_Integer,_Integer}, ___?OptionQ}] := AddEdges[g, {edge}] AddEdges[g_Graph, edgeList:{{{_Integer, _Integer},___?OptionQ}...}] := Module[{ne = If[UndirectedQ[g], Map[Prepend[Rest[#], Sort[First[#]]]&, edgeList], edgeList ] }, ChangeEdges[g, Join[Edges[g, All], ne]] ] AddEdges[g_Graph, edgeList:{{_Integer,_Integer}...}] := AddEdges[g, Map[{#}&, edgeList] ] AddEdges[g_Graph, edge:{_Integer,_Integer}] := AddEdges[g, {edge}] AddToEncroachingLists[k_Integer,{}] := {{k}} AddToEncroachingLists[k_Integer,l_List] := Append[l,{k}] /; (k > First[Last[l]]) && (k < Last[Last[l]]) AddToEncroachingLists[k_Integer,l1_List] := Module[{i,l=l1}, If [k <= First[Last[l]], i = Ceiling[ BinarySearch[l,k,First] ]; PrependTo[l[[i]],k], i = Ceiling[ BinarySearch[l,-k,(-Last[#])&] ]; AppendTo[l[[i]],k] ]; l ] AddVertex[g_Graph] := AddVertices[g, 1] AddVertex[g_Graph, p:{_?NumericQ, _?NumericQ}] := AddVertices[g, {{p}}] AddVertices[g_Graph, n_Integer?Positive] := GraphUnion[g, EmptyGraph[n]] AddVertices[Graph[e_List, v_List, opts___?OptionQ], p:{{{_?NumericQ, _?NumericQ},___?OptionQ}...}] := Graph[e, Join[v, p], opts] AddVertices[g_Graph, p:{{_?NumericQ, _?NumericQ}...}] := AddVertices[g, Map[{#}&, p]] AddVertices[g_Graph, p:{_?NumericQ, _?NumericQ}] := AddVertices[g, {p}] AllPairsShortestPath[g_Graph] := {} /; (V[g] == 0) AllPairsShortestPath[g_Graph] := Module[{p = ToAdjacencyMatrix[g, EdgeWeight, Type->Simple], m}, m = V[g]*Ceiling[Max[Cases[Flatten[p], _Real | _Integer]]]+1; Zap[DP1[p /. {0 -> 0.0, x_Integer -> 1.0 x, Infinity -> m*1.0}, m]] /. m -> Infinity ] DP1 = Compile[{{p, _Real, 2}, {m, _Integer}}, Module[{np = p, k, n = Length[p]}, Do[np = Table[If[(np[[i, k]] == 1.0*m) || (np[[k, j]] == 1.0*m), np[[i,j]], Min[np[[i,k]]+ np[[k,j]], np[[i,j]]] ], {i,n},{j,n} ], {k, n}]; np ] ] AllPairsShortestPath[g_Graph, Parent] := {} /; (V[g] == 0) AllPairsShortestPath[g_Graph, Parent] := Module[{q, p = ToAdjacencyMatrix[g,EdgeWeight,Type->Simple], n=V[g], m}, Do[p[[i, i]] = 0, {i, n}]; m = V[g]*Ceiling[Max[Cases[Flatten[p], _Real | _Integer]]]+1; q = Table[If[(p[[i, j]]===Infinity), j, i], {i, n}, {j, n} ]; p = p /. {x_Integer->1.0 x, Infinity -> m*1.0}; {p, q} = Zap[DP2[p, q, m]]; {p /. m -> Infinity, q} ] DP2 =Compile[{{p, _Real, 2}, {q, _Integer, 2}, {m, _Real}}, Module[{np = p, nq = q, k = 0, n = Length[p]}, Do[ Do[If[(np[[i, k]] != m*1.0) && (np[[k, j]] != m*1.0), np[[i, j]] = Min[np[[i, k]] + np[[k, j]], np[[i, j]]]; If[(np[[i, j]] == np[[i, k]] + np[[k, j]]) && (k != j) && (i != j), nq[[i, j]] = nq[[k, j]] ] ], {i, n}, {j, n} ], {k, n} ]; {np, nq} ] ] AlternatingGroup[l_List] := Select[Permutations[l], (SignaturePermutation[#]===1)&] /; (Length[l] > 0) AlternatingGroup[n_Integer?Positive] := Select[Permutations[n], (SignaturePermutation[#]===1)&] AlternatingGroupIndex[n_Integer?Positive, x_Symbol] := Module[{p, y}, p = SymmetricGroupIndex[n, y]; (p /. Table[y[i] -> x[i], {i, n}]) + (p /. Table[y[i] -> (-1)^(i + 1)x[i], {i, n}]) ] AlternatingPaths[g_Graph, start_List, ME_List] := Module[{MV = Table[0, {V[g]}], e = ToAdjacencyLists[g], lvl = Table[Infinity, {V[g]}], cnt = 1, queue = start, parent = Table[i, {i, V[g]}]}, Scan[(MV[[#[[1]]]] = #[[2]]; MV[[#[[2]]]] = #[[1]]) &, ME]; Scan[(lvl[[#]] = 0) &, start]; While[queue != {}, {v, queue} = {First[queue], Rest[queue]}; If[EvenQ[lvl[[v]]], Scan[(If[lvl[[#]] == Infinity, lvl[[#]] = lvl[[v]] + 1; parent[[#]] = v; AppendTo[queue, #]]) &, e[[v]] ], If[MV[[v]] != 0, u = MV[[v]]; If[lvl[[u]] == Infinity, lvl[[u]] = lvl[[v]] + 1; parent[[u]] = v; AppendTo[queue, u] ] ] ] ]; parent ] AnimateGraph[g_Graph, l_List, flag_Symbol:All, opts___?OptionQ] := Map[ShowGraph, If[flag === One, Table[Highlight[g, {{ l[[ i ]] }}, opts], {i, Length[l]}], Table[Highlight[g, {l[[ Range[i] ]]}, opts], {i, Length[l]}] ] ] AntiSymmetricQ[r_?SquareMatrixQ] := Apply[And, Flatten[Table[r[[i, j]] != r[[j, i]], {i, Length[r]}, {j, i-1}], 1] ] AntiSymmetricQ[g_Graph] := Module[{e = Edges[RemoveSelfLoops[g]]}, Apply[And, Map[!MemberQ[e, Reverse[#]]&, e] ] ] /; !UndirectedQ[g] AntiSymmetricQ[g_Graph] := M[RemoveSelfLoops[g]] == 0 ApproximateVertexCover[g_Graph] := ApproximateVertexCover[g] /; (!SimpleQ[g] || !UndirectedQ[g]) ApproximateVertexCover[g_Graph] := GreedyVertexCover[g, Apply[Join, MaximalMatching[g]]] Arctan[{x_,y_}] := Arctan1[Chop[{x,y}]] Arctan1[{0,0}] := 0 Arctan1[{x_,y_}] := ArcTan[x,y] Arrows[pointPair_, mel_?NumericQ] := Block[{size, triangle}, (*size = Min[0.05, mel/3];*) size = 0.05; triangle={ {0,0}, {-size,size/2}, {-size,-size/2} }; Polygon[TranslateVertices[ RotateVertices[ triangle, Arctan[Apply[Subtract, pointPair]]+Pi ], pointPair[[2]] ] ] ] ArticulationVertices[g_Graph] := Union[Last[FindBiconnectedComponents[g]]]; AugmentFlow[f_List, m_, p_List] := Module[{i, j, pf, pb}, Scan[({i,j} = {#[[1]], #[[2]]}; pf = Position[f[[i]], {j, _}]; pb = Position[f[[j]], {i, _}]; If[(pb != {}) && (f[[j, pb[[1,1]], 2]] >= m), f[[j, pb[[1,1]],2]]-=m, f[[i, pf[[1,1]],2]]+=m ])&, p ] ] AugmentingPath[g_Graph,src_Integer,sink_Integer] := Block[{l={src},lab=Table[0,{V[g]}],v,c=Edges[g,All],e=ToAdjacencyLists[g]}, lab[[src]] = start; While[l != {} && (lab[[sink]]==0), {v,l} = {First[l],Rest[l]}; Scan[ (If[ c[[v,#]] - flow[[v,#]] > 0 && lab[[#]] == 0, lab[[#]] = {v,f}; AppendTo[l,#]])&, e[[v]] ]; Scan[ (If[ flow[[#,v]] > 0 && lab[[#]] == 0, lab[[#]] = {v,b}; AppendTo[l,#]] )&, Select[Range[V[g]],(c[[#,v]] > 0)&] ]; ]; FindPath[lab,src,sink] ] Automorphisms[g_Graph] := Isomorphism[g] BFS[g_Graph, start_Integer] := Module[{e, bfi=Table[0,{V[g]}], cnt=1, queue={start}, parent=Table[i, {i, V[g]}],lvl=Table[Infinity,{V[g]}]}, e = ToAdjacencyLists[g]; bfi[[start]] = cnt++; lvl[[start]]=0; While[ queue != {}, {v,queue} = {First[queue],Rest[queue]}; Scan[(If[bfi[[#]] == 0, bfi[[#]]=cnt++; parent[[#]]=v; lvl[[#]]=lvl[[v]]+1; AppendTo[queue,#] ])&, e[[v]] ]; ]; {bfi, parent, lvl} ] /; (1 <= start) && (start <= V[g]) BFS[g_Graph,s_Integer,t_Integer] := Module[{queue={s}, parent=Table[Infinity, {i, V[g]}], e}, If[s==t, Return[{s}]]; e = ToAdjacencyLists[g]; parent[[s]] = s; While[ queue != {}, {v,queue} = {First[queue],Rest[queue]}; Scan[(If[parent[[#]] == Infinity, parent[[#]] = v; AppendTo[queue,#]; If[# == t, queue={};Return[] ]; ])&, e[[v]] ]; ]; If[parent[[t]] == Infinity, {}, Rest[Reverse[FixedPointList[Function[x, parent[[x]] ], t]]] ] ] /; (1 <= s) && (s <= V[g]) && (1 <= t) && (t <= V[g]) Backtrack[space_List,partialQ_,solutionQ_,flag_:One] := Module[{n=Length[space],all={},done,index, v=2, solution}, index=Prepend[ Table[0,{n-1}],1]; While[v > 0, done = False; While[!done && (index[[v]] < Length[space[[v]]]), index[[v]]++; done = Apply[partialQ,{Solution[space,index,v]}]; ]; If [done, v++, index[[v--]]=0 ]; If [v > n, solution = Solution[space,index,n]; If [Apply[solutionQ,{solution}], If [SameQ[flag,All], AppendTo[all,solution], all = solution; v=0 ] ]; v-- ] ]; all ] BeforeQ[l_List,a_,b_] := If [First[l]==a, True, If [First[l]==b, False, BeforeQ[Rest[l],a,b] ] ] BellB[n_Integer] := BellB1[n] BellB1[0] := 1 BellB1[n_]:= Block[{$RecursionLimit = Infinity}, BellB1[n] = Sum [Binomial[n-1, k]*BellB1[k], {k, 0, n-1}]] BellmanFord[g_Graph, s_Integer?Positive] := Module[{p = Table[i, {i, V[g]}], d = Table[Infinity, {V[g]}]}, d[[s]] = 0; {p, d} ] /; EmptyQ[g] && (s <= V[g]) BF = Compile[{{n, _Integer}, {s, _Integer}, {e1, _Integer, 2}, {w1, _Real, 1}, {e2, _Integer, 2}, {w2, _Real, 1}}, Module[{d, dist, parent = Range[n], m = (Length[e1] + Length[e2])*Max[w1, w2] + 1}, dist = Table[m, {n}]; dist[[s]] = 0; Do[ Do[d = dist[[ e1[[j, 1]] ]] + w1[[j]]; If[dist[[ e1[[j, 2]] ]] > d, dist[[ e1[[j, 2]] ]] = d; parent[[ e1[[j, 2]] ]] = e1[[j, 1]]], {j, Length[e1]} ]; Do[d = dist[[ e2[[j, 1]] ]] + w2[[j]]; If[dist[[ e2[[j, 2]] ]] > d, dist[[ e2[[j, 2]] ]] = d; parent[[ e2[[j, 2]] ]] = e2[[j, 1]]], {j, Length[e2]} ], {i, Ceiling[n/2]} ]; {parent, dist} ] ] BellmanFord[g_Graph, s_Integer?Positive] := Module[{e = Sort[Edges[g, EdgeWeight]], n = V[g], e1 = {}, w1 = {}, e2 = {}, w2 = {}, b}, If[UndirectedQ[g], {e1, w1} = Transpose[e]; {e2, w2} = Transpose[Reverse[Sort[Map[{Reverse[#[[1]]], #[[2]]} &, e]]]]; b = Zap[BF[n, s, e1, 1.0*w1, e2, 1.0*w2]], e1 = Select[e, #[[1, 1]] < #[[1, 2]] &]; e2 = Select[e, #[[1, 1]] > #[[1, 2]] &]; {e1, w1} = If[e1 != {}, Transpose[e1], {{{1, 1}}, {0.0}}]; {e2, w2} = If[e2 != {}, Transpose[e2], {{{1, 1}}, {0.0}}]; b = Zap[BF[n, s, e1, 1.0*w1, e2, 1.0*w2]] ]; {b[[1]], Table[If[(i==b[[1, i]]) && (i != s), Infinity, b[[2, i]]], {i, Length[b[[2]]]} ]} ] /; (s <= V[g]) BiconnectedComponents[g_Graph]:= Map[{#}&, Range[V[g]] ]/; (EmptyQ[g]) BiconnectedComponents[g_Graph] := First[FindBiconnectedComponents[g]] /; UndirectedQ[g] BiconnectedComponents[g_Graph] := First[FindBiconnectedComponents[MakeUndirected[g]]] BiconnectedQ[g_Graph] := (Length[ BiconnectedComponents[g] ] == 1) BinarySearch::error = "The input list is non-numeric." BinarySearch[l_?(Length[#] > 0&), k_?NumericQ, f_:Identity]:= With[{res = binarysearchchore[l, k, f]}, res/; res =!= $Failed ] binarysearchchore[l_, k_, f_]:= Module[{lo = 1, mid, hi = Length[l], el}, While[lo <= hi, If[(el=f[l[[mid = Floor[ (lo + hi)/2 ]]]])===k, Return[mid] ]; If[!NumericQ[el], (Message[BinarySearch::error]; Return[$Failed])]; If[el > k, hi = mid-1, lo = mid+1] ]; Return[lo-1/2] ]; BinarySubsets[l_List] := Map[(l[[Flatten[Position[#, 1], 1]]])&, Strings[{0, 1}, Length[l]]] BinarySubsets[0] := {{}} BinarySubsets[n_Integer?Positive] := BinarySubsets[Range[n]] BipartiteMatching[g_Graph] := Module[{p,v1,v2,coloring=TwoColoring[g],n=V[g],flow}, v1 = Flatten[Position[coloring,1]]; v2 = Flatten[Position[coloring,2]]; p = BipartiteMatchingFlowGraph[MakeSimple[g],v1,v2]; Complement[ Map[Sort[First[#]]&, NetworkFlow[p, n+1, n+2, Edge]], Map[{#,n+1}&, v1], Map[{#,n+2}&, v2] ] ] /; BipartiteQ[g] && UnweightedQ[g] BipartiteMatching[g_Graph] := First[BipartiteMatchingAndCover[g]] /; BipartiteQ[g] BipartiteMatchingAndCover[g_Graph] := Module[{ng = g, MV, UV, u , v, cover, diff, MM, WM, c = TwoColoring[g], OV1, OV2, V1, V2, r, ip, jp, Tbar}, V1=OV1=Flatten[Position[c,1]]; V2=OV2=Flatten[Position[c, 2]]; If[Length[V2] < Length[V1], {OV1, OV2} = {V1, V2} = {OV2, OV1}; ng = AddVertices[g, Length[V2]-Length[V1]]; V1 = Join[V1, Range[Length[V1]+Length[V2]+1, 2 Length[V2]]] ]; MM = ToAdjacencyMatrix[ng, EdgeWeight]; WM = Table[MM[[ V1[[i]], V2[[j]]]], {i, Length[V1]}, {j, Length[V2]}] /. Infinity -> 0; u = Table[Max[WM[[i]]], {i, Length[V1]}]; v = Table[0, {Length[V2]}]; While[True, cover = Table[u[[i]] + v[[j]], {i, Length[V1]}, {j, Length[V2]}]; ng = ChangeEdges[ng, Map[Sort[{V1[[#[[1]]]], V2[[#[[2]]]]}]&, Position[diff = cover - WM, 0]]]; currentMatching = BipartiteMatching[ng]; If[Length[currentMatching]==Length[V1], Return[{Intersection[currentMatching, Edges[g]], Transpose[ Sort[Join[Transpose[{OV1, u[[Range[Length[OV1]]]]}], Transpose[{OV2, v}] ] ] ][[2]]} ] ]; MV = Apply[Union, currentMatching]; U = Complement[V1, MV]; r = ReachableVertices[ng, U, currentMatching]; S = Complement[r, V2]; T = Complement[r, V1]; Tbar = Complement[V2, T]; epsilon = Min[Table[ip = Position[V1, S[[i]]][[1, 1]]; jp = Position[V2, Tbar[[j]]][[1, 1]]; diff[[ip, jp]], {i, Length[S]}, {j, Length[Tbar]} ] ]; Do[ip=Position[V1, S[[i]]][[1, 1]]; u[[ip]]=u[[ip]]-epsilon, {i, Length[S]} ]; Do[jp = Position[V2, T[[j]]][[1, 1]]; v[[jp]] = v[[jp]]+epsilon, {j, Length[T]}] ] ] BipartiteMatchingFlowGraph[g_Graph, v1_List, v2_List] := Module[{n = V[g], ng}, ng = ChangeEdges[ SetGraphOptions[g, EdgeDirection -> True], Map[If[MemberQ[v1, #[[1]]], #, Reverse[#]] &, Edges[g]] ]; AddEdges[AddVertices[ng, 2], Join[Map[{{n + 1, #}} &, v1], Map[{{#, n + 2}} &, v2]] ] ] BipartiteQ[g_Graph] := Module[{c = TwoColoring[g]}, Apply[And, Map[c[[ #[[1]] ]] != c[[ #[[2]] ]]&, Edges[g]]]] Options[BooleanAlgebra] = {Type -> Undirected, VertexLabel->False} BooleanAlgebra[n_Integer?Positive, opts___?OptionQ]:= Module[{type, label, s = Subsets[n], br}, {type, label} = {Type, VertexLabel} /. Flatten[{opts, Options[BooleanAlgebra]}]; br = ((Intersection[#2,#1]===#1)&&(#1!=#2))&; If[type === Directed, MakeGraph[s, br, VertexLabel->label], HasseDiagram[MakeGraph[s, br, VertexLabel->label]] ] ] BreadthFirstTraversal[g_Graph, s_Integer?Positive] := First[BFS[g,s]] /; (s <= V[g]) BreadthFirstTraversal[g_Graph, s_Integer?Positive, t_Integer?Positive] := BFS[g,s,t] /; (s <= V[g]) && (t <= V[g]) BreadthFirstTraversal[g_Graph, s_Integer?Positive, Edge] := Module[{b = BFS[g,s], v, p}, v = InversePermutation[Cases[b[[1]], _?Positive]]; p = b[[2]]; Table[{p[[ v[[i]] ]], v[[i]]}, {i, 2, Length[v]}] ] /; (s <= V[g]) BreadthFirstTraversal[g_Graph, s_Integer?Positive, Tree] := Module[{p = BFS[g,s][[2]]}, ChangeEdges[ g, Flatten[ Table[If[i!=p[[i]], {{{p[[i]],i}}}, {}], {i, Length[p]} ], 1 ] ] ] /; (s <= V[g]) BreadthFirstTraversal[g_Graph, s_Integer?Positive, Level] := Last[BFS[g,s]] /; (s <= V[g]) BrelazColoring[g_Graph] := BrelazColoring[MakeSimple[g]] /; !UndirectedQ[g] BrelazColoring[g_Graph] := {} /; (V[g] == 0) BrelazColoring[g_Graph] := Module[{cd = color = Table[0, {V[g]}], m = 0, p, nc, e = ToAdjacencyLists[g]}, While[ m >= 0, p = Position[cd, m][[1, 1]]; nc = Append[color[[ e[[p]] ]], 0]; color[[ p ]] = Min[Complement[ Range[Max[nc] + 1], nc]]; cd[[ p ]] = -2 V[g]; Scan[(cd[[ # ]]++)&, e[[ p ]] ]; m = Max[cd] ]; color ] Bridges[g_Graph] := Select[BiconnectedComponents[g],(Length[#] == 2)&] Options[ButterflyGraph] = {VertexLabel->False} ButterflyGraph[n_Integer?Positive, opts___?OptionQ] := Module[{v = Map[Flatten, CartesianProduct[Strings[{0, 1}, n], Range[0, n]]], label}, label = VertexLabel /. Flatten[{opts, Options[ButterflyGraph]}]; RankedEmbedding[ MakeUndirected[ MakeGraph[v, (#1[[n+1]]+1 == #2[[n+1]]) && (#1[[Range[#2[[n+1]]-1]]] == #2[[Range[#2[[n+1]]-1]]]) && (#1[[Range[#2[[n+1]]+1, n]]] == #2[[Range[#2[[n+1]]+1, n]]])&, VertexLabel -> label ] ], Flatten[Position[v, {__, 0}]] ] ] CageGraph[g_Integer?Positive] := CageGraph[3,g] CageGraph[3,3] := CompleteGraph[4] CageGraph[3,4] := CompleteGraph[3,3] CageGraph[3,5] := PetersenGraph CageGraph[3,6] := HeawoodGraph CageGraph[3,7] := McGeeGraph CageGraph[3,8] := LeviGraph CageGraph[3,10] := Module[{p,i}, p = GraphUnion[CirculantGraph[20,{6}],Cycle[50]]; AddEdges[p, Join[Table[{7+5i,32+5i},{i,3,7}], Table[{20+10i,10i+29},{i,4}], Table[{15+10i,10i+24},{i,4}], {{21,20},{1,23},{70,29},{24,65}}, Flatten[ Table[{2i+j,21+5i+2j},{j,0,1},{i,9}], 1 ] ] ]/. Graph[l_List, v_List]:> Graph[l, Join[Table[{{Cos[#], Sin[#]}}&[2.Pi(i+1/2)/20], {i,20} ], 2 Table[{{Cos[#],Sin[#]}}&[2.Pi (i+1/2)/50], {i,50} ] ] ] ] CageGraph[4, 3] := CompleteGraph[5] CageGraph[4, 4] := CirculantGraph[8,{1,3}] CageGraph[4, 5] := RobertsonGraph CageGraph[4,6] := MakeUndirected[ MakeGraph[Range[26], Mod[#1-#2, 26] == 1 || (-1)^#1Mod[#1-