#include <lemon/smart_graph.h>
#include <lemon/adaptors.h>
#include <lemon/lgf_reader.h>
#include <lemon/lgf_writer.h>
#include <lemon/dimacs.h>
#include <lemon/time_measure.h>
#include <lemon/gomory_hu_tree.h>
typedef SmartGraph Graph;
typedef Graph::EdgeMap<int> IntEdgeMap;
typedef Graph::NodeMap<bool> BoolNodeMap;
int cutValue(const Graph& graph, const BoolNodeMap& cut,
const IntEdgeMap& capacity) {
for (EdgeIt e(graph); e != INVALID; ++e) {
IntEdgeMap capacity(graph);
std::istringstream input(test_lgf);
GraphReader<Graph>(graph, input).
edgeMap("capacity", capacity).run();
GomoryHuTree<Graph> ght(graph, capacity);
for (NodeIt u(graph); u != INVALID; ++u) {
for (NodeIt v(graph); v != u; ++v) {
Preflow<Graph, IntEdgeMap> pf(graph, capacity, u, v);
check(pf.flowValue() == ght.minCutValue(u, v), "Wrong cut 1");
check(cm[u] != cm[v], "Wrong cut 3");
check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 2");