@@ -163,9 +163,15 @@ class OrbitGraphProcessor {
163163
164164 // --- Check Constraints ---
165165 // Symmetry Threshold
166- const bool merge_viable = is_merge_viable (original_dag, current_groups[u], current_groups[v], new_subgraphs);
166+ bool error = false ;
167+ const bool merge_viable = is_merge_viable (original_dag, current_groups[u], current_groups[v], new_subgraphs, error);
167168 const bool both_below_symmetry_threshold = (current_groups[u].size () < symmetry_threshold_) && (current_groups[v].size () < symmetry_threshold_);// && (not ((current_groups[u].size() == 1 && current_groups[v].size() > 1) || (current_groups[u].size() > 1 && current_groups[v].size() == 1)));
168169
170+ if (error) {
171+ if constexpr (verbose) { std::cout << " - Merge of " << u << " and " << v << " and " << v << " not viable (error in is_merge_viable)\n " ; }
172+ continue ;
173+ }
174+
169175 if (!merge_viable && !both_below_symmetry_threshold) {
170176 if constexpr (verbose) { std::cout << " - Merge of " << u << " and " << v << " not viable (symmetry threshold)\n " ; }
171177 continue ;
@@ -261,7 +267,7 @@ class OrbitGraphProcessor {
261267 * If viable, it populates the `out_new_subgraphs` with the structure of the merged group.
262268 */
263269 bool is_merge_viable (const Graph_t& original_dag, const Group& group_u, const Group& group_v,
264- std::vector<std::vector<VertexType>>& out_new_subgraphs) const {
270+ std::vector<std::vector<VertexType>>& out_new_subgraphs, bool & error ) const {
265271
266272 std::vector<VertexType> all_nodes;
267273 all_nodes.reserve (group_u.subgraphs .size () + group_v.subgraphs .size ());
@@ -281,13 +287,19 @@ class OrbitGraphProcessor {
281287 std::sort (all_nodes.begin (), all_nodes.end ());
282288
283289 Constr_Graph_t induced_subgraph;
284- auto map = create_induced_subgraph_map (original_dag, induced_subgraph, all_nodes);
285290
291+ // create_induced_subgraph(original_dag, induced_subgraph, all_nodes);
292+ // std::vector<VertexType> components; // local -> component_id
293+ // size_t num_components = compute_weakly_connected_components(induced_subgraph, components);
294+ // out_new_subgraphs.assign(num_components, std::vector<VertexType>());
295+ // for (VertexType i = 0; i < induced_subgraph.num_vertices(); ++i) {
296+ // out_new_subgraphs[components[i]].push_back(all_nodes[i]);
297+ // }
298+
299+ auto map = create_induced_subgraph_map (original_dag, induced_subgraph, all_nodes);
286300 std::vector<VertexType> components; // local -> component_id
287301 size_t num_components = compute_weakly_connected_components (induced_subgraph, components);
288-
289302 out_new_subgraphs.assign (num_components, std::vector<VertexType>());
290-
291303 for (const auto & node : all_nodes) {
292304 out_new_subgraphs[components[map[node]]].push_back (node);
293305 }
@@ -303,12 +315,14 @@ class OrbitGraphProcessor {
303315
304316 for (size_t i = 1 ; i < num_components; ++i) {
305317 if (out_new_subgraphs[i].size () != first_sg_size) {
318+ error = true ;
306319 return false ;
307320 }
308321
309322 Constr_Graph_t current_sg;
310323 create_induced_subgraph (original_dag, current_sg, out_new_subgraphs[i]);
311324 if (!are_isomorphic_by_merkle_hash (rep_sg, current_sg)) {
325+ error = true ;
312326 return false ;
313327 }
314328 }
0 commit comments