COIN-OR::LEMON - Graph Library

Ticket #372: preflow_bug.cpp

File preflow_bug.cpp, 1.4 KB (added by Peter Kovacs, 10 years ago)
Line 
1#include <iostream>
2#include <lemon/smart_graph.h>
3#include <lemon/lgf_reader.h>
4#include <lemon/preflow.h>
5
6using namespace lemon;
7
8int main() {
9    SmartDigraph g;
10
11    SmartDigraph::ArcMap<int> cap(g);
12    SmartDigraph::NodeMap<int> lab(g);
13    SmartDigraph::Node s, t;
14
15    try {
16        digraphReader(g, "preflow_bug.lgf").
17            arcMap("capacity", cap).
18            nodeMap("label", lab).
19            run();
20    } catch (Exception& error) {
21        std::cerr << "Error: " << error.what() << std::endl;
22        return -1;
23    }
24
25    for (SmartDigraph::NodeIt nIt1(g); nIt1 != INVALID; ++nIt1)
26    {
27
28        std::cout <<
29        "Processing node: " << g.id(nIt1) << " label: " << lab[nIt1] << std::endl;
30
31        for (SmartDigraph::NodeIt nIt2(g); nIt2 != INVALID; ++nIt2)
32        {
33                std::cout <<
34                " processing node: " << g.id(nIt1) << " label: " << lab[nIt1] << " inner node:" << g.id(nIt2) << " label: " << lab[nIt2] << std::endl;
35
36                Preflow<SmartDigraph, SmartDigraph::ArcMap<int> > pf(g, cap, nIt1, nIt2);
37//                Preflow<SmartDigraph, SmartDigraph::ArcMap<int> >
38//                  ::SetStandardElevator<LinkedElevator<SmartDigraph, SmartDigraph::Node> >
39//                  ::Create pf(g, cap, nIt1, nIt2);
40
41                pf.run();
42        }
43
44    }
45
46    return 0;
47}