Skip to content

Commit

Permalink
fixed bug in max_flow() -- need to dereference $path to see if it's
Browse files Browse the repository at this point in the history
empty
  • Loading branch information
waltman committed Jul 20, 2007
1 parent 1460393 commit 6fb805a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions MaxFlow.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ use warnings;
# really edmonds-karp since I'm finding the shortest path from s to t
# each time
sub max_flow {
my $g = shift;
my ($g, $source, $sink) = @_;
my $result = $g->deep_copy_graph;

while (1) {
my $path = shortest_path($result, "s", "t");
while (my $path = shortest_path($result, $source, $sink)) {
last unless @$path;

print "path = @$path\n";
Expand Down

0 comments on commit 6fb805a

Please sign in to comment.