COIN-OR::LEMON - Graph Library

Changeset 258:0310c8984732 in lemon-1.2 for lemon/dijkstra.h


Ignore:
Timestamp:
09/09/08 21:52:45 (11 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
257:8d76a7bf9961 (diff), 256:c760d691fe3c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/dijkstra.h

    r251 r258  
    332332
    333333    template <class T>
    334     struct DefPredMapTraits : public Traits {
     334    struct SetPredMapTraits : public Traits {
    335335      typedef T PredMap;
    336336      static PredMap *createPredMap(const Digraph &)
     
    345345    ///\ref PredMap type.
    346346    template <class T>
    347     struct DefPredMap
    348       : public Dijkstra< Digraph, LengthMap, DefPredMapTraits<T> > {
    349       typedef Dijkstra< Digraph, LengthMap, DefPredMapTraits<T> > Create;
     347    struct SetPredMap
     348      : public Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > {
     349      typedef Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > Create;
    350350    };
    351351
    352352    template <class T>
    353     struct DefDistMapTraits : public Traits {
     353    struct SetDistMapTraits : public Traits {
    354354      typedef T DistMap;
    355355      static DistMap *createDistMap(const Digraph &)
     
    364364    ///\ref DistMap type.
    365365    template <class T>
    366     struct DefDistMap
    367       : public Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > {
    368       typedef Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > Create;
     366    struct SetDistMap
     367      : public Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > {
     368      typedef Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > Create;
    369369    };
    370370
    371371    template <class T>
    372     struct DefProcessedMapTraits : public Traits {
     372    struct SetProcessedMapTraits : public Traits {
    373373      typedef T ProcessedMap;
    374374      static ProcessedMap *createProcessedMap(const Digraph &)
     
    383383    ///\ref ProcessedMap type.
    384384    template <class T>
    385     struct DefProcessedMap
    386       : public Dijkstra< Digraph, LengthMap, DefProcessedMapTraits<T> > {
    387       typedef Dijkstra< Digraph, LengthMap, DefProcessedMapTraits<T> > Create;
    388     };
    389 
    390     struct DefDigraphProcessedMapTraits : public Traits {
     385    struct SetProcessedMap
     386      : public Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > {
     387      typedef Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > Create;
     388    };
     389
     390    struct SetStandardProcessedMapTraits : public Traits {
    391391      typedef typename Digraph::template NodeMap<bool> ProcessedMap;
    392392      static ProcessedMap *createProcessedMap(const Digraph &g)
     
    401401    ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>.
    402402    ///If you don't set it explicitly, it will be automatically allocated.
    403     template <class T>
    404     struct DefProcessedMapToBeDefaultMap
    405       : public Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> {
    406       typedef Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits>
     403    struct SetStandardProcessedMap
     404      : public Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits > {
     405      typedef Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits >
    407406      Create;
    408407    };
    409408
    410409    template <class H, class CR>
    411     struct DefHeapTraits : public Traits {
     410    struct SetHeapTraits : public Traits {
    412411      typedef CR HeapCrossRef;
    413412      typedef H Heap;
     
    426425    ///reference type.
    427426    template <class H, class CR = typename Digraph::template NodeMap<int> >
    428     struct DefHeap
    429       : public Dijkstra< Digraph, LengthMap, DefHeapTraits<H, CR> > {
    430       typedef Dijkstra< Digraph, LengthMap, DefHeapTraits<H, CR> > Create;
     427    struct SetHeap
     428      : public Dijkstra< Digraph, LengthMap, SetHeapTraits<H, CR> > {
     429      typedef Dijkstra< Digraph, LengthMap, SetHeapTraits<H, CR> > Create;
    431430    };
    432431
    433432    template <class H, class CR>
    434     struct DefStandardHeapTraits : public Traits {
     433    struct SetStandardHeapTraits : public Traits {
    435434      typedef CR HeapCrossRef;
    436435      typedef H Heap;
     
    451450    ///parameter and the heap's constructor waits for the cross reference.
    452451    template <class H, class CR = typename Digraph::template NodeMap<int> >
    453     struct DefStandardHeap
    454       : public Dijkstra< Digraph, LengthMap, DefStandardHeapTraits<H, CR> > {
    455       typedef Dijkstra< Digraph, LengthMap, DefStandardHeapTraits<H, CR> >
     452    struct SetStandardHeap
     453      : public Dijkstra< Digraph, LengthMap, SetStandardHeapTraits<H, CR> > {
     454      typedef Dijkstra< Digraph, LengthMap, SetStandardHeapTraits<H, CR> >
    456455      Create;
    457456    };
    458457
    459458    template <class T>
    460     struct DefOperationTraitsTraits : public Traits {
     459    struct SetOperationTraitsTraits : public Traits {
    461460      typedef T OperationTraits;
    462461    };
     
    468467    ///\ref OperationTraits type.
    469468    template <class T>
    470     struct DefOperationTraits
    471       : public Dijkstra<Digraph, LengthMap, DefOperationTraitsTraits<T> > {
    472       typedef Dijkstra<Digraph, LengthMap, DefOperationTraitsTraits<T> >
     469    struct SetOperationTraits
     470      : public Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> > {
     471      typedef Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> >
    473472      Create;
    474473    };
     
    12061205
    12071206    template<class T>
    1208     struct DefPredMapBase : public Base {
     1207    struct SetPredMapBase : public Base {
    12091208      typedef T PredMap;
    12101209      static PredMap *createPredMap(const Digraph &) { return 0; };
    1211       DefPredMapBase(const TR &b) : TR(b) {}
     1210      SetPredMapBase(const TR &b) : TR(b) {}
    12121211    };
    12131212    ///\brief \ref named-templ-param "Named parameter"
     
    12171216    ///for setting \ref PredMap object.
    12181217    template<class T>
    1219     DijkstraWizard<DefPredMapBase<T> > predMap(const T &t)
     1218    DijkstraWizard<SetPredMapBase<T> > predMap(const T &t)
    12201219    {
    12211220      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
    1222       return DijkstraWizard<DefPredMapBase<T> >(*this);
     1221      return DijkstraWizard<SetPredMapBase<T> >(*this);
    12231222    }
    12241223
    12251224    template<class T>
    1226     struct DefProcessedMapBase : public Base {
     1225    struct SetProcessedMapBase : public Base {
    12271226      typedef T ProcessedMap;
    12281227      static ProcessedMap *createProcessedMap(const Digraph &) { return 0; };
    1229       DefProcessedMapBase(const TR &b) : TR(b) {}
     1228      SetProcessedMapBase(const TR &b) : TR(b) {}
    12301229    };
    12311230    ///\brief \ref named-templ-param "Named parameter"
     
    12351234    ///for setting \ref ProcessedMap object.
    12361235    template<class T>
    1237     DijkstraWizard<DefProcessedMapBase<T> > processedMap(const T &t)
     1236    DijkstraWizard<SetProcessedMapBase<T> > processedMap(const T &t)
    12381237    {
    12391238      Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t));
    1240       return DijkstraWizard<DefProcessedMapBase<T> >(*this);
     1239      return DijkstraWizard<SetProcessedMapBase<T> >(*this);
    12411240    }
    12421241
    12431242    template<class T>
    1244     struct DefDistMapBase : public Base {
     1243    struct SetDistMapBase : public Base {
    12451244      typedef T DistMap;
    12461245      static DistMap *createDistMap(const Digraph &) { return 0; };
    1247       DefDistMapBase(const TR &b) : TR(b) {}
     1246      SetDistMapBase(const TR &b) : TR(b) {}
    12481247    };
    12491248    ///\brief \ref named-templ-param "Named parameter"
     
    12531252    ///for setting \ref DistMap object.
    12541253    template<class T>
    1255     DijkstraWizard<DefDistMapBase<T> > distMap(const T &t)
     1254    DijkstraWizard<SetDistMapBase<T> > distMap(const T &t)
    12561255    {
    12571256      Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
    1258       return DijkstraWizard<DefDistMapBase<T> >(*this);
     1257      return DijkstraWizard<SetDistMapBase<T> >(*this);
    12591258    }
    12601259
  • lemon/dijkstra.h

    r257 r258  
    10681068    //Pointer to the length map
    10691069    void *_length;
     1070    //Pointer to the map of processed nodes.
     1071    void *_processed;
    10701072    //Pointer to the map of predecessors arcs.
    10711073    void *_pred;
     
    10801082    /// This constructor does not require parameters, therefore it initiates
    10811083    /// all of the attributes to default values (0, INVALID).
    1082     DijkstraWizardBase() : _g(0), _length(0), _pred(0),
     1084    DijkstraWizardBase() : _g(0), _length(0), _processed(0), _pred(0),
    10831085                           _dist(0), _source(INVALID) {}
    10841086
     
    10941096      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
    10951097      _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
    1096       _pred(0), _dist(0), _source(s) {}
     1098      _processed(0), _pred(0), _dist(0), _source(s) {}
    10971099
    10981100  };
     
    11731175        dij(*reinterpret_cast<const Digraph*>(Base::_g),
    11741176            *reinterpret_cast<const LengthMap*>(Base::_length));
    1175       if(Base::_pred) dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
    1176       if(Base::_dist) dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
     1177      if(Base::_processed)
     1178        dij.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
     1179      if(Base::_pred)
     1180        dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
     1181      if(Base::_dist)
     1182        dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
    11771183      dij.run(Base::_source);
    11781184    }
Note: See TracChangeset for help on using the changeset viewer.