diff --git a/src/GraphProperties.jl b/src/GraphProperties.jl index da9c18e..279bdb4 100644 --- a/src/GraphProperties.jl +++ b/src/GraphProperties.jl @@ -41,108 +41,112 @@ struct PropertyComparison{ end let - properties_abstractvector_integer = Tuple{Symbol, String}[ - (:DegreeSequence, "The *degree sequence* of an undirected graph."), + ag = "a graph" + ug = "an undirected graph" + dg = "a directed graph" + cg = "a connected undirected graph" + properties_abstractvector_integer = Tuple{Symbol, String, Vector{String}, String}[ + (:DegreeSequence, "*degree sequence*", [], ug), ] - properties_real = Tuple{Symbol, String}[ - (:FractionalChromaticNumber, "The *fractional chromatic number* of an undirected graph."), - (:FractionalMatchingNumber, "The *fractional matching number* of an undirected graph."), - (:Strength, "The *strength* of an undirected graph."), - (:AssortativityCoefficient, "The *assortativity coefficient* of an undirected graph."), - (:GlobalClusteringCoefficient, "The *global clustering coefficient* of an undirected graph."), - (:CheegerConstant, "The *Cheeger constant* of an undirected graph. Also known as the *Cheeger number* or as the *isoperimetric number*."), - (:Circumference, "The *circumference* of an undirected graph."), - (:Girth, "The *girth* of an undirected graph."), + properties_real = Tuple{Symbol, String, Vector{String}, String}[ + (:FractionalChromaticNumber, "*fractional chromatic number*", [], ug), + (:FractionalMatchingNumber, "*fractional matching number*", [], ug), + (:Strength, "*strength*", [], ug), + (:AssortativityCoefficient, "*assortativity coefficient*", [], ug), + (:GlobalClusteringCoefficient, "*global clustering coefficient*", [], ug), + (:CheegerConstant, "*Cheeger constant*", ["*Cheeger number*", "*isoperimetric number*"], ug), + (:Circumference, "*circumference*", [], ug), + (:Girth, "*girth*", [], ug), ] - properties_integer = Tuple{Symbol, String}[ - (:NumberOfVertices, "The *number of vertices* of a graph."), - (:NumberOfEdges, "The *number of edges* of an undirected graph."), - (:NumberOfArcs, "The *number of arcs* of a directed graph."), - (:NumberOfConnectedComponents, "The *number of connected components* of an undirected graph."), - (:NumberOfWeaklyConnectedComponents, "The *number of weakly connected components* of a directed graph."), - (:NumberOfStronglyConnectedComponents, "The *number of strongly connected components* of a directed graph."), - (:MinimumDegree, "The *minimum degree* among the degrees of the vertices of an undirected graph."), - (:MaximumDegree, "The *maximum degree* among the degrees of the vertices of an undirected graph."), - (:MinimumIndegree, "The *minimum indegree* among the indegrees of the vertices of a directed graph."), - (:MaximumIndegree, "The *maximum indegree* among the indegrees of the vertices of a directed graph."), - (:MinimumOutdegree, "The *minimum outdegree* among the outdegrees of the vertices of a directed graph."), - (:MaximumOutdegree, "The *maximum outdegree* among the outdegrees of the vertices of a directed graph."), - (:Radius, "The *radius* of a connected undirected graph."), - (:Diameter, "The *diameter* of a connected undirected graph."), - (:Triameter, "The *triameter* of a connected undirected graph."), - (:VertexConnectivity, "The *vertex-connectivity* of an undirected graph. Also known as the *connectivity*."), - (:EdgeConnectivity, "The *edge-connectivity* of an undirected graph."), - (:CliqueNumber, "The *clique number* of an undirected graph."), - (:ChromaticNumber, "The *chromatic number* of an undirected graph."), - (:ChromaticIndex, "The *chromatic index* of an undirected graph. Also known as the *edge chromatic number*."), - (:MatchingNumber, "The *matching number* of an undirected graph."), - (:DominationNumber, "The *domination number* of an undirected graph."), - (:StrongDominationNumber, "The *strong domination number* of an undirected graph."), - (:IndependenceNumber, "The *independence number* of an undirected graph."), - (:Choosability, "The *choosability* of an undirected graph. Also known as the *list colorability* or as the *list chromatic number*."), - (:FeedbackVertexSetNumber, "The *feedback vertex set number* of a graph."), - (:VertexCoverNumber, "The *vertex cover number* of an undirected graph."), - (:EdgeCoverNumber, "The *edge cover number* of an undirected graph."), - (:IntersectionNumber, "The *intersection number* of an undirected graph. Also known as the *R-content* or as the *edge clique cover number* or as the *clique cover number*."), - (:BipartiteDimension, "The *bipartite dimension* of an undirected graph. Also known as the *biclique cover number*."), - (:HadwigerNumber, "The *Hadwiger number* of an undirected graph. Also known as the *contraction clique number* or as the *homomorphism degree*."), - (:TwinWidth, "The *twin-width* of an undirected graph."), - (:CliqueWidth, "The *clique-width* of an undirected graph."), - (:TreeDepth, "The *tree-depth* of a connected undirected graph."), - (:CycleRank, "The *cycle rank* of a directed graph."), - (:Treewidth, "The *treewidth* of an undirected graph."), - (:Pathwidth, "The *pathwidth* of an undirected graph. Also known as the *interval thickness* or as the *vertex separation number* or as the *node searching number*."), - (:Boxicity, "The *boxicity* of an undirected graph."), - (:Sphericity, "The *sphericity* of an undirected graph."), - (:Degeneracy, "The *degeneracy* of an undirected graph. Also known as the *width* or as the *linkage*."), - (:Arboricity, "The *arboricity* of an undirected graph."), - (:Splittance, "The *splittance* of an undirected graph."), + properties_integer = Tuple{Symbol, String, Vector{String}, String}[ + (:NumberOfVertices, "*number of vertices*", ["*order*"], ag), + (:NumberOfEdges, "*number of edges*", ["*size*"], ug), + (:NumberOfArcs, "*number of arcs*", [], dg), + (:NumberOfConnectedComponents, "*number of connected components*", [], ug), + (:NumberOfWeaklyConnectedComponents, "*number of weakly connected components*", [], dg), + (:NumberOfStronglyConnectedComponents, "*number of strongly connected components*", [], dg), + (:MinimumDegree, "*minimum degree*", [], ug), + (:MaximumDegree, "*maximum degree*", [], ug), + (:MinimumIndegree, "*minimum indegree*", [], dg), + (:MaximumIndegree, "*maximum indegree*", [], dg), + (:MinimumOutdegree, "*minimum outdegree*", [], dg), + (:MaximumOutdegree, "*maximum outdegree*", [], dg), + (:Radius, "*radius*", [], cg), + (:Diameter, "*diameter*", [], cg), + (:Triameter, "*triameter*", [], cg), + (:VertexConnectivity, "*vertex-connectivity*", ["*connectivity*"], ug), + (:EdgeConnectivity, "*edge-connectivity*", [], ug), + (:CliqueNumber, "*clique number*", [], ug), + (:ChromaticNumber, "*chromatic number*", [], ug), + (:ChromaticIndex, "*chromatic index*", ["*edge chromatic number*"], ug), + (:MatchingNumber, "*matching number*", [], ug), + (:DominationNumber, "*domination number*", [], ug), + (:StrongDominationNumber, "*strong domination number*", [], ug), + (:IndependenceNumber, "*independence number*", [], ug), + (:Choosability, "*choosability*", ["*list colorability*", "*list chromatic number*"], ug), + (:FeedbackVertexSetNumber, "*feedback vertex set number*", [], ag), + (:VertexCoverNumber, "*vertex cover number*", [], ug), + (:EdgeCoverNumber, "*edge cover number*", [], ug), + (:IntersectionNumber, "*intersection number*", ["*R-content*", "*edge clique cover number*", "*clique cover number*"], ug), + (:BipartiteDimension, "*bipartite dimension*", ["*biclique cover number*"], ug), + (:HadwigerNumber, "*Hadwiger number*", ["*contraction clique number*", "*homomorphism degree*"], ug), + (:TwinWidth, "*twin-width*", [], ug), + (:CliqueWidth, "*clique-width*", [], ug), + (:TreeDepth, "*tree-depth*", [], ug), + (:CycleRank, "*cycle rank*", [], dg), + (:Treewidth, "*treewidth*", [], ug), + (:Pathwidth, "*pathwidth*", ["*interval thickness*", "*vertex separation number*", "*node searching number*"], ug), + (:Boxicity, "*boxicity*", [], ug), + (:Sphericity, "*sphericity*", [], ug), + (:Degeneracy, "*degeneracy*", ["*width*", "*linkage*"], ug), + (:Arboricity, "*arboricity*", [], ug), + (:Splittance, "*splittance*", [], ug), ] - properties_bool = Tuple{Symbol, String}[ - (:IsUndirectedGraph, "Is something an *undirected graph*?"), - (:IsDirectedGraph, "Is something a *directed graph*?"), - (:DigraphIsDAG, "Is a directed graph *acyclic* (a *directed acyclic graph*, also known as a *DAG*)?"), - (:DigraphIsOrientation, "Is a directed graph an *orientation*?"), - (:GraphIsConnected, "Is an undirected graph *connected*?"), - (:DigraphIsWeaklyConnected, "Is a directed graph *weakly connected*?"), - (:DigraphIsStronglyConnected, "Is a directed graph *strongly connected*?"), - (:GraphIsBipartite, "Is an undirected graph *bipartite*?"), - (:GraphIsCompleteBipartite, "Is an undirected graph *complete bipartite*? Also known as *biclique*."), - (:GraphIsPath, "Is an undirected graph a *path*?"), - (:GraphIsCycle, "Is an undirected graph a *cycle*?"), - (:GraphIsPlanar, "Is an undirected graph *planar*?"), - (:DigraphIsPlanar, "Is a directed graph *planar*?"), - (:GraphIsOuterplanar, "Is an undirected graph *outerplanar*?"), - (:GraphIsMaximalOuterplanar, "Is an undirected graph *maximal outerplanar*?"), - (:GraphIsTriangleFree, "Is an undirected graph *triangle-free*?"), - (:GraphIsComplete, "Is an undirected graph *complete*?"), - (:GraphIsRegular, "Is an undirected graph *regular*?"), - (:GraphIsDistanceRegular, "Is an undirected graph *distance-regular*?"), - (:GraphIsDistanceTransitive, "Is an undirected graph *distance-transitive*?"), - (:GraphIsStronglyRegular, "Is an undirected graph *strongly regular*?"), - (:GraphIsPerfect, "Is an undirected graph *perfect*?"), - (:GraphIsTriviallyPerfect, "Is an undirected graph *trivially perfect*?"), - (:GraphIsModular, "Is an undirected graph *modular*?"), - (:GraphIsMedianGraph, "Is an undirected graph a *median graph*?"), - (:GraphIsSquaregraph, "Is an undirected graph a *squaregraph*?"), - (:GraphIsForest, "Is an undirected graph a *forest*?"), - (:GraphIsTree, "Is an undirected graph a *tree*?"), - (:GraphIsStar, "Is an undirected graph a *star*?"), - (:GraphIsIndifferenceGraph, "Is an undirected graph an *indifference graph*?"), - (:GraphIsIntervalGraph, "Is an undirected graph an *interval graph*?"), - (:GraphIsPtolemaic, "Is an undirected graph *Ptolemaic*?"), - (:GraphIsChordal, "Is an undirected graph *chordal*?"), - (:GraphIsStronglyChordal, "Is an undirected graph *strongly chordal*?"), - (:GraphIsDuallyChordal, "Is an undirected graph *dually chordal*? Note: a dually chordal graph is not always chordal."), - (:GraphIsChordalBipartite, "Is an undirected graph *chordal bipartite*? Note: a chordal bipartite graph is not always chordal."), - (:GraphIsMeynielGraph, "Is an undirected graph a *Meyniel graph*?"), - (:GraphIsCircleGraph, "Is an undirected graph a *circle graph*?"), - (:GraphIsPermutationGraph, "Is an undirected graph a *permutation graph*?"), - (:GraphIsCograph, "Is an undirected graph a *cograph*?"), - (:GraphIsComparabilityGraph, "Is an undirected graph a *comparability graph*?"), - (:GraphIsDistanceHereditary, "Is an undirected graph *distance-hereditary*?"), - (:GraphIsSplitGraph, "Is an undirected graph a *split graph*?"), - (:GraphIsCartesianProduct, "Is an undirected graph a *Cartesian product* of two graphs? Also known as the *box product*."), + properties_bool = Tuple{Symbol, String, Vector{String}, String}[ + (:IsUndirectedGraph, "an *undirected graph*", [], ag), + (:IsDirectedGraph, "a *directed graph*", ["a *digraph*"], ag), + (:DigraphIsDAG, "a *directed acyclic graph*", ["a *DAG*"], dg), + (:DigraphIsOrientation, "an *orientation*", [], dg), + (:GraphIsConnected, "*connected*", [], ug), + (:DigraphIsWeaklyConnected, "*weakly connected*", [], dg), + (:DigraphIsStronglyConnected, "*strongly connected*", [], dg), + (:GraphIsBipartite, "*bipartite*", [], ug), + (:GraphIsCompleteBipartite, "*complete bipartite*", ["a *biclique*"], ug), + (:GraphIsPath, "a *path*", [], ug), + (:GraphIsCycle, "a *cycle*", [], ug), + (:GraphIsPlanar, "*planar*", [], ug), + (:DigraphIsPlanar, "*planar*", [], dg), + (:GraphIsOuterplanar, "*outerplanar*", [], ug), + (:GraphIsMaximalOuterplanar, "*maximal outerplanar*", [], ug), + (:GraphIsTriangleFree, "*triangle-free*", [], ug), + (:GraphIsComplete, "*complete*", [], ug), + (:GraphIsRegular, "*regular*", [], ug), + (:GraphIsDistanceRegular, "*distance-regular*", [], ug), + (:GraphIsDistanceTransitive, "*distance-transitive*", [], ug), + (:GraphIsStronglyRegular, "*strongly regular*", [], ug), + (:GraphIsPerfect, "*perfect*", [], ug), + (:GraphIsTriviallyPerfect, "*trivially perfect*", [], ug), + (:GraphIsModular, "*modular*", [], ug), + (:GraphIsMedianGraph, "a *median graph*", [], ug), + (:GraphIsSquaregraph, "a *squaregraph*", [], ug), + (:GraphIsForest, "a *forest*", [], ug), + (:GraphIsTree, "a *tree*", [], ug), + (:GraphIsStar, "a *star*", [], ug), + (:GraphIsIndifferenceGraph, "an *indifference graph*", [], ug), + (:GraphIsIntervalGraph, "an *interval graph*", [], ug), + (:GraphIsPtolemaic, "*Ptolemaic*", [], ug), + (:GraphIsChordal, "*chordal*", [], ug), + (:GraphIsStronglyChordal, "*strongly chordal*", [], ug), + (:GraphIsDuallyChordal, "*dually chordal*", [], ug), + (:GraphIsChordalBipartite, "*chordal bipartite*", [], ug), + (:GraphIsMeynielGraph, "a *Meyniel graph*", [], ug), + (:GraphIsCircleGraph, "a *circle graph*", [], ug), + (:GraphIsPermutationGraph, "a *permutation graph*", [], ug), + (:GraphIsCograph, "a *cograph*", [], ug), + (:GraphIsComparabilityGraph, "a *comparability graph*", [], ug), + (:GraphIsDistanceHereditary, "*distance-hereditary*", [], ug), + (:GraphIsSplitGraph, "a *split graph*", [], ug), + (:GraphIsCartesianProduct, "a *Cartesian product* of two graphs", ["a box product"], ug), ] for (typ, properties) ∈ ( (AbstractVector{<:Integer}, properties_abstractvector_integer), @@ -150,7 +154,17 @@ let (Integer, properties_integer), (Bool, properties_bool), ) - for (name, desc) ∈ properties + for (name, natural_name, aliases, assumed) ∈ properties + lead = if typ == Bool + "Is $assumed $natural_name?" + else + "The $natural_name of $assumed." + end + desc = if isempty(aliases) + lead + else + string(lead, " Also known as:\n\n", mapreduce((a -> string("* ", a)), ((l, r) -> string(l, "\n\n", r)), aliases)) + end @eval export $name @eval begin """ @@ -158,6 +172,8 @@ let $($desc) + Example: + ```jldoctest julia> using GraphProperties