Changeset 352:4b89077ab715 in lemon0.x for src/work/johanna/kruskal.h
 Timestamp:
 04/17/04 23:50:48 (18 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@471
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/johanna/kruskal.h
r349 r352 38 38 } 39 39 40 /* A workaround for running Kruskal with constreference bool maps... */ 41 42 template<typename Map> 43 class NonConstMapWr { 44 const Map &m; 45 public: 46 typedef typename Map::ValueType ValueType; 47 48 NonConstMapWr(const Map &_m) : m(_m) {} 49 50 template<typename KeyType> 51 void set(KeyType const& k, ValueType const &v) const { m.set(k,v); } 52 }; 53 54 template <typename Graph, typename InputEdgeOrder, typename OutBoolMap> 55 inline 56 typename InputEdgeOrder::ValueType 57 Kruskal(Graph const& G, InputEdgeOrder const& edges, 58 OutBoolMap const& out_map) 59 { 60 NonConstMapWr<OutBoolMap> map_wr(out_map); 61 return Kruskal(G, edges, map_wr); 62 } 40 63 41 64 … … 50 73 template<typename Iterator> 51 74 class SequenceOutput { 52 Iterator it;75 mutable Iterator it; 53 76 54 77 public: … … 58 81 59 82 template<typename KeyType> 60 void set(KeyType const& k, bool v) { if(v) {*it=k; ++it;} }83 void set(KeyType const& k, bool v) const { if(v) {*it=k; ++it;} } 61 84 }; 62 85 … … 178 201 /// Input is from an EdgeMap, output is a plain boolmap. 179 202 template <typename Graph, typename EdgeCostMap, typename RetEdgeBoolMap> 203 inline 180 204 typename EdgeCostMap::ValueType 181 205 Kruskal_EdgeCostMapIn_BoolMapOut(Graph const& G, … … 194 218 /// Input is from an EdgeMap, output is to a sequence. 195 219 template <typename Graph, typename EdgeCostMap, typename RetIterator> 220 inline 196 221 typename EdgeCostMap::ValueType 197 222 Kruskal_EdgeCostMapIn_IteratorOut(Graph const& G,
Note: See TracChangeset
for help on using the changeset viewer.