# HG changeset patch # User marci # Date 1079122291 0 # Node ID 96f647f568c718802dcd9eed6dca2f9faf14f4a7 # Parent 95f0c5f3fc70b4b58f6200087f84a1472a2c15e1 leda graph wrapper diff -r 95f0c5f3fc70 -r 96f647f568c7 src/work/marci/leda_bfs_dfs.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/leda_bfs_dfs.cc Fri Mar 12 20:11:31 2004 +0000 @@ -0,0 +1,329 @@ +// -*- c++ -*- +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +using namespace hugo; +using std::cout; +using std::endl; +using std::string; + +template +class EdgeNameMap { + Graph& graph; + NodeNameMap& node_name_map; +public: + EdgeNameMap(Graph& _graph, NodeNameMap& _node_name_map) : + graph(_graph), node_name_map(_node_name_map) { } + string get(typename Graph::Edge e) const { + return + (node_name_map.get(graph.tail(e))+"->"+node_name_map.get(graph.head(e))); + } +}; + +int main (int, char*[]) +{ + + + //typedef SmartGraph Graph; + //typedef ListGraph Graph; + typedef LedaGraph Graph; + + typedef Graph::Node Node; + typedef Graph::NodeIt NodeIt; + typedef Graph::Edge Edge; + typedef Graph::EdgeIt EdgeIt; + typedef Graph::OutEdgeIt OutEdgeIt; + typedef Graph::InEdgeIt InEdgeIt; + + + leda::graph g; + Graph G(g); + + Node s=G.addNode(); + Node v1=G.addNode(); + Node v2=G.addNode(); + Node v3=G.addNode(); + Node v4=G.addNode(); + Node t=G.addNode(); + + Graph::NodeMap node_name(G); + node_name.set(s, "s"); + node_name.set(v1, "v1"); + node_name.set(v2, "v2"); + node_name.set(v3, "v3"); + node_name.set(v4, "v4"); + node_name.set(t, "t"); + + G.addEdge(s, v1); + G.addEdge(s, v2); + G.addEdge(v1, v2); + G.addEdge(v2, v1); + G.addEdge(v1, v3); + G.addEdge(v3, v2); + G.addEdge(v2, v4); + G.addEdge(v4, v3); + G.addEdge(v3, t); + G.addEdge(v4, t); + + cout << " /--> -------------> "<< endl; + cout << " / /-- v1 <-\\ /---- v3-\\ "<< endl; + cout << " / | | / /-> \\ "<< endl; + cout << " / | | / | ^ \\ "<< endl; + cout << "s | | / | | \\-> t "<< endl; + cout << " \\ | | / | | /-> "<< endl; + cout << " \\ | --/ / | | / "<< endl; + cout << " \\ \\-> v2 <--/ \\-- v4 -/ "<< endl; + cout << " \\--> -------------> "<< endl; + +// typedef TrivGraphWrapper CGW; +// CGW wG(G); + +// cout << "bfs and dfs demo on the directed graph" << endl; +// for(CGW::NodeIt n=wG.first(); n.valid(); ++n) { +// cout << n << ": "; +// cout << "out edges: "; +// for(CGW::OutEdgeIt e=wG.first(n); e.valid(); ++e) +// cout << e << " "; +// cout << "in edges: "; +// for(CGW::InEdgeIt e=wG.first(n); e.valid(); ++e) +// cout << e << " "; +// cout << endl; +// } + + { + typedef TrivGraphWrapper GW; + GW wG(G); + + EdgeNameMap< GW, Graph::NodeMap > edge_name(wG, node_name); + + cout << "bfs and dfs iterator demo on the directed graph" << endl; + for(GW::NodeIt n=wG.first(); wG.valid(n); wG.next(n)) { + cout << node_name.get(n) << ": "; + cout << "out edges: "; + for(GW::OutEdgeIt e=wG.first(n); wG.valid(e); wG.next(e)) + cout << edge_name.get(e) << " "; + cout << "in edges: "; + for(GW::InEdgeIt e=wG.first(n); wG.valid(e); wG.next(e)) + cout << edge_name.get(e) << " "; + cout << endl; + } + + cout << "bfs from s ..." << endl; + BfsIterator5< GW, GW::NodeMap > bfs(wG); + bfs.pushAndSetReached(s); + while (!bfs.finished()) { + //cout << "edge: "; + if (wG.valid(bfs)) { + cout << edge_name.get(bfs) << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(wG.aNode(bfs)) << + (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ node_name.get(wG.bNode(bfs)) << + (bfs.isBNodeNewlyReached() ? ": is newly reached." : + ": is not newly reached."); + } else { + cout << "invalid" << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(bfs.aNode()) << + (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ + "invalid."; + } + cout << endl; + ++bfs; + } + + cout << " /--> -------------> "<< endl; + cout << " / /-- v1 <-\\ /---- v3-\\ "<< endl; + cout << " / | | / /-> \\ "<< endl; + cout << " / | | / | ^ \\ "<< endl; + cout << "s | | / | | \\-> t "<< endl; + cout << " \\ | | / | | /-> "<< endl; + cout << " \\ | --/ / | | / "<< endl; + cout << " \\ \\-> v2 <--/ \\-- v4 -/ "<< endl; + cout << " \\--> -------------> "<< endl; + + cout << "dfs from s ..." << endl; + DfsIterator5< GW, GW::NodeMap > dfs(wG); + dfs.pushAndSetReached(s); + while (!dfs.finished()) { + ++dfs; + //cout << "edge: "; + if (wG.valid(dfs)) { + cout << edge_name.get(dfs) << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(wG.aNode(dfs)) << + (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ node_name.get(wG.bNode(dfs)) << + (dfs.isBNodeNewlyReached() ? ": is newly reached." : + ": is not newly reached."); + } else { + cout << "invalid" << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(dfs.aNode()) << + (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ + "invalid."; + } + cout << endl; + } + } + + + { + typedef RevGraphWrapper GW; + GW wG(G); + + EdgeNameMap< GW, Graph::NodeMap > edge_name(wG, node_name); + + cout << "bfs and dfs iterator demo on the reversed directed graph" << endl; + for(GW::NodeIt n=wG.first(); wG.valid(n); wG.next(n)) { + cout << node_name.get(n) << ": "; + cout << "out edges: "; + for(GW::OutEdgeIt e=wG.first(n); wG.valid(e); wG.next(e)) + cout << edge_name.get(e) << " "; + cout << "in edges: "; + for(GW::InEdgeIt e=wG.first(n); wG.valid(e); wG.next(e)) + cout << edge_name.get(e) << " "; + cout << endl; + } + + cout << "bfs from t ..." << endl; + BfsIterator5< GW, GW::NodeMap > bfs(wG); + bfs.pushAndSetReached(t); + while (!bfs.finished()) { + //cout << "edge: "; + if (wG.valid(bfs)) { + cout << edge_name.get(bfs) << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(wG.aNode(bfs)) << + (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ node_name.get(wG.bNode(bfs)) << + (bfs.isBNodeNewlyReached() ? ": is newly reached." : + ": is not newly reached."); + } else { + cout << "invalid" << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(bfs.aNode()) << + (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ + "invalid."; + } + cout << endl; + ++bfs; + } + + cout << " /--> -------------> "<< endl; + cout << " / /-- v1 <-\\ /---- v3-\\ "<< endl; + cout << " / | | / /-> \\ "<< endl; + cout << " / | | / | ^ \\ "<< endl; + cout << "s | | / | | \\-> t "<< endl; + cout << " \\ | | / | | /-> "<< endl; + cout << " \\ | --/ / | | / "<< endl; + cout << " \\ \\-> v2 <--/ \\-- v4 -/ "<< endl; + cout << " \\--> -------------> "<< endl; + + cout << "dfs from t ..." << endl; + DfsIterator5< GW, GW::NodeMap > dfs(wG); + dfs.pushAndSetReached(t); + while (!dfs.finished()) { + ++dfs; + //cout << "edge: "; + if (wG.valid(dfs)) { + cout << edge_name.get(dfs) << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(wG.aNode(dfs)) << + (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ node_name.get(wG.bNode(dfs)) << + (dfs.isBNodeNewlyReached() ? ": is newly reached." : + ": is not newly reached."); + } else { + cout << "invalid" << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(dfs.aNode()) << + (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ + "invalid."; + } + cout << endl; + } + } + + { + typedef UndirGraphWrapper GW; + GW wG(G); + + EdgeNameMap< GW, Graph::NodeMap > edge_name(wG, node_name); + + cout << "bfs and dfs iterator demo on the undirected graph" << endl; + for(GW::NodeIt n=wG.first(); wG.valid(n); wG.next(n)) { + cout << node_name.get(n) << ": "; + cout << "out edges: "; + for(GW::OutEdgeIt e=wG.first(n); wG.valid(e); wG.next(e)) + cout << edge_name.get(e) << " "; + cout << "in edges: "; + for(GW::InEdgeIt e=wG.first(n); wG.valid(e); wG.next(e)) + cout << edge_name.get(e) << " "; + cout << endl; + } + + cout << "bfs from t ..." << endl; + BfsIterator5< GW, GW::NodeMap > bfs(wG); + bfs.pushAndSetReached(t); + while (!bfs.finished()) { + //cout << "edge: "; + if (wG.valid(GW::OutEdgeIt(bfs))) { + cout << edge_name.get(GW::OutEdgeIt(bfs)) << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(wG.aNode(bfs)) << + (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ node_name.get(wG.bNode(bfs)) << + (bfs.isBNodeNewlyReached() ? ": is newly reached." : + ": is not newly reached."); + } else { + cout << "invalid" << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(bfs.aNode()) << + (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ + "invalid."; + } + cout << endl; + ++bfs; + } + + cout << " /--> -------------> "<< endl; + cout << " / /-- v1 <-\\ /---- v3-\\ "<< endl; + cout << " / | | / /-> \\ "<< endl; + cout << " / | | / | ^ \\ "<< endl; + cout << "s | | / | | \\-> t "<< endl; + cout << " \\ | | / | | /-> "<< endl; + cout << " \\ | --/ / | | / "<< endl; + cout << " \\ \\-> v2 <--/ \\-- v4 -/ "<< endl; + cout << " \\--> -------------> "<< endl; + + cout << "dfs from t ..." << endl; + DfsIterator5< GW, GW::NodeMap > dfs(wG); + dfs.pushAndSetReached(t); + while (!dfs.finished()) { + ++dfs; + //cout << "edge: "; + if (wG.valid(GW::OutEdgeIt(dfs))) { + cout << edge_name.get(GW::OutEdgeIt(dfs)) << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(wG.aNode(dfs)) << + (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ node_name.get(wG.bNode(dfs)) << + (dfs.isBNodeNewlyReached() ? ": is newly reached." : + ": is not newly reached."); + } else { + cout << "invalid" << /*endl*/", " << + /*" aNode: " <<*/ node_name.get(dfs.aNode()) << + (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << + /*" bNode: " <<*/ + "invalid."; + } + cout << endl; + } + } + + return 0; +} diff -r 95f0c5f3fc70 -r 96f647f568c7 src/work/marci/leda_graph.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/leda_graph.h Fri Mar 12 20:11:31 2004 +0000 @@ -0,0 +1,314 @@ +// -*- c++ -*- +#ifndef HUGO_LEDA_GRAPH_H +#define HUGO_LEDA_GRAPH_H + +#include +#include +#include +//#include +//#include + +//#if defined(LEDA_NAMESPACE) +//using namespace leda; +//#endif + +#include + +/// The namespace of HugoLib +namespace hugo { + + // @defgroup empty_graph The LedaGraph class + // @{ + + /// An empty graph class. + + /// This class provides all the common features of a grapf structure, + /// however completely without implementations or real data structures + /// behind the interface. + /// All graph algorithms should compile with this class, but it will not + /// run properly, of course. + /// + /// It can be used for checking the interface compatibility, + /// or it can serve as a skeleton of a new graph structure. + /// + /// Also, you will find here the full documentation of a certain graph + /// feature, the documentation of a real graph imlementation + /// like @ref ListGraph or + /// @ref SmartGraph will just refer to this structure. + template + class LedaGraph + { + Graph* _graph; + public: + + //LedaGraph() { } + LedaGraph(Graph& __graph) : _graph(&__graph) { } + LedaGraph(const LedaGraph &G) : _graph(G._graph) { } + + template class NodeMap; + template class EdgeMap; + + /// The base type of the node iterators. + class Node { + friend class LedaGraph; + //friend class Edge; + friend class EdgeIt; + friend class InEdgeIt; + friend class OutEdgeIt; + protected: + template friend class NodeMap; + leda_node _n; + Node(leda_node __n) : _n(__n) { } + public: + /// @warning The default constructor sets the iterator + /// to an undefined value. + Node() {} //FIXME + /// Initialize the iterator to be invalid + Node(Invalid) : _n(0) { } + //Node(const Node &) {} + bool operator==(Node n) const { return _n==n._n; } //FIXME + bool operator!=(Node n) const { return _n!=n._n; } //FIXME + }; + + /// This iterator goes through each node. + class NodeIt : public Node { + public: + /// @warning The default constructor sets the iterator + /// to an undefined value. + NodeIt() {} //FIXME + /// Initialize the iterator to be invalid + NodeIt(Invalid i) : Node(i) {} + /// Sets the iterator to the first node of \c G. + NodeIt(const LedaGraph &G) : Node(G._graph->first_node()) { } + //NodeIt(const NodeIt &) {} //FIXME + }; + + /// The base type of the edge iterators. + class Edge { + friend class LedaGraph; + protected: + template friend class EdgeMap; + leda_edge _e; + Edge(leda_edge __e) : _e(__e) { } + public: + /// @warning The default constructor sets the iterator + /// to an undefined value. + Edge() {} //FIXME + /// Initialize the iterator to be invalid + Edge(Invalid) : _e(0) {} + //Edge(const Edge &) {} + bool operator==(Edge e) const { return _e==e._e; } //FIXME + bool operator!=(Edge e) const { return _e!=e._e; } //FIXME + }; + + /// This iterator goes trought the outgoing edges of a certain graph. + + class OutEdgeIt : public Edge { + public: + /// @warning The default constructor sets the iterator + /// to an undefined value. + OutEdgeIt() {} + /// Initialize the iterator to be invalid + OutEdgeIt(Invalid i) : Edge(i) {} + /// This constructor sets the iterator to first outgoing edge. + + /// This constructor set the iterator to the first outgoing edge of + /// node + ///@param n the node + ///@param G the graph + OutEdgeIt(const LedaGraph & G, Node n) : Edge(G._graph->first_adj_edge(n._n)) { } + }; + + class InEdgeIt : public Edge { + public: + /// @warning The default constructor sets the iterator + /// to an undefined value. + InEdgeIt() {} + /// Initialize the iterator to be invalid + InEdgeIt(Invalid i) : Edge(i) {} + InEdgeIt(const LedaGraph & G, Node n) : Edge(G._graph->first_in_edge(n._n)) { } + }; + + // class SymEdgeIt : public Edge {}; + class EdgeIt : public Edge { + public: + /// @warning The default constructor sets the iterator + /// to an undefined value. + EdgeIt() {} + /// Initialize the iterator to be invalid + EdgeIt(Invalid i) : Edge(i) {} + EdgeIt(const LedaGraph & G) : Edge(G._graph->first_edge()) { } + }; + + /// First node of the graph. + + /// \post \c i and the return value will be the first node. + /// + NodeIt &first(NodeIt &i) const { i=NodeIt(*this); return i; } + + /// The first outgoing edge. + InEdgeIt &first(InEdgeIt &i, Node n) const { + i=InEdgeIt(*this, n); + return i; + } + /// The first incoming edge. + OutEdgeIt &first(OutEdgeIt &i, Node n) const { + i=OutEdgeIt(*this, n); + return i; + } + // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;} + /// The first edge of the Graph. + EdgeIt &first(EdgeIt &i) const { + i=EdgeIt(*this); + return i; } + +// Node getNext(Node) const {} +// InEdgeIt getNext(InEdgeIt) const {} +// OutEdgeIt getNext(OutEdgeIt) const {} +// //SymEdgeIt getNext(SymEdgeIt) const {} +// EdgeIt getNext(EdgeIt) const {} + + /// Go to the next node. + NodeIt &next(NodeIt &i) const { + i._n=_graph->succ_node(i._n); + return i; + } + /// Go to the next incoming edge. + InEdgeIt &next(InEdgeIt &i) const { + i._e=_graph->in_succ(i._e); + return i; + } + /// Go to the next outgoing edge. + OutEdgeIt &next(OutEdgeIt &i) const { + i._e=_graph->adj_succ(i._e); + return i; + } + //SymEdgeIt &next(SymEdgeIt &) const {} + /// Go to the next edge. + EdgeIt &next(EdgeIt &i) const { + i._e=_graph->succ_edge(i._e); + return i; + } + + template< typename It > + It first() const { + It e; + first(e); + return e; + } + + template< typename It > + It first(Node v) const { + It e; + first(e, v); + return e; + } + + ///Gives back the head node of an edge. + Node head(Edge e) const { + return Node(_graph->target(e._e)); + } + ///Gives back the tail node of an edge. + Node tail(Edge e) const { + return Node(_graph->source(e._e)); + } + + Node aNode(InEdgeIt e) const { return head(e); } + Node aNode(OutEdgeIt e) const { return tail(e); } + // Node aNode(SymEdgeIt) const {} + + Node bNode(InEdgeIt e) const { return tail(e); } + Node bNode(OutEdgeIt e) const { return head(e); } + // Node bNode(SymEdgeIt) const {} + + /// Checks if a node iterator is valid + bool valid(Node n) const { return n._n; } + /// Checks if an edge iterator is valid + bool valid(Edge e) const { return e._e; } + + ///Gives back the \e id of a node. + int id(Node n) const { return n._n->id(); } + ///Gives back the \e id of an edge. + int id(Edge e) const { return e._e->id(); } + + //void setInvalid(Node &) const {}; + //void setInvalid(Edge &) const {}; + + Node addNode() const { return Node(_graph->new_node()); } + Edge addEdge(Node tail, Node head) const { + return Edge(_graph->new_edge(tail._n, head._n)); + } + + void erase(Node n) const { _graph->del_node(n._n); } + void erase(Edge e) const { _graph->del_edge(e._e); } + + void clear() const { _graph->clear(); } + + int nodeNum() const { return _graph->number_of_nodes(); } + int edgeNum() const { return _graph->number_of_edges(); } + + ///Read/write map from the nodes to type \c T. + template class NodeMap + { + leda_node_map leda_stuff; + public: + typedef T ValueType; + typedef Node KeyType; + + NodeMap(const LedaGraph &G) : leda_stuff(*(G._graph)) {} + NodeMap(const LedaGraph &G, T t) : leda_stuff(*(G._graph), t) {} + + void set(Node i, T t) { leda_stuff[i._n]=t; } + T get(Node i) const { return leda_stuff[i._n]; } //FIXME: Is it necessary + T &operator[](Node i) { return leda_stuff[i._n]; } + const T &operator[](Node i) const { return leda_stuff[i._n]; } + + void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ } + //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G._graph)*/, a); } //FIXME: Is it necessary + }; + + ///Read/write map from the edges to type \c T. + template class EdgeMap + { + leda_edge_map leda_stuff; + public: + typedef T ValueType; + typedef Edge KeyType; + + EdgeMap(const LedaGraph &G) : leda_stuff(*(G._graph)) {} + EdgeMap(const LedaGraph &G, T t) : leda_stuff(*(G._graph), t) {} + + void set(Edge i, T t) { leda_stuff[i._e]=t; } + T get(Edge i) const { return leda_stuff[i._e]; } //FIXME: Is it necessary + T &operator[](Edge i) { return leda_stuff[i._e]; } + const T &operator[](Edge i) const { return leda_stuff[i._e]; } + + void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ } + //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G._graph)*/, a); } //FIXME: Is it necessary + }; + + }; + + // @} + +} //namespace hugo + + + +// class EmptyBipGraph : public EmptyGraph +// { +// class ANode {}; +// class BNode {}; + +// ANode &next(ANode &) {} +// BNode &next(BNode &) {} + +// ANode &getFirst(ANode &) const {} +// BNode &getFirst(BNode &) const {} + +// enum NodeClass { A = 0, B = 1 }; +// NodeClass getClass(Node n) {} + +// } + +#endif // HUGO_LEDA_GRAPH_H diff -r 95f0c5f3fc70 -r 96f647f568c7 src/work/marci/leda_graph_demo.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/marci/leda_graph_demo.cc Fri Mar 12 20:11:31 2004 +0000 @@ -0,0 +1,85 @@ +// -*- c++ -*- +#include +#include + +#include +#include +#include +#include +#include + +using namespace hugo; + +using std::cout; +using std::endl; + +int main() { + leda::graph g; + typedef LedaGraph Graph; + Graph G(g); +// G.addNode(); +// G.addNode(); +// std::cout << G.nodeNum() << std::endl; + + typedef Graph::Node Node; + typedef Graph::NodeIt NodeIt; + typedef Graph::Edge Edge; + typedef Graph::EdgeIt EdgeIt; + typedef Graph::OutEdgeIt OutEdgeIt; + typedef Graph::InEdgeIt InEdgeIt; + + Node s, t; + Graph::EdgeMap cap(G); + readDimacsMaxFlow(std::cin, G, s, t, cap); + + +// cout << "bfs and dfs iterator demo on the directed graph" << endl; +// for(NodeIt n=G.first(); G.valid(n); G.next(n)) { +// cout << G.id(n) << ": "; +// cout << "out edges: "; +// for(OutEdgeIt e=G.first(n); G.valid(e); G.next(e)) +// cout << G.id(G.tail(e)) << "-" << cap.get(e) << "->" << G.id(G.head(e)) << " "; +// cout << "in edges: "; +// for(InEdgeIt e=G.first(n); G.valid(e); G.next(e)) +// cout << G.id(G.tail(e)) << "-" << cap.get(e) << "->" << G.id(G.head(e)) << " "; +// cout << endl; +// } + +// int i=0; +// for(EdgeIt e=G.first(); G.valid(e); G.next(e)) { cap.set(e, i); i+=3; } +// for(EdgeIt e=G.first(); G.valid(e); G.next(e)) { cout << cap.get(e) << " "; } +// cout << endl; + + { + //std::cout << "SmartGraph..." << std::endl; + std::cout << "on-the-fly edmonds karp demo on wrapped leda graph..." << std::endl; + Graph::EdgeMap flow(G); //0 flow + + + Timer ts; + ts.reset(); + + MaxFlow, Graph::EdgeMap > max_flow_test(G, s, t, flow, cap); + //max_flow_test.augmentWithBlockingFlow(); + int i=0; + while (max_flow_test.augmentOnShortestPath()) { +// for(EdgeIt e=G.template first(); e.valid(); ++e) { +// std::cout<<"("<"<(); e.valid(); ++e) { +// std::cout<<"("<"<