src/lemon/dijkstra.h
changeset 1162 2f51fccbc261
parent 1155 fe0fcdb5687b
child 1164 80bb73097736
equal deleted inserted replaced
6:d4e2334ec6c1 7:9f86f6095883
    85     ///
    85     ///
    86     typedef NullMap<typename Graph::Node,typename Graph::Node> PredNodeMap;
    86     typedef NullMap<typename Graph::Node,typename Graph::Node> PredNodeMap;
    87     ///Instantiates a PredNodeMap.
    87     ///Instantiates a PredNodeMap.
    88     
    88     
    89     ///This function instantiates a \ref PredNodeMap. 
    89     ///This function instantiates a \ref PredNodeMap. 
    90     ///\param G is the graph, to which we would like to define the \ref PredNodeMap
    90     ///\param G is the graph, to which
       
    91     ///we would like to define the \ref PredNodeMap
    91     static PredNodeMap *createPredNodeMap(const GR &G)
    92     static PredNodeMap *createPredNodeMap(const GR &G)
    92     {
    93     {
    93       return new PredNodeMap();
    94       return new PredNodeMap();
    94     }
    95     }
    95 
    96 
   102     ///\todo named parameter to set this type, function to read and write.
   103     ///\todo named parameter to set this type, function to read and write.
   103     typedef NullMap<typename Graph::Node,bool> ReachedMap;
   104     typedef NullMap<typename Graph::Node,bool> ReachedMap;
   104     ///Instantiates a ReachedMap.
   105     ///Instantiates a ReachedMap.
   105  
   106  
   106     ///This function instantiates a \ref ReachedMap. 
   107     ///This function instantiates a \ref ReachedMap. 
   107     ///\param G is the graph, to which we would like to define the \ref ReachedMap
   108     ///\param G is the graph, to which
       
   109     ///we would like to define the \ref ReachedMap
   108     static ReachedMap *createReachedMap(const GR &G)
   110     static ReachedMap *createReachedMap(const GR &G)
   109     {
   111     {
   110       return new ReachedMap();
   112       return new ReachedMap();
   111     }
   113     }
   112     ///The type of the map that stores the dists of the nodes.
   114     ///The type of the map that stores the dists of the nodes.
   453     }
   455     }
   454 
   456 
   455   public:
   457   public:
   456     ///\name Excetution control
   458     ///\name Excetution control
   457     ///The simplest way to execute the algorithm is to use
   459     ///The simplest way to execute the algorithm is to use
   458     ///\ref run().
   460     ///one of the member functions called \c run(...).
   459     ///\n
   461     ///\n
   460     ///It you need more control on the execution,
   462     ///It you need more control on the execution,
   461     ///first you must call \ref init(), then you can add several source nodes
   463     ///first you must call \ref init(), then you can add several source nodes
   462     ///with \ref addSource(). Finally \ref start() will perform the actual path
   464     ///with \ref addSource(). Finally \ref start() will perform the actual path
   463     ///computation.
   465     ///computation.
   751     DijkstraWizardBase() : _g(0), _length(0), _pred(0), _predNode(0),
   753     DijkstraWizardBase() : _g(0), _length(0), _pred(0), _predNode(0),
   752 		       _dist(0), _source(INVALID) {}
   754 		       _dist(0), _source(INVALID) {}
   753 
   755 
   754     /// Constructor.
   756     /// Constructor.
   755     
   757     
   756     /// This constructor requires some parameters, listed in the parameters list.
   758     /// This constructor requires some parameters,
       
   759     /// listed in the parameters list.
   757     /// Others are initiated to 0.
   760     /// Others are initiated to 0.
   758     /// \param g is the initial value of  \ref _g
   761     /// \param g is the initial value of  \ref _g
   759     /// \param l is the initial value of  \ref _length
   762     /// \param l is the initial value of  \ref _length
   760     /// \param s is the initial value of  \ref _source
   763     /// \param s is the initial value of  \ref _source
   761     DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
   764     DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
   860       typedef T PredMap;
   863       typedef T PredMap;
   861       static PredMap *createPredMap(const Graph &G) { return 0; };
   864       static PredMap *createPredMap(const Graph &G) { return 0; };
   862       DefPredMapBase(const Base &b) : Base(b) {}
   865       DefPredMapBase(const Base &b) : Base(b) {}
   863     };
   866     };
   864     
   867     
   865     /// \ref named-templ-param "Named parameter" function for setting PredMap type
   868     ///\brief \ref named-templ-param "Named parameter"
   866 
   869     ///function for setting PredMap type
   867     /// \ref named-templ-param "Named parameter" function for setting PredMap type
   870     ///
       
   871     /// \ref named-templ-param "Named parameter"
       
   872     ///function for setting PredMap type
   868     ///
   873     ///
   869     template<class T>
   874     template<class T>
   870     DijkstraWizard<DefPredMapBase<T> > predMap(const T &t) 
   875     DijkstraWizard<DefPredMapBase<T> > predMap(const T &t) 
   871     {
   876     {
   872       _pred=(void *)&t;
   877       _pred=(void *)&t;
   879       typedef T PredNodeMap;
   884       typedef T PredNodeMap;
   880       static PredNodeMap *createPredNodeMap(const Graph &G) { return 0; };
   885       static PredNodeMap *createPredNodeMap(const Graph &G) { return 0; };
   881       DefPredNodeMapBase(const Base &b) : Base(b) {}
   886       DefPredNodeMapBase(const Base &b) : Base(b) {}
   882     };
   887     };
   883     
   888     
   884     /// \ref named-templ-param "Named parameter" function for setting PredNodeMap type
   889     ///\brief \ref named-templ-param "Named parameter"
   885 
   890     ///function for setting PredNodeMap type
   886     /// \ref named-templ-param "Named parameter" function for setting PredNodeMap type
   891     ///
       
   892     /// \ref named-templ-param "Named parameter"
       
   893     ///function for setting PredNodeMap type
   887     ///
   894     ///
   888     template<class T>
   895     template<class T>
   889     DijkstraWizard<DefPredNodeMapBase<T> > predNodeMap(const T &t) 
   896     DijkstraWizard<DefPredNodeMapBase<T> > predNodeMap(const T &t) 
   890     {
   897     {
   891       _predNode=(void *)&t;
   898       _predNode=(void *)&t;
   897       typedef T DistMap;
   904       typedef T DistMap;
   898       static DistMap *createDistMap(const Graph &G) { return 0; };
   905       static DistMap *createDistMap(const Graph &G) { return 0; };
   899       DefDistMapBase(const Base &b) : Base(b) {}
   906       DefDistMapBase(const Base &b) : Base(b) {}
   900     };
   907     };
   901     
   908     
   902     /// \ref named-templ-param "Named parameter" function for setting DistMap type
   909     ///\brief \ref named-templ-param "Named parameter"
   903 
   910     ///function for setting DistMap type
   904     /// \ref named-templ-param "Named parameter" function for setting DistMap type
   911     ///
       
   912     /// \ref named-templ-param "Named parameter"
       
   913     ///function for setting DistMap type
   905     ///
   914     ///
   906     template<class T>
   915     template<class T>
   907     DijkstraWizard<DefDistMapBase<T> > distMap(const T &t) 
   916     DijkstraWizard<DefDistMapBase<T> > distMap(const T &t) 
   908     {
   917     {
   909       _dist=(void *)&t;
   918       _dist=(void *)&t;