@@ -722,7 +722,7 @@ ExprBaseType BuiltInFunctions::tearingEvaluator(const EBTList& args)
722722 LIB ::Tearing tearing_impl = LIB ::TEARING_FACT .createTearingAlgorithm ();
723723 const auto tearing_evaluator = Overload {
724724 [&tearing_impl](LIB ::DSBG a) {
725- return ExprBaseType (tearing_impl.calculate (a).rmap ());
725+ return ExprBaseType (tearing_impl.calculate (a).dsbg ());
726726 },
727727 [](auto a) {
728728 Util::ERROR (" tearingEvaluator: wrong argument " , a, " for tearing\n " );
@@ -735,7 +735,7 @@ ExprBaseType BuiltInFunctions::tearingEvaluator(const EBTList& args)
735735ExprBaseType BuiltInFunctions::matchTearingEvaluator (const EBTList& args)
736736{
737737 Util::ERROR_UNLESS (args.size () == 2
738- , " tearingEvaluator : wrong number of arguments" );
738+ , " matchTearingEvaluator : wrong number of arguments" );
739739
740740 LIB ::Matching match_impl = LIB ::MATCH_FACT .createMatchAlgorithm ();
741741 LIB ::Tearing tearing_impl = LIB ::TEARING_FACT .createTearingAlgorithm ();
@@ -760,6 +760,58 @@ ExprBaseType BuiltInFunctions::matchTearingEvaluator(const EBTList& args)
760760 return std::visit (match_tearing_evaluator, args[0 ], args[1 ]);
761761}
762762
763+
764+ ExprBaseType BuiltInFunctions::tearingTSEvaluator (const EBTList& args)
765+ {
766+ Util::ERROR_UNLESS (args.size () == 1
767+ , " topoSortEvaluator: wrong number of arguments\n " );
768+
769+ LIB ::Tearing tearing_impl = LIB ::TEARING_FACT .createTearingAlgorithm ();
770+ LIB ::TopoSort ts_impl = LIB ::TS_FACT .createTSAlgorithm ();
771+ const auto ts_evaluator = Overload {
772+ [&tearing_impl, &ts_impl](LIB ::DSBG a) {
773+ LIB ::DSBG tearing_dsbg = tearing_impl.calculate (a).dsbg ();
774+ return ExprBaseType (ts_impl.calculate (tearing_dsbg));
775+ },
776+ [](auto a) {
777+ Util::ERROR (" topoSortEvaluator: wrong argument " , a, " for sort\n " );
778+ return ExprBaseType ();
779+ }
780+ };
781+ return std::visit (ts_evaluator, args[0 ]);
782+ }
783+
784+ ExprBaseType BuiltInFunctions::matchTearingTSEvaluator (const EBTList& args)
785+ {
786+ Util::ERROR_UNLESS (args.size () == 2
787+ , " sortEvaluator: wrong number of arguments" );
788+
789+ LIB ::Matching match_impl = LIB ::MATCH_FACT .createMatchAlgorithm ();
790+ LIB ::Tearing tearing_impl = LIB ::TEARING_FACT .createTearingAlgorithm ();
791+ LIB ::TopoSort ts_impl = LIB ::TS_FACT .createTSAlgorithm ();
792+ const auto sort_tearing_evaluator = Overload {
793+ [&match_impl, &tearing_impl, &ts_impl](LIB ::BipartiteSBG a, LIB ::NAT b) {
794+ LIB ::MatchData match_result = match_impl.calculate (a.copy (b));
795+ LIB ::DSBG scc_dsbg = MISC::buildSCCFromMatching (match_result);
796+ LIB ::DSBG tearing_dsbg = tearing_impl.calculate (scc_dsbg).dsbg ();
797+ return ExprBaseType (ts_impl.calculate (tearing_dsbg));
798+ },
799+ [&match_impl, &tearing_impl, &ts_impl](LIB ::BipartiteSBG a, LIB ::MD_NAT b) {
800+ LIB ::MatchData match_result = match_impl.calculate (a.copy (b[0 ]));
801+ LIB ::DSBG scc_dsbg = MISC::buildSCCFromMatching (match_result);
802+ LIB ::DSBG tearing_dsbg = tearing_impl.calculate (scc_dsbg).dsbg ();
803+ return ExprBaseType (ts_impl.calculate (tearing_dsbg));
804+ },
805+ [](auto a, auto b) {
806+ Util::ERROR (" match_tearing_evaluator: wrong arguments " , a, " , " , b
807+ , " for matchTearing\n " );
808+ return ExprBaseType ();
809+ }
810+ };
811+
812+ return std::visit (sort_tearing_evaluator, args[0 ], args[1 ]);
813+ }
814+
763815/*
764816ExprBaseType BuiltInFunctions::matchSCCTSEvaluator(const EBTList& args)
765817{
0 commit comments