test/gomory_hu_test.cc
changeset 646 f63e87b9748e
parent 593 d6b40ebb2617
child 956 141f9c0db4a3
child 1081 f1398882a928
child 1171 7e368d9b67f7
     1.1 --- a/test/gomory_hu_test.cc	Sat Apr 18 21:54:30 2009 +0200
     1.2 +++ b/test/gomory_hu_test.cc	Tue Apr 21 10:34:49 2009 +0100
     1.3 @@ -2,6 +2,8 @@
     1.4  
     1.5  #include "test_tools.h"
     1.6  #include <lemon/smart_graph.h>
     1.7 +#include <lemon/concepts/graph.h>
     1.8 +#include <lemon/concepts/maps.h>
     1.9  #include <lemon/lgf_reader.h>
    1.10  #include <lemon/gomory_hu.h>
    1.11  #include <cstdlib>
    1.12 @@ -32,6 +34,36 @@
    1.13    "source 0\n"
    1.14    "target 3\n";
    1.15    
    1.16 +void checkGomoryHuCompile()
    1.17 +{
    1.18 +  typedef int Value;
    1.19 +  typedef concepts::Graph Graph;
    1.20 +
    1.21 +  typedef Graph::Node Node;
    1.22 +  typedef Graph::Edge Edge;
    1.23 +  typedef concepts::ReadMap<Edge, Value> CapMap;
    1.24 +  typedef concepts::ReadWriteMap<Node, bool> CutMap;
    1.25 +
    1.26 +  Graph g;
    1.27 +  Node n;
    1.28 +  CapMap cap;
    1.29 +  CutMap cut;
    1.30 +  Value v;
    1.31 +  int d;
    1.32 +
    1.33 +  GomoryHu<Graph, CapMap> gh_test(g, cap);
    1.34 +  const GomoryHu<Graph, CapMap>&
    1.35 +    const_gh_test = gh_test;
    1.36 +
    1.37 +  gh_test.run();
    1.38 +
    1.39 +  n = const_gh_test.predNode(n);
    1.40 +  v = const_gh_test.predValue(n);
    1.41 +  d = const_gh_test.rootDist(n);
    1.42 +  v = const_gh_test.minCutValue(n, n);
    1.43 +  v = const_gh_test.minCutMap(n, n, cut);
    1.44 +}
    1.45 +
    1.46  GRAPH_TYPEDEFS(Graph);
    1.47  typedef Graph::EdgeMap<int> IntEdgeMap;
    1.48  typedef Graph::NodeMap<bool> BoolNodeMap;
    1.49 @@ -70,8 +102,8 @@
    1.50        BoolNodeMap cm(graph);
    1.51        ght.minCutMap(u, v, cm);
    1.52        check(pf.flowValue() == ght.minCutValue(u, v), "Wrong cut 1");
    1.53 -      check(cm[u] != cm[v], "Wrong cut 3");
    1.54 -      check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 2");
    1.55 +      check(cm[u] != cm[v], "Wrong cut 2");
    1.56 +      check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 3");
    1.57  
    1.58        int sum=0;
    1.59        for(GomoryHu<Graph>::MinCutEdgeIt a(ght, u, v);a!=INVALID;++a)
    1.60 @@ -84,7 +116,6 @@
    1.61        for(GomoryHu<Graph>::MinCutNodeIt n(ght, u, v,false);n!=INVALID;++n)
    1.62          sum++;
    1.63        check(sum == countNodes(graph), "Problem with MinCutNodeIt");
    1.64 -      
    1.65      }
    1.66    }
    1.67