Skip to content

Commit 430a531

Browse files
committed
allow edge swaps even when the graph is already 100% RNG conform
1 parent 05fa8f3 commit 430a531

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cpp/deglib/include/builder.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,14 @@ class EvenRegularGraphBuilder {
13531353
success |= improveEdges(vertex1, vertex2, neighbor_weights[edge_idx]);
13541354
}
13551355

1356+
// 1.3 if no noneRNG edge was improved, try to improve the RNG edges
1357+
for (size_t edge_idx = 0; success == false && edge_idx < edges_per_vertex; edge_idx++) {
1358+
const auto vertex2 = neighbor_indices[edge_idx];
1359+
if(graph.hasEdge(vertex1, vertex2) && deglib::analysis::checkRNG(graph, edges_per_vertex, vertex2, vertex1, neighbor_weights[edge_idx]))
1360+
if(improveEdges(vertex1, vertex2, neighbor_weights[edge_idx]))
1361+
success = true;
1362+
}
1363+
13561364
return success;
13571365
}
13581366

0 commit comments

Comments
 (0)