Changeset 1710:f531c16dd923 in lemon0.x for lemon/belmann_ford.h
 Timestamp:
 10/06/05 11:37:53 (15 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2237
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/belmann_ford.h
r1699 r1710 168 168 /// \author Balazs Dezso 169 169 170 #ifdef DOXYGEN 171 template <typename _Graph, typename _LengthMap, typename _Traits> 172 #else 170 173 template <typename _Graph=ListGraph, 171 174 typename _LengthMap=typename _Graph::template EdgeMap<int>, 172 175 typename _Traits=BelmannFordDefaultTraits<_Graph,_LengthMap> > 176 #endif 173 177 class BelmannFord { 174 178 public: … … 234 238 public : 235 239 240 typedef BelmannFord Create; 241 236 242 /// \name Named template parameters 237 243 … … 241 247 struct DefPredMapTraits : public Traits { 242 248 typedef T PredMap; 243 static PredMap *createPredMap(const Graph& graph) {249 static PredMap *createPredMap(const Graph&) { 244 250 throw UninitializedParameter(); 245 251 } … … 251 257 /// 252 258 template <class T> 253 class DefPredMap 254 : public BelmannFord< Graph, LengthMap, DefPredMapTraits<T> > {}; 259 struct DefPredMap { 260 typedef BelmannFord< Graph, LengthMap, DefPredMapTraits<T> > Create; 261 }; 255 262 256 263 template <class T> … … 268 275 /// 269 276 template <class T> 270 class DefDistMap 271 : public BelmannFord< Graph, LengthMap, DefDistMapTraits<T> > {}; 277 struct DefDistMap 278 : public BelmannFord< Graph, LengthMap, DefDistMapTraits<T> > { 279 typedef BelmannFord< Graph, LengthMap, DefDistMapTraits<T> > Create; 280 }; 272 281 273 282 template <class T> … … 279 288 /// OperationTraits type 280 289 /// 281 /// \ref namedtemplparam "Named parameter" for setting PredMap type 290 /// \ref namedtemplparam "Named parameter" for setting OperationTraits 291 /// type 282 292 template <class T> 283 classDefOperationTraits293 struct DefOperationTraits 284 294 : public BelmannFord< Graph, LengthMap, DefOperationTraitsTraits<T> > { 285 public:286 295 typedef BelmannFord< Graph, LengthMap, DefOperationTraitsTraits<T> > 287 BelmannFord;296 Create; 288 297 }; 289 298 290 299 ///@} 300 301 protected: 302 303 BelmannFord() {} 291 304 292 305 public: … … 363 376 /// 364 377 /// Initializes the internal data structures. 365 void init( ) {378 void init(const Value value = OperationTraits::infinity()) { 366 379 create_maps(); 367 380 for (NodeIt it(*graph); it != INVALID; ++it) { 368 381 _pred>set(it, INVALID); 369 _dist>set(it, OperationTraits::infinity());382 _dist>set(it, value); 370 383 } 371 384 } … … 741 754 return BelmannFordWizard<DefDistMapBase<T> >(*this); 742 755 } 756 757 template<class T> 758 struct DefOperationTraitsBase : public Base { 759 typedef T OperationTraits; 760 DefOperationTraitsBase(const _Traits &b) : _Traits(b) {} 761 }; 762 763 ///\brief \ref namedtemplparam "Named parameter" 764 ///function for setting OperationTraits type 765 /// 766 /// \ref namedtemplparam "Named parameter" 767 ///function for setting OperationTraits type 768 /// 769 template<class T> 770 BelmannFordWizard<DefOperationTraitsBase<T> > distMap() { 771 return BelmannFordWizard<DefDistMapBase<T> >(*this); 772 } 743 773 744 774 /// \brief Sets the source node, from which the BelmannFord algorithm runs.
Note: See TracChangeset
for help on using the changeset viewer.