diff --git a/ChangeLog.rst b/ChangeLog.rst index afdb277..b7d21c6 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -23,6 +23,13 @@ New Features a name for the rule as a second positional argument. +Bugs Fixed +---------- + +- Fix :py:meth:`Rule.isomorphicLeftRight`/:cpp:func:`rule::Rule::isomorphicLeftRight`, + it was completely broken. + + v0.16.0 (2024-06-18) ==================== diff --git a/libs/libmod/src/mod/lib/Rules/Real.cpp b/libs/libmod/src/mod/lib/Rules/Real.cpp index 8323762..6fdffb4 100644 --- a/libs/libmod/src/mod/lib/Rules/Real.cpp +++ b/libs/libmod/src/mod/lib/Rules/Real.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -194,15 +195,15 @@ std::size_t Real::monomorphism(const Real &rDom, bool Real::isomorphicLeftRight(const Real &rDom, const Real &rCodom, LabelSettings labelSettings) { auto mrLeft = jla_boost::GraphMorphism::makeLimit(1); lib::GraphMorphism::morphismSelectByLabelSettings( - get_labelled_left(rDom.getDPORule()), - get_labelled_left(rCodom.getDPORule()), + LabelledFilteredGraph(get_labelled_left(rDom.getDPORule())), + LabelledFilteredGraph(get_labelled_left(rCodom.getDPORule())), labelSettings, lib::GraphMorphism::VF2Isomorphism(), std::ref(mrLeft)); if(mrLeft.getNumHits() == 0) return false; auto mrRight = jla_boost::GraphMorphism::makeLimit(1); lib::GraphMorphism::morphismSelectByLabelSettings( - get_labelled_right(rDom.getDPORule()), - get_labelled_right(rCodom.getDPORule()), + LabelledFilteredGraph(get_labelled_right(rDom.getDPORule())), + LabelledFilteredGraph(get_labelled_right(rCodom.getDPORule())), labelSettings, lib::GraphMorphism::VF2Isomorphism(), std::ref(mrRight)); return mrRight.getNumHits() == 1; diff --git a/test/py/rule/850_isomorphismLeftRight.py b/test/py/rule/850_isomorphismLeftRight.py index e735240..6d83dc6 100644 --- a/test/py/rule/850_isomorphismLeftRight.py +++ b/test/py/rule/850_isomorphismLeftRight.py @@ -1,23 +1,16 @@ include("xxx_helpers.py") -rId = Rule.fromGMLString("""rule [ - ruleID "id" - context [ - node [ id 0 label "A" ] - node [ id 1 label "B" ] - ] -]""") -rSwap = Rule.fromGMLString("""rule [ - ruleID "id" - left [ - node [ id 0 label "A" ] - node [ id 1 label "B" ] - ] - right [ - node [ id 0 label "B" ] - node [ id 1 label "A" ] - ] -]""") +rId = Rule.fromDFS("[A]0.[B]1>>[A]0.[B]1", "ID") +rSwap = Rule.fromDFS("[A]0.[B]1>>[A]1.[B]0", "swap") +assert rId.isomorphism(rSwap) == 0 +assert rId.isomorphicLeftRight(rSwap) + +commonChecks(rId) +commonChecks(rSwap) + + +rId = Rule.fromDFS("[A]0-[A]1.[A]10-[A]11>>[A]0-[A]1.[A]10-[A]11", "ID") +rSwap = Rule.fromDFS("[A]0-[A]1.[A]10-[A]11>>[A]0-[A]10.[A]1-[A]11", "swap") assert rId.isomorphism(rSwap) == 0 assert rId.isomorphicLeftRight(rSwap)