Skip to content

docs: fix misleading min-cut comment in optimizer_exact - #51

Merged
MRyutaro merged 1 commit into
mainfrom
docs/fix-mincut-comment
Jun 14, 2026
Merged

MRyutaro merged 1 commit into
mainfrom
docs/fix-mincut-comment

Conversation

@MRyutaro

@MRyutaro MRyutaro commented Jun 14, 2026 •

Copy link
Copy Markdown
Owner

概要

optimizer_exact.py の min-cut 計算箇所のコメントが実装と食い違っていたため修正します。

  • コメント: Solve min-cut with Ford-Fulkerson.
  • 実装: flow_func=shortest_augmenting_path(L8 で import)

実際には Ford-Fulkerson ではなく shortest_augmenting_path を使っているため、コメントを実装に合わせました。

背景(#22 の調査結果)

#22「min-cut アルゴリズムを Edmonds-Karp → Ford-Fulkerson に変えるとどうなるか」の調査で、以下が判明しました。

  • 最適コスト(cut_value)には影響しない: 最大フロー最小カット定理により、正しいアルゴリズムなら最小カット値(=チェックポイント総コスト)は必ず一致する。
  • 分割(migrate/recompute の選択): 最小カットが同点で複数存在する場合に変わりうるが、総コストは同じ(コスト中立)。
  • 純粋な Ford-Fulkerson は非推奨: float 容量+np.inf エッジでは終了保証がなく遅化リスクがあり、そもそも networkx に ford_fulkerson は存在しない(削除済み)。

よって実装の変更はせず、この PR では誤ったコメントの修正のみを行います。

Close #22

🤖 Generated with Claude Code

The comment claimed Ford-Fulkerson, but the code actually uses
shortest_augmenting_path as the flow_func. Align the comment with
the implementation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MRyutaro
MRyutaro merged commit d710be4 into main Jun 14, 2026
2 checks passed
@MRyutaro
MRyutaro deleted the docs/fix-mincut-comment branch June 14, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

min-cut問題を解くアルゴリズムをEdmonds-KarpからFord-Fulkersonに変えるとどうなるのか調査する

1 participant