diff -r ae69f556b429 -r cb26a6250401 src/lemon/dijkstra.h --- a/src/lemon/dijkstra.h Sun Mar 06 21:13:24 2005 +0000 +++ b/src/lemon/dijkstra.h Sun Mar 06 21:20:49 2005 +0000 @@ -729,6 +729,9 @@ typedef DijkstraDefaultTraits Base; protected: + /// Type of the nodes in the graph. + typedef typename Base::Graph::Node Node; + /// Pointer to the underlying graph. void *_g; /// Pointer to the length map @@ -740,10 +743,7 @@ ///Pointer to the map of distances. void *_dist; ///Pointer to the source node. - void *_source; - - /// Type of the nodes in the graph. - typedef typename Base::Graph::Node Node; + Node _source; public: /// Constructor. @@ -751,7 +751,7 @@ /// This constructor does not require parameters, therefore it initiates /// all of the attributes to default values (0, INVALID). DijkstraWizardBase() : _g(0), _length(0), _pred(0), _predNode(0), - _dist(0), _source(0) {} + _dist(0), _source(INVALID) {} /// Constructor. @@ -763,7 +763,7 @@ /// \param s is the initial value of \ref _source DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) : _g((void *)&g), _length((void *)&l), _pred(0), _predNode(0), - _dist(0), _source((s==INVALID)?0:(void *)&s) {} + _dist(0), _source(s) {} }; @@ -840,13 +840,13 @@ ///The node can be given by the \ref source function. void run() { - if(Base::_source==0) throw UninitializedParameter(); + if(Base::_source==INVALID) throw UninitializedParameter(); Dijkstra Dij(*(Graph*)Base::_g,*(LengthMap*)Base::_length); if(Base::_pred) Dij.predMap(*(PredMap*)Base::_pred); if(Base::_predNode) Dij.predNodeMap(*(PredNodeMap*)Base::_predNode); if(Base::_dist) Dij.distMap(*(DistMap*)Base::_dist); - Dij.run(*(Node*)Base::_source); + Dij.run(Base::_source); } ///Runs Dijkstra algorithm from the given node. @@ -855,7 +855,7 @@ ///\param s is the given source. void run(Node s) { - Base::_source=(void *)&s; + Base::_source=s; run(); } @@ -926,7 +926,7 @@ /// \param s is the source node. DijkstraWizard &source(Node s) { - Base::_source=(void *)&s; + Base::_source=s; return *this; }