lemon/dijkstra.h
changeset 273 5d12d5c80ac9
parent 257 8d76a7bf9961
parent 251 a1ffc9099c25
child 278 931190050520
child 280 e7f8647ce760
equal deleted inserted replaced
10:53ef945287f7 11:909a8392b2ee
  1065 
  1065 
  1066     //Pointer to the digraph the algorithm runs on.
  1066     //Pointer to the digraph the algorithm runs on.
  1067     void *_g;
  1067     void *_g;
  1068     //Pointer to the length map
  1068     //Pointer to the length map
  1069     void *_length;
  1069     void *_length;
       
  1070     //Pointer to the map of processed nodes.
       
  1071     void *_processed;
  1070     //Pointer to the map of predecessors arcs.
  1072     //Pointer to the map of predecessors arcs.
  1071     void *_pred;
  1073     void *_pred;
  1072     //Pointer to the map of distances.
  1074     //Pointer to the map of distances.
  1073     void *_dist;
  1075     void *_dist;
  1074     //Pointer to the source node.
  1076     //Pointer to the source node.
  1077   public:
  1079   public:
  1078     /// Constructor.
  1080     /// Constructor.
  1079 
  1081 
  1080     /// This constructor does not require parameters, therefore it initiates
  1082     /// This constructor does not require parameters, therefore it initiates
  1081     /// all of the attributes to default values (0, INVALID).
  1083     /// 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),
  1083                            _dist(0), _source(INVALID) {}
  1085                            _dist(0), _source(INVALID) {}
  1084 
  1086 
  1085     /// Constructor.
  1087     /// Constructor.
  1086 
  1088 
  1087     /// This constructor requires some parameters,
  1089     /// This constructor requires some parameters,
  1091     /// \param l The length map.
  1093     /// \param l The length map.
  1092     /// \param s The source node.
  1094     /// \param s The source node.
  1093     DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
  1095     DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
  1094       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
  1096       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
  1095       _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
  1097       _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
  1096       _pred(0), _dist(0), _source(s) {}
  1098       _processed(0), _pred(0), _dist(0), _source(s) {}
  1097 
  1099 
  1098   };
  1100   };
  1099 
  1101 
  1100   /// Auxiliary class for the function type interface of Dijkstra algorithm.
  1102   /// Auxiliary class for the function type interface of Dijkstra algorithm.
  1101 
  1103 
  1170     {
  1172     {
  1171       if(Base::_source==INVALID) throw UninitializedParameter();
  1173       if(Base::_source==INVALID) throw UninitializedParameter();
  1172       Dijkstra<Digraph,LengthMap,TR>
  1174       Dijkstra<Digraph,LengthMap,TR>
  1173         dij(*reinterpret_cast<const Digraph*>(Base::_g),
  1175         dij(*reinterpret_cast<const Digraph*>(Base::_g),
  1174             *reinterpret_cast<const LengthMap*>(Base::_length));
  1176             *reinterpret_cast<const LengthMap*>(Base::_length));
  1175       if(Base::_pred) dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
  1177       if(Base::_processed)
  1176       if(Base::_dist) dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
  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));
  1177       dij.run(Base::_source);
  1183       dij.run(Base::_source);
  1178     }
  1184     }
  1179 
  1185 
  1180     ///Runs Dijkstra algorithm from the given node.
  1186     ///Runs Dijkstra algorithm from the given node.
  1181 
  1187