[Lemon-commits] Alpar Juttner: Merge bugfix #474 to branch 1.3

Lemon HG hg at lemon.cs.elte.hu
Mon Jul 7 15:59:21 CEST 2014


details:   http://lemon.cs.elte.hu/hg/lemon/rev/11de70cf8550
changeset: 1319:11de70cf8550
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Mon Jul 07 15:58:07 2014 +0200
description:
	Merge bugfix #474 to branch 1.3

diffstat:

 lemon/network_simplex.h    |  2 +-
 test/min_cost_flow_test.cc |  6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diffs (28 lines):

diff --git a/lemon/network_simplex.h b/lemon/network_simplex.h
--- a/lemon/network_simplex.h
+++ b/lemon/network_simplex.h
@@ -936,7 +936,7 @@
       for (NodeIt n(_graph); n != INVALID; ++n, ++i) {
         _node_id[n] = i;
       }
-      if (_arc_mixing) {
+      if (_arc_mixing && _node_num > 1) {
         // Store the arcs in a mixed order
         const int skip = std::max(_arc_num / _node_num, 3);
         int i = 0, j = 0;
diff --git a/test/min_cost_flow_test.cc b/test/min_cost_flow_test.cc
--- a/test/min_cost_flow_test.cc
+++ b/test/min_cost_flow_test.cc
@@ -395,6 +395,12 @@
   mcf3.upperMap(neg2_u);
   checkMcf(mcf3, mcf3.run(param), neg2_gr, neg2_l, neg2_u, neg2_c, neg2_s,
            mcf3.OPTIMAL, true,     -300, test_str + "-18", GEQ);
+
+  // Tests for empty graph
+  Digraph gr0;
+  MCF mcf0(gr0);
+  mcf0.run(param);
+  check(mcf0.totalCost() == 0, "Wrong total cost");  
 }
 
 template < typename MCF, typename Param >


More information about the Lemon-commits mailing list