@@ -72,6 +72,7 @@ class OrbitGraphProcessor {
7272
7373 size_t symmetry_threshold_ = 2 ;
7474 static constexpr bool verbose = false ;
75+ v_workw_t <Constr_Graph_t> work_threshold_ = 80 ;
7576
7677 void merge_small_orbits (const Graph_t &original_dag, Constr_Graph_t& current_coarse_graph, std::vector<Group>& current_groups, std::vector<VertexType>& current_contraction_map, const v_workw_t <Constr_Graph_t> work_threshold) {
7778
@@ -86,7 +87,7 @@ class OrbitGraphProcessor {
8687 changed = false ;
8788 for (const auto u : current_coarse_graph.vertices ()) {
8889 for (const auto v : current_coarse_graph.children (u)) {
89-
90+
9091 const v_workw_t <Constr_Graph_t> u_work_weight = current_coarse_graph.vertex_work_weight (u);
9192 const v_workw_t <Constr_Graph_t> v_work_weight = current_coarse_graph.vertex_work_weight (v);
9293
@@ -177,7 +178,11 @@ class OrbitGraphProcessor {
177178 changed = true ;
178179 break ; // Restart scan on the new, smaller graph
179180 }
181+ if (changed) {
182+ break ;
183+ }
180184 }
185+ // If a change was made, the outer while loop will continue, restarting the scan.
181186 }
182187 }
183188
@@ -228,8 +233,8 @@ class OrbitGraphProcessor {
228233 const bool both_below_symmetry_threshold =
229234 (current_groups[u].size () < symmetry_threshold_) &&
230235 (current_groups[v].size () <
231- symmetry_threshold_); // && (not ((current_groups[u].size() == 1 && current_groups[v].size() > 1)
232- // || (current_groups[u].size() > 1 && current_groups[v].size() == 1)));
236+ symmetry_threshold_) && (not ((current_groups[u].size () == 1 && current_groups[v].size () > 1 )
237+ || (current_groups[u].size () > 1 && current_groups[v].size () == 1 )));
233238
234239 if (error) {
235240 if constexpr (verbose) {
@@ -324,6 +329,8 @@ class OrbitGraphProcessor {
324329 */
325330 void set_symmetry_threshold (size_t threshold) { symmetry_threshold_ = threshold; }
326331
332+ void set_work_threshold (v_workw_t <Constr_Graph_t> work_threshold) { work_threshold_ = work_threshold; }
333+
327334 /* *
328335 * @brief Discovers isomorphic groups (orbits) and constructs a coarse graph.
329336 * @param dag The input computational DAG.
@@ -382,7 +389,7 @@ class OrbitGraphProcessor {
382389 }
383390 contract_edges (original_dag, current_coarse_graph, current_groups, current_contraction_map, false , true );
384391 contract_edges (original_dag, current_coarse_graph, current_groups, current_contraction_map, true , true );
385- merge_small_orbits (original_dag, current_coarse_graph, current_groups, current_contraction_map, 80 );
392+ merge_small_orbits (original_dag, current_coarse_graph, current_groups, current_contraction_map, work_threshold_ );
386393
387394 // --- Finalize ---
388395 final_coarse_graph_ = std::move (current_coarse_graph);
0 commit comments