Opened 5 years ago

Closed 5 years ago

#7728 closed Bugs (fixed)

boykov_kolmogorov_max_flow does not always compute a max flow

Reported by: Alex Fix <afix@…> Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:


The BK flow algorithm is supposed to return a maximum flow, but sometimes pushes less flow than other flow algorithms (i.e., push_relabel_max_flow). This seems to happen more often with large graphs.

An example input is provided: running the test program with the graph in err.dat gives a BK flow of 100 but a Push-Relabel flow of 102. If you also examine the datastructures at the end of the BK flow, there are edges with positive residual capacity from nodes in the source/sink search trees to gray nodes, which should not happen.

The problem seems to be in the adopt subroutine. When a node becomes an orphan, all its neighbors need to become active. The patchfile provided fixes some conditionals to make sure that the correct nodes become active. With the changes, the BK flow algorithm gives the correct answer on the graph provided.

Note: this may be the same as bug #3468, but it's been open for 3 years, and it's unclear if it's the same issue. I did borrow my example file from that bug-report, as it was much smaller than the (rather large) graph that I initially found the problem for.

Attachments (3)

test-flow.cxx (1.3 KB) - added by Alex Fix <afix@…> 5 years ago.
err.dat (3.0 KB) - added by Alex Fix <afix@…> 5 years ago.
patchfile.patch (2.4 KB) - added by Alex Fix <afix@…> 5 years ago.

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by Alex Fix <afix@…>

Attachment: test-flow.cxx added

Changed 5 years ago by Alex Fix <afix@…>

Attachment: err.dat added

Changed 5 years ago by Alex Fix <afix@…>

Attachment: patchfile.patch added

comment:1 Changed 5 years ago by Jeremiah Willcock

Resolution: fixed
Status: newclosed

(In [81536]) Applied patch from #7728 to fix B-K max-flow bug; fixes #7728; fixes #3468

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jeremiah Willcock.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.