Changeset 768:a5e9303a5511 in lemon-0.x for src/work/marci/max_bipartite_matching.h
- Timestamp:
- 08/23/04 13:06:00 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1031
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/max_bipartite_matching.h
r762 r768 60 60 // EdgeFlow* edge_flow; 61 61 // NodeFlow* node_flow; 62 typedef st GraphWrapper<Graph> stGW;62 typedef stBipartiteGraphWrapper<Graph> stGW; 63 63 stGW stgw; 64 64 typedef typename stGW::template EdgeMapWrapper<EdgeCap, NodeCap> CapMap; … … 67 67 typedef typename stGW::template EdgeMapWrapper<EdgeFlow, NodeFlow> FlowMap; 68 68 FlowMap flow; 69 MaxFlow<stGW, int, CapMap, FlowMap> mf; 69 typedef MaxFlow<stGW, int, CapMap, FlowMap> MaxFlow; 70 MaxFlow mf; 70 71 //graph* g; 71 72 //EdgeCap* edge_cap; 72 73 //EdgeFlow* edge_flow; 73 74 public: 75 enum MatchingEnum{ 76 ZERO_MATCHING, 77 GEN_MATCHING, 78 GEN_MATCHING_WITH_GOOD_NODE_FLOW, 79 NO_MATCHING 80 }; 74 81 /// For capacitated b-matchings, edge-caoacities and node-capacities 75 82 /// have to be given. After running \c run the matching is is given … … 99 106 ~MaxBipartiteMatching() { if (node_flow) delete node_flow; } 100 107 /// run computes the max matching. 101 void run() { mf.run(); } 108 void run(MatchingEnum me=ZERO_MATCHING) { 109 switch (me) { 110 case ZERO_MATCHING: 111 mf.run(MaxFlow::ZERO_FLOW); 112 break; 113 case GEN_MATCHING: 114 { 115 typename stGW::OutEdgeIt e; 116 for (stgw.first(e, stgw.S_NODE); stgw.valid(e); stgw.next(e)) 117 flow.set(e, cap[e]); 118 } 119 { 120 typename stGW::InEdgeIt e; 121 for (stgw.first(e, stgw.T_NODE); stgw.valid(e); stgw.next(e)) 122 flow.set(e, 0); 123 } 124 mf.run(MaxFlow::PRE_FLOW); 125 break; 126 case GEN_MATCHING_WITH_GOOD_NODE_FLOW: 127 mf.run(MaxFlow::GEN_FLOW); 128 break; 129 case NO_MATCHING: 130 mf.run(MaxFlow::NO_FLOW); 131 break; 132 } 133 } 102 134 /// The matching value after running \c run. 103 int matchingValue() { return mf.flowValue(); }135 int matchingValue() const { return mf.flowValue(); } 104 136 }; 105 137
Note: See TracChangeset
for help on using the changeset viewer.