File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,11 @@ Documentation for [GraphProperties](https://github.com/JuliaGraphs/GraphProperti
1111
1212``` @docs
1313GraphProperty
14+ graph_property_type
1415PropertyComparison
1516```
1617
1718``` @autodocs
1819Modules = [GraphProperties]
19- Filter = !(t -> t in (GraphProperty, PropertyComparison))
20+ Filter = !(t -> t in (GraphProperty, graph_property_type, PropertyComparison))
2021```
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module GraphProperties
22
33export
44 GraphProperty,
5+ graph_property_type,
56 PropertyComparison
67
78"""
@@ -13,6 +14,17 @@ The only type parameter is the type of each value of the property.
1314"""
1415abstract type GraphProperty{T} end
1516
17+ """
18+ graph_property_type(::GraphProperty{T}) -> T
19+
20+ Get the type of each value of the property.
21+
22+ It is not allowed to add methods to this function.
23+ """
24+ function graph_property_type (:: GraphProperty{T} ) where {T}
25+ T
26+ end
27+
1628"""
1729 PropertyComparison(comparison, property, value)
1830
Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ using Test
1010 @test FractionalChromaticNumber () isa GraphProperty{Real}
1111 @test DegreeSequence () isa GraphProperty{AbstractVector{<: Integer }}
1212 end
13+ @testset " `graph_property_type`" begin
14+ @test Bool === @inferred graph_property_type (GraphIsCograph ())
15+ @test Integer === @inferred graph_property_type (Degeneracy ())
16+ @test Real === @inferred graph_property_type (Strength ())
17+ @test AbstractVector{<: Integer } == @inferred graph_property_type (DegreeSequence ())
18+ end
1319end
1420
1521using Aqua: Aqua
You can’t perform that action at this time.
0 commit comments