# HG changeset patch # User marci # Date 1095156564 0 # Node ID cc3867a7d380cd43697a85c9445d60d504e9f819 # Parent e38108b464c5dee2a131d5a26e78b055ddc3c220 diff -r e38108b464c5 -r cc3867a7d380 src/hugo/graph_wrapper.h --- a/src/hugo/graph_wrapper.h Tue Sep 14 09:53:57 2004 +0000 +++ b/src/hugo/graph_wrapper.h Tue Sep 14 10:09:24 2004 +0000 @@ -229,6 +229,9 @@ public: NodeMap(const GraphWrapper& gw) : Parent(*(gw.graph)) { } NodeMap(const GraphWrapper& gw, T a) : Parent(*(gw.graph), a) { } +// NodeMap(const NodeMap& map) : Parent(map) { } +// template +// NodeMap(const Map& map) : Parent(map) { } }; template class EdgeMap : public Graph::template EdgeMap { @@ -236,6 +239,9 @@ public: EdgeMap(const GraphWrapper& gw) : Parent(*(gw.graph)) { } EdgeMap(const GraphWrapper& gw, T a) : Parent(*(gw.graph), a) { } +// EdgeMap(const EdgeMap& map) : Parent(map) { } +// template +// EdgeMap(const Map& map) : Parent(map) { } }; }; diff -r e38108b464c5 -r cc3867a7d380 src/hugo/preflow.h --- a/src/hugo/preflow.h Tue Sep 14 09:53:57 2004 +0000 +++ b/src/hugo/preflow.h Tue Sep 14 10:09:24 2004 +0000 @@ -344,7 +344,7 @@ ///Sets \c M to the characteristic vector of a minimum value ///cut. This method can be called both after running \ref ///phase1 and \ref phase2. It is much faster after - ///\ref phase1. \pre M should be a node map of bools. \pre + ///\ref phase1. \pre M should be a bool-valued node-map. \pre ///If \ref mincut is called after \ref phase2 then M should ///be initialized to false. template diff -r e38108b464c5 -r cc3867a7d380 src/test/graph_wrapper_test.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/graph_wrapper_test.cc Tue Sep 14 10:09:24 2004 +0000 @@ -0,0 +1,138 @@ +#include +#include +#include +#include +#include +#include + +#include"test_tools.h" +#include"graph_test.h" + +/** +\file +This test makes consistency checks of list graph structures. + +G.addNode(), G.addEdge(), G.tail(), G.head() + +\todo Checks for empty graphs and isolated points. +conversion. +*/ + +using namespace hugo; + +template void bidirPetersen(Graph &G) +{ + typedef typename Graph::Edge Edge; + typedef typename Graph::EdgeIt EdgeIt; + + checkGraphEdgeList(G,15); + + std::vector ee; + + for(EdgeIt e(G);e!=INVALID;++e) ee.push_back(e); + + for(typename std::vector::iterator p=ee.begin();p!=ee.end();p++) + G.addEdge(G.head(*p),G.tail(*p)); +} + +template void checkPetersen(Graph &G) +{ + typedef typename Graph::Node Node; + + typedef typename Graph::EdgeIt EdgeIt; + typedef typename Graph::NodeIt NodeIt; + + checkGraphNodeList(G,10); + checkGraphEdgeList(G,30); + + for(NodeIt n(G);n!=INVALID;++n) { + checkGraphInEdgeList(G,n,3); + checkGraphOutEdgeList(G,n,3); + ++n; + } +} + +//Compile GraphSkeleton +template void checkCompileStaticGraph +(skeleton::StaticGraphSkeleton &); + +template void checkCompileGraph +(skeleton::GraphSkeleton &); + +template void checkCompileErasableGraph +(skeleton::ErasableGraphSkeleton &); + +//Compile SmartGraph +typedef SmartGraph Graph; +typedef GraphWrapper GW; +template void checkCompileStaticGraph(GW &); +//template void checkCompileGraphFindEdge(SmartGraph &); + +//Compile SymSmartGraph +typedef RevGraphWrapper RevGW; +template void checkCompileStaticGraph(RevGW &); +//template void checkCompileGraphFindEdge(SymSmartGraph &); + +// //Compile ListGraph +// template void checkCompileGraph(ListGraph &); +// template void checkCompileErasableGraph(ListGraph &); +// template void checkCompileGraphFindEdge(ListGraph &); + + +// //Compile SymListGraph +// template void checkCompileGraph(SymListGraph &); +// template void checkCompileErasableGraph(SymListGraph &); +// template void checkCompileGraphFindEdge(SymListGraph &); + +// //Compile FullGraph +// template void checkCompileStaticGraph(FullGraph &); +// template void checkCompileGraphFindEdge(FullGraph &); + +// //Compile EdgeSet +// template void checkCompileGraph >(EdgeSet &); +// template void checkCompileGraphEraseEdge > +// (EdgeSet &); +// template void checkCompileGraphFindEdge > +// (EdgeSet &); + +// //Compile EdgeSet +// template void checkCompileGraph >(EdgeSet &); +// template void checkCompileGraphEraseEdge > +// (EdgeSet &); +// template void checkCompileGraphFindEdge > +// (EdgeSet &); + + +int main() +{ + // { +// SmartGraph G; +// addPetersen(G); +// bidirPetersen(G); +// checkPetersen(G); +// } +// { +// ListGraph G; +// addPetersen(G); +// bidirPetersen(G); +// checkPetersen(G); +// } +// { +// SymSmartGraph G; +// addPetersen(G); +// checkPetersen(G); +// } +// { +// SymListGraph G; +// addPetersen(G); +// checkPetersen(G); +// } + + ///\file + ///\todo map tests. + ///\todo copy constr tests. + + std::cout << __FILE__ ": All tests passed.\n"; + + return 0; +} diff -r e38108b464c5 -r cc3867a7d380 src/work/marci/graph_wrapper_time.cc --- a/src/work/marci/graph_wrapper_time.cc Tue Sep 14 09:53:57 2004 +0000 +++ b/src/work/marci/graph_wrapper_time.cc Tue Sep 14 10:09:24 2004 +0000 @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -32,9 +32,9 @@ Timer ts; ts.reset(); - typedef MaxFlow MyMaxFlow; - MyMaxFlow max_flow(g, s, t, cap, flow); - max_flow.run(MyMaxFlow::NO_FLOW); + typedef Preflow MyPreflow; + MyPreflow max_flow(g, s, t, cap, flow); + max_flow.run(MyPreflow::NO_FLOW); cout << "flow value: " << max_flow.flowValue() << endl; cout << ts << endl; } diff -r e38108b464c5 -r cc3867a7d380 src/work/marci/max_flow_demo.cc --- a/src/work/marci/max_flow_demo.cc Tue Sep 14 09:53:57 2004 +0000 +++ b/src/work/marci/max_flow_demo.cc Tue Sep 14 10:09:24 2004 +0000 @@ -12,7 +12,7 @@ #include #include //#include -#include +#include #include //#include #include @@ -38,7 +38,7 @@ readDimacs(std::cin, g, cap, s, t); Timer ts; Graph::EdgeMap flow(g); //0 flow - MaxFlow, Graph::EdgeMap > + Preflow, Graph::EdgeMap > max_flow_test(g, s, t, cap, flow); AugmentingFlow, Graph::EdgeMap > augmenting_flow_test(g, s, t, cap, flow); @@ -51,7 +51,7 @@ max_flow_test.run(); std::cout << "elapsed time: " << ts << std::endl; std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl; - max_flow_test.actMinCut(cut); + max_flow_test.minCut(cut); FOR_EACH_LOC(Graph::EdgeIt, e, g) { if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) @@ -65,7 +65,7 @@ std::cout << "preflow ..." << std::endl; FOR_EACH_LOC(Graph::EdgeIt, e, g) flow.set(e, 0); ts.reset(); - max_flow_test.preflow(MaxFlow, Graph::EdgeMap >::GEN_FLOW); + max_flow_test.preflow(Preflow, Graph::EdgeMap >::GEN_FLOW); std::cout << "elapsed time: " << ts << std::endl; std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;