Easy input-output function for common graphs.
Modified Exception handling in graph_reader.
6 //I did with g++ ver 3.0.4, suse 8.0
7 //If the template is removed from NodeMap, then it works well.
16 template <typename T> class NodeMap {
19 NodeMap(const ListGraph& _G) : G(_G) { }
24 template<typename Graph> class GraphWrapper {
28 GraphWrapper(Graph& _graph) : graph(&_graph) { }
30 template<typename T> class NodeMap : public Graph::template NodeMap<T> {
31 typedef typename Graph::template NodeMap<T> Parent;
33 NodeMap(const GraphWrapper<Graph>& _G) :
34 Parent(*(_G.graph)) { }
38 template<typename Graph>
39 class ResGraphWrapper : public GraphWrapper<Graph> {
41 ResGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { }
44 template <typename Graph> class MaxFlow {
46 typedef ResGraphWrapper<const Graph> ResGW;
48 MaxFlow(const Graph& _g) : g(&_g) { }
49 void augmentOnShortestPath() {
51 typename ResGW::template NodeMap<int> pred(res_graph);
55 int main(int, char **) {
57 MaxFlow<ListGraph> max_flow_test(G);
58 max_flow_test.augmentOnShortestPath();