COIN-OR::LEMON - Graph Library

Changeset 643:293551ad254f in lemon for test/gomory_hu_test.cc


Ignore:
Timestamp:
04/15/09 09:37:51 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Improvements and fixes for the minimum cut algorithms (#264)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/gomory_hu_test.cc

    r593 r643  
    33#include "test_tools.h"
    44#include <lemon/smart_graph.h>
     5#include <lemon/concepts/graph.h>
     6#include <lemon/concepts/maps.h>
    57#include <lemon/lgf_reader.h>
    68#include <lemon/gomory_hu.h>
     
    3335  "target 3\n";
    3436 
     37void checkGomoryHuCompile()
     38{
     39  typedef int Value;
     40  typedef concepts::Graph Graph;
     41
     42  typedef Graph::Node Node;
     43  typedef Graph::Edge Edge;
     44  typedef concepts::ReadMap<Edge, Value> CapMap;
     45  typedef concepts::ReadWriteMap<Node, bool> CutMap;
     46
     47  Graph g;
     48  Node n;
     49  CapMap cap;
     50  CutMap cut;
     51  Value v;
     52  int d;
     53
     54  GomoryHu<Graph, CapMap> gh_test(g, cap);
     55  const GomoryHu<Graph, CapMap>&
     56    const_gh_test = gh_test;
     57
     58  gh_test.run();
     59
     60  n = const_gh_test.predNode(n);
     61  v = const_gh_test.predValue(n);
     62  d = const_gh_test.rootDist(n);
     63  v = const_gh_test.minCutValue(n, n);
     64  v = const_gh_test.minCutMap(n, n, cut);
     65}
     66
    3567GRAPH_TYPEDEFS(Graph);
    3668typedef Graph::EdgeMap<int> IntEdgeMap;
     
    71103      ght.minCutMap(u, v, cm);
    72104      check(pf.flowValue() == ght.minCutValue(u, v), "Wrong cut 1");
    73       check(cm[u] != cm[v], "Wrong cut 3");
    74       check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 2");
     105      check(cm[u] != cm[v], "Wrong cut 2");
     106      check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 3");
    75107
    76108      int sum=0;
     
    85117        sum++;
    86118      check(sum == countNodes(graph), "Problem with MinCutNodeIt");
    87      
    88119    }
    89120  }
Note: See TracChangeset for help on using the changeset viewer.