From f8925d69c14d6a77586b0bf480e5e907eeda8e33 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 6 Feb 2026 18:05:41 +0100 Subject: [PATCH 1/4] more graph isomorphism functions --- include/jlpolymake/jlpolymake.h | 1 + src/polymake/generate_deps_tree.jl | 4 ++-- src/polymake/type_setup.pl | 9 ++++++++ src/type_graph.cpp | 35 ++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/include/jlpolymake/jlpolymake.h b/include/jlpolymake/jlpolymake.h index e5ca0b4..545e944 100644 --- a/include/jlpolymake/jlpolymake.h +++ b/include/jlpolymake/jlpolymake.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/src/polymake/generate_deps_tree.jl b/src/polymake/generate_deps_tree.jl index 5661a34..f8f6c1c 100644 --- a/src/polymake/generate_deps_tree.jl +++ b/src/polymake/generate_deps_tree.jl @@ -3,12 +3,12 @@ using Pkg.Artifacts # adapted from https://github.com/JuliaLang/julia/pull/38797 function full_artifact_dir(m::Module) - artifacts_toml = joinpath(dirname(dirname(Base.pathof(m))), "StdlibArtifacts.toml") + artifacts_toml = joinpath(dirname(dirname(Base.pathof(m)::String)), "StdlibArtifacts.toml") # If this file exists, it's a stdlib JLL and we must download the artifact ourselves if isfile(artifacts_toml) # we need to remove the _jll for the artifact name - meta = artifact_meta(string(m)[1:end-4], artifacts_toml) + meta::Dict{String,Any} = artifact_meta(string(m)[1:end-4], artifacts_toml) hash = Base.SHA1(meta["git-tree-sha1"]) if !artifact_exists(hash) dl_info = first(meta["download"]) diff --git a/src/polymake/type_setup.pl b/src/polymake/type_setup.pl index bf4a8c1..c1a6e76 100644 --- a/src/polymake/type_setup.pl +++ b/src/polymake/type_setup.pl @@ -269,6 +269,10 @@ sub EdgeMap { Vector(Polynomial(Rational,Int)), Array(Polynomial(Integer,Int)), Array(Polynomial(Rational,Int)), + Matrix(UniPolynomial(Rational,Int)), + Vector(UniPolynomial(Rational,Int)), + Array(UniPolynomial(Integer,Int)), + Array(UniPolynomial(Rational,Int)), Map(String,String), Map(String,Int), @@ -281,7 +285,12 @@ sub EdgeMap { Map(Set(Int),Vector(Rational)), Map(Vector(Int),Integer), Map(Pair(Int,Int),Int), + Map(Pair(Int,Int),double), + Map(Pair(Int,Int),Integer), + Map(Pair(Int,Int),Rational), + Map(Pair(Int,Int),String), Map(Pair(Int,Int),Vector(Integer)), + Map(Pair(Int,Int),Vector(Rational)), IncidenceMatrix, Array(IncidenceMatrix), diff --git a/src/type_graph.cpp b/src/type_graph.cpp index 20bb38f..fcbaeb3 100644 --- a/src/type_graph.cpp +++ b/src/type_graph.cpp @@ -44,6 +44,41 @@ void add_graph(jlcxx::Module& jlpolymake) wrapped.method("show_small_obj", [](const WrappedT& S) { return show_small_object(S); }); + + wrapped.method("_canonical_hash", [](const WrappedT& G, const Array& col, long key) { + graph::GraphIso gi; + graph::GraphIso::prepare_colored(gi, G, col); + return gi.hash(key); + }); + wrapped.method("_canonical_hash", [](const WrappedT& G, long key) { + return graph::canonical_hash(G, key); + }); + wrapped.method("_canonical_perm", [](const WrappedT& G, const Array& col) { + graph::GraphIso gi; + graph::GraphIso::prepare_colored(gi, G, col); + return gi.canonical_perm(); + }); + wrapped.method("_canonical_form", [](const WrappedT& G) { + return graph::canonical_form(G); + }); + wrapped.method("_is_isomorphic", [](const WrappedT& G1, const WrappedT& G2) { + return graph::isomorphic(G1, G2); + }); + wrapped.method("_is_isomorphic_with_colors", [](const WrappedT& G1, const Array& col1, const WrappedT& G2, const Array& col2) { + return graph::isomorphic(G1, col1, G2, col2); + }); + wrapped.method("_permute_nodes", [](const WrappedT& G, const Array& perm) { + return pm::permuted_nodes(G, perm); + }); + wrapped.method("_permute_nodes!", [](WrappedT& G, const Array& perm) { + G.permute_nodes(perm); + }); + wrapped.method("_automorphisms", [](const WrappedT& G, const Array& col) { + return graph::automorphisms(G, col); + }); + wrapped.method("_automorphisms", [](const WrappedT& G) { + return graph::automorphisms(G); + }); }); jlpolymake.add_type>>("GraphEdgeIterator") From bb38a23af5229683b8a487553250dd95f3e75cda Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 8 Feb 2026 13:45:57 +0100 Subject: [PATCH 2/4] test 1.13 and nightly, drop 1.11 --- .github/workflows/test-polymake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-polymake.yml b/.github/workflows/test-polymake.yml index 7095c45..6af8594 100644 --- a/.github/workflows/test-polymake.yml +++ b/.github/workflows/test-polymake.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macOS-latest] - julia-version: ['~1.10.0-0', '~1.11.0-0', '1.12-nightly'] + julia-version: ['~1.10.0-0', '~1.12.0-0', '1.13-nightly', 'nightly'] fail-fast: false From 48351a358046e516ffbbb40f8492d8ccd1fb7d9d Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 8 Feb 2026 13:48:36 +0100 Subject: [PATCH 3/4] update deps for testing --- test-prepare.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-prepare.jl b/test-prepare.jl index 5cd19b2..f461e57 100644 --- a/test-prepare.jl +++ b/test-prepare.jl @@ -1,8 +1,8 @@ using Pkg -Pkg.add(name="libcxxwrap_julia_jll", version="0.14.3") +Pkg.add(name="libcxxwrap_julia_jll", version="0.14.9") Pkg.pin("libcxxwrap_julia_jll") -Pkg.add(name="polymake_jll", version="400.1500.0") +Pkg.add(name="polymake_jll", version="400.1500.2") using polymake_jll using libcxxwrap_julia_jll From f973e78249b6da9ddb7108db73f7d534f1a38495 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Sun, 8 Feb 2026 17:36:28 +0100 Subject: [PATCH 4/4] update version --- include/jlpolymake/jlpolymake.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/jlpolymake/jlpolymake.h b/include/jlpolymake/jlpolymake.h index 545e944..0675617 100644 --- a/include/jlpolymake/jlpolymake.h +++ b/include/jlpolymake/jlpolymake.h @@ -46,7 +46,7 @@ #define JLPOLYMAKE_VERSION_MAJOR 0 #define JLPOLYMAKE_VERSION_MINOR 14 -#define JLPOLYMAKE_VERSION_PATCH 2 +#define JLPOLYMAKE_VERSION_PATCH 5 #define __JLPOLYMAKE_STR_HELPER(x) #x #define __JLPOLYMAKE_STR(x) __JLPOLYMAKE_STR_HELPER(x)