Repository navigation
Flow refinement: report no change when no flow problem can be built - #175
Merged
Merged
Conversation
When the region around a block pair covers a whole block, convert_ds builds no flow network and get_min_flow_max_cut returned the old cut with an empty list of rhs nodes. The caller read that as "every stripe node goes to lhs". With most balanced minimum cuts (strong, strongsocial, --most_balanced_flows), such a result was accepted whenever it improved the balance, so the whole rhs stripe moved to lhs while the stored cut of the pair stayed the old value. Now the solver returns all rhs stripe nodes, i.e. the unchanged partition.
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A one-place fix in the pairwise flow refinement (
cut_flow_problem_solver::get_min_flow_max_cut, 7 lines). When no flow network can be built for a block pair, the solver now reports "no change" instead of a result that moves the whole rhs stripe to lhs while the stored cut of the pair stays the old value.Output changes only where most balanced minimum cuts are on (
strong,strongsocial, or--most_balanced_flows), and there only rarely: 15 of 858strong/strongsocialjobs on our identity set, with no change of the cut in geometric mean. Every other preconfiguration gives bit-identical partitions.The bug
For a pair of adjacent blocks (lhs, rhs),
two_way_flow_refinementgrows a region (two stripes) around the boundary and callsget_min_flow_max_cut.convert_dsbuilds the flow network and returns false if one of the stripes has no outer boundary, i.e. the region covers a whole block, which happens for small blocks (large k, small graphs, a large flow region factor). In that case the solver returnedinitial_cutand leftnew_rhs_nodesempty.The caller reads
new_rhs_nodesas the set of stripe nodes that end up in rhs. An empty list therefore means "every stripe node goes to lhs", with the cut value reported as unchanged. Then:eco,fastsocial,ecosocial, the separator variants), the result is accepted only if its cut is smaller than the current one, whichinitial_cutnever is, so it is always undone and nothing changes;strong,strongsocial), the result is also accepted when it improves the balance of the pair and stays under the bound. Then the whole rhs stripe moves to lhs, andboundary.setEdgeCutstores the old cut for the pair, although the real cut changed.The fix
If
convert_dsbuilds no network, the solver returns every rhs stripe node innew_rhs_nodes, i.e. the unchanged partition, together withinitial_cut. The caller then sees "no change", keeps the partition, and its bookkeeping stays correct.fastnever reaches the flow code (it uses FM refinement only).ParHIP has its own copy of the library (
parallel/modified_kahip). Itsedge_cut_flow_solver::get_min_flow_max_cuthas the same early return (if(!do_something) return initial_cut;) and is not changed here.How often it fires, and what changes
Small set: 6 graphs (4elt, fe_body, luxembourg, PGPgiantcompo, email-EuAll, rgg_n_2_18) x k = 2, 8, 16, 64, 256 x seeds 1, 2, imbalance 3%, with a build that logs every case without a flow network:
So the case is common (mostly at k = 64 and 256), but only with most balanced minimum cuts does the broken result get accepted.
Identity set: the 537 benchmark jobs of #171 x seeds 1 to 3 at imbalance 3%, plus a crosscheck grid (the 6 graphs above x all six preconfigurations x k = 2, 8, 64, 256 x seeds 1 to 3 x imbalance 1, 3, 5%), 2907 runs, compared by sha256 of the partition file against v3.26 (master since then only has the link fix of 3.27):
The 19 differing runs (15 distinct jobs; a few jobs are both in the benchmark and in the grid) are on PGPgiantcompo, email-EuAll and fe_body at k = 32 to 256. Cut of the fix vs master on them: 11 smaller, 8 larger, geometric mean ratio 0.9991; over all
strongruns 0.99994, over allstrongsocialruns 1.00002. Every partition was checked by an independent checker (cut and block weights recomputed from the graph). Balance:strongunchanged;strongsocialloses one balanced run (fe_body k = 256, seed 1, imbalance 3%: cut 13371 over the bound instead of 13305 within it), and the other three differingstrongsocialruns at k = 256 are over the bound in master and with the fix alike.Node separators (
node_separator, all six preconfigurations on 4elt and PGPgiantcompo): bit identical to v3.26. kaffpaE uses the same kaffpa code in its operators, so it changes exactly where kaffpa does.Tests
-DNOMPI=ON) and with MPI (kaffpaE);interface_testruns;callkahipfrompython.py) was not run locally (no pybind11 on the test machine).