#include <lemon/smart_graph.h>
#include <lemon/lgf_reader.h>
#include <lemon/gomory_hu.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();
GomoryHu<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");
for(GomoryHu<Graph>::MinCutEdgeIt a(ght, u, v);a!=INVALID;++a)
check(sum == ght.minCutValue(u, v), "Problem with MinCutEdgeIt");
for(GomoryHu<Graph>::MinCutNodeIt n(ght, u, v,true);n!=INVALID;++n)
for(GomoryHu<Graph>::MinCutNodeIt n(ght, u, v,false);n!=INVALID;++n)
check(sum == countNodes(graph), "Problem with MinCutNodeIt");