Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow type parameter for bigobject graphs #483

Merged
merged 4 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Polymake"
uuid = "d720cf60-89b5-51f5-aff5-213f193123e7"
repo = "https://github.com/oscar-system/Polymake.jl.git"
version = "0.11.15"
version = "0.11.16"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
3 changes: 2 additions & 1 deletion src/meta.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Meta
import JSON
import Polymake: appname_module_dict, module_appname_dict, shell_context_help
import Polymake: Rational, PolymakeType, PropertyValue, OptionSet, QuadraticExtension, OscarNumber
import Polymake: Rational, PolymakeType, PropertyValue, OptionSet, QuadraticExtension, OscarNumber, DirType

struct UnparsablePolymakeFunction <: Exception
msg::String
Expand Down Expand Up @@ -34,6 +34,7 @@ translate_type_to_pm_string(::Type{<:Base.Integer}) = "Integer"
translate_type_to_pm_string(::Type{<:OscarNumber}) = "OscarNumber"
translate_type_to_pm_string(::typeof(min)) = "Min"
translate_type_to_pm_string(::typeof(max)) = "Max"
translate_type_to_pm_string(::Type{T}) where T <: DirType = string(nameof(T))
translate_type_to_pm_string(::Type{<:QuadraticExtension{T}}) where T = string("QuadraticExtension<", translate_type_to_pm_string(T), ">")

translate_type_to_pm_string(T) = throw(DomainError(T, "$T has been passed as a type parameter but no translation to a C++ template was defined. You may define such translation by appropriately extending
Expand Down
10 changes: 10 additions & 0 deletions test/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
@test Polymake.ne(g) == 0
end

@testset verbose=true "bigobjects" begin
c = Polymake.polytope.cube(3)
eg = c.GRAPH.ADJACENCY
g = Polymake.Graph{Polymake.Directed}(5)
bg = Polymake.graph.Graph{Polymake.Directed}(ADJACENCY=g)
@test bg.N_NODES == 5
bg2 = Polymake.graph.Graph(ADJACENCY=eg)
@test bg2.N_NODES == 8
end

@testset verbose=true "manipulating edges and vertices" begin
g = Polymake.Graph{Polymake.Directed}(5)
Polymake._add_edge(g, 0, 1)
Expand Down
Loading