|
1 | 1 | module GraphProperties |
2 | 2 |
|
3 | | -# Write your package code here. |
| 3 | +export |
| 4 | + GraphProperty, |
| 5 | + PropertyComparison |
| 6 | + |
| 7 | +abstract type GraphProperty{T} end |
| 8 | + |
| 9 | +struct PropertyComparison{ |
| 10 | + Comparison <: Union{typeof(==), typeof(≤), typeof(≥)}, |
| 11 | + Property <: GraphProperty{<:Real}, |
| 12 | + Value, |
| 13 | +} <: GraphProperty{Bool} |
| 14 | + comparison::Comparison |
| 15 | + property::Property |
| 16 | + value::Value |
| 17 | +end |
| 18 | + |
| 19 | +let |
| 20 | + properties_abstractvector = Symbol[ |
| 21 | + :DegreeSequence, |
| 22 | + ] |
| 23 | + properties_real = Symbol[ |
| 24 | + :FractionalChromaticNumber, |
| 25 | + :FractionalMatchingNumber, |
| 26 | + ] |
| 27 | + properties_integer = Symbol[ |
| 28 | + :NumberOfVertices, |
| 29 | + :NumberOfEdges, |
| 30 | + :NumberOfArcs, |
| 31 | + :NumberOfConnectedComponents, |
| 32 | + :MinimumDegree, |
| 33 | + :MaximumDegree, |
| 34 | + :Girth, |
| 35 | + :VertexConnectivity, |
| 36 | + :EdgeConnectivity, |
| 37 | + :CliqueNumber, |
| 38 | + :ChromaticNumber, |
| 39 | + :ChromaticIndex, |
| 40 | + :MatchingNumber, |
| 41 | + :DominationNumber, |
| 42 | + :IndependenceNumber, |
| 43 | + :Choosability, |
| 44 | + :FeedbackVertexSetNumber, |
| 45 | + :VertexCoverNumber, |
| 46 | + :EdgeCoverNumber, |
| 47 | + :IntersectionNumber, |
| 48 | + :BipartiteDimension, |
| 49 | + :HadwigerNumber, |
| 50 | + :TwinWidth, |
| 51 | + :CliqueWidth, |
| 52 | + :Treewidth, |
| 53 | + :Pathwidth, |
| 54 | + :Boxicity, |
| 55 | + :Degeneracy, |
| 56 | + :Arboricity, |
| 57 | + :Splittance, |
| 58 | + ] |
| 59 | + properties_bool = Symbol[ |
| 60 | + :IsUndirectedGraph, |
| 61 | + :IsDirectedGraph, |
| 62 | + :DigraphIsDAG, |
| 63 | + :DigraphIsOrientation, |
| 64 | + :GraphIsConnected, |
| 65 | + :DigraphIsWeaklyConnected, |
| 66 | + :DigraphIsStronglyConnected, |
| 67 | + :GraphIsBipartite, |
| 68 | + :GraphIsPath, |
| 69 | + :GraphIsCycle, |
| 70 | + :GraphIsPlanar, |
| 71 | + :DigraphIsPlanar, |
| 72 | + :GraphIsTriangleFree, |
| 73 | + :GraphIsComplete, |
| 74 | + :GraphIsRegular, |
| 75 | + :GraphIsPerfect, |
| 76 | + :GraphIsTriviallyPerfect, |
| 77 | + :GraphIsForest, |
| 78 | + :GraphIsTree, |
| 79 | + :GraphIsIndifferenceGraph, |
| 80 | + :GraphIsIntervalGraph, |
| 81 | + :GraphIsPtolemaic, |
| 82 | + :GraphIsChordal, |
| 83 | + :GraphIsMeynielGraph, |
| 84 | + :GraphIsCircleGraph, |
| 85 | + :GraphIsPermutationGraph, |
| 86 | + :GraphIsCograph, |
| 87 | + :GraphIsComparabilityGraph, |
| 88 | + :GraphIsDistanceHereditary, |
| 89 | + :GraphIsSplitGraph, |
| 90 | + ] |
| 91 | + for (typ, properties) ∈ ( |
| 92 | + (AbstractVector, properties_abstractvector), |
| 93 | + (Real, properties_real), |
| 94 | + (Integer, properties_integer), |
| 95 | + (Bool, properties_bool), |
| 96 | + ) |
| 97 | + for p ∈ properties |
| 98 | + @eval export $p |
| 99 | + @eval struct $p <: GraphProperty{$typ} end |
| 100 | + end |
| 101 | + end |
| 102 | +end |
| 103 | + |
| 104 | +# TODO: doc strings |
4 | 105 |
|
5 | 106 | end |
0 commit comments