Skip to content

Commit c2f1a05

Browse files
authored
expose more LEMON graph matching methods (#12376)
* expose more LEMON graph matching methods * try to resolve an overloaded method * simplify things * overload resolve first step * namespace for Edge * overload resolve * typo * edge to arc * more casts
1 parent 65ce799 commit c2f1a05

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

L/LEMON/build_tarballs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using BinaryBuilder, Pkg
44

55
name = "LEMON"
6-
version = v"1.3.2"
6+
version = v"1.3.3"
77
upstreamversion = v"1.3.1"
88
min_jl_version = v"1.9"
99

L/LEMON/bundled/cxxwrap/lemoncxxwrap.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ JLCXX_MODULE define_julia_module(jlcxx::Module& mod)
2929
mod.add_type<ListGraph::Node>("ListGraphNode");
3030
mod.add_type<ListDigraph::Node>("ListDigraphNode");
3131
mod.add_type<ListGraph::Edge>("ListGraphEdge");
32+
mod.add_type<ListGraph::Arc>("ListGraphArc");
3233
mod.add_type<ListDigraph::Arc>("ListDigraphArc");
3334

3435
mod.method("id", static_cast<int(*)(ListGraph::Node)>(&ListGraph::id));
3536
mod.method("id", static_cast<int(*)(ListGraph::Edge)>(&ListGraph::id));
37+
mod.method("id", static_cast<int(*)(ListGraph::Arc)>(&ListGraph::id));
3638
mod.method("id", static_cast<int(*)(ListDigraph::Node)>(&ListDigraph::id));
3739
mod.method("id", static_cast<int(*)(ListDigraph::Arc)>(&ListDigraph::id));
3840

@@ -67,11 +69,22 @@ JLCXX_MODULE define_julia_module(jlcxx::Module& mod)
6769
.constructor<const ListGraph&>()
6870
.method("set", &ListGraph::EdgeMap<int>::set);
6971

70-
mod.add_type<MaxWeightedPerfectMatching<ListGraph, ListGraph::EdgeMap<int>>>("MaxWeightedPerfectMatchingListGraphInt")
72+
using MWPM = MaxWeightedPerfectMatching<ListGraph, ListGraph::EdgeMap<int>>;
73+
using MWPMmatchingedge_ptr = bool (MWPM::*)(const ListGraph::Edge&) const; // used to resolve the overloads of `matching`
74+
using MWPMmatchingnode_ptr = ListGraph::Arc (MWPM::*)(const ListGraph::Node&) const; // used to resolve the overloads of `matching`
75+
MWPMmatchingedge_ptr matchingedge = &MWPM::matching;
76+
MWPMmatchingnode_ptr matchingnode = &MWPM::matching;
77+
mod.add_type<MWPM>("MaxWeightedPerfectMatchingListGraphInt")
7178
.constructor<const ListGraph&, const ListGraph::EdgeMap<int>&>()
72-
.method("mate", &MaxWeightedPerfectMatching<ListGraph, ListGraph::EdgeMap<int>>::mate)
73-
.method("run", &MaxWeightedPerfectMatching<ListGraph, ListGraph::EdgeMap<int>>::run)
74-
.method("matchingWeight", &MaxWeightedPerfectMatching<ListGraph, ListGraph::EdgeMap<int>>::matchingWeight);
75-
79+
.method("mate", &MWPM::mate)
80+
.method("run", &MWPM::run)
81+
.method("matchingWeight", &MWPM::matchingWeight)
82+
.method("matching", matchingedge)
83+
.method("matching", matchingnode)
84+
.method("dualValue", &MWPM::dualValue)
85+
.method("nodeValue", &MWPM::nodeValue)
86+
.method("blossomNum", &MWPM::blossomNum)
87+
.method("blossomSize", &MWPM::blossomSize)
88+
.method("blossomValue", &MWPM::blossomValue);
7689
}
7790

0 commit comments

Comments
 (0)