lemon/dijkstra.h
changeset 335 160bf92c7cdc
parent 247 f1158744a112
child 258 0310c8984732
equal deleted inserted replaced
8:bfe0119660b7 9:9fea0dc09835
  1066 
  1066 
  1067     //Pointer to the digraph the algorithm runs on.
  1067     //Pointer to the digraph the algorithm runs on.
  1068     void *_g;
  1068     void *_g;
  1069     //Pointer to the length map
  1069     //Pointer to the length map
  1070     void *_length;
  1070     void *_length;
       
  1071     //Pointer to the map of processed nodes.
       
  1072     void *_processed;
  1071     //Pointer to the map of predecessors arcs.
  1073     //Pointer to the map of predecessors arcs.
  1072     void *_pred;
  1074     void *_pred;
  1073     //Pointer to the map of distances.
  1075     //Pointer to the map of distances.
  1074     void *_dist;
  1076     void *_dist;
  1075     //Pointer to the source node.
  1077     //Pointer to the source node.
  1078   public:
  1080   public:
  1079     /// Constructor.
  1081     /// Constructor.
  1080 
  1082 
  1081     /// This constructor does not require parameters, therefore it initiates
  1083     /// This constructor does not require parameters, therefore it initiates
  1082     /// all of the attributes to default values (0, INVALID).
  1084     /// all of the attributes to default values (0, INVALID).
  1083     DijkstraWizardBase() : _g(0), _length(0), _pred(0),
  1085     DijkstraWizardBase() : _g(0), _length(0), _processed(0), _pred(0),
  1084                            _dist(0), _source(INVALID) {}
  1086                            _dist(0), _source(INVALID) {}
  1085 
  1087 
  1086     /// Constructor.
  1088     /// Constructor.
  1087 
  1089 
  1088     /// This constructor requires some parameters,
  1090     /// This constructor requires some parameters,
  1092     /// \param l The length map.
  1094     /// \param l The length map.
  1093     /// \param s The source node.
  1095     /// \param s The source node.
  1094     DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
  1096     DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
  1095       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
  1097       _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
  1096       _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
  1098       _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
  1097       _pred(0), _dist(0), _source(s) {}
  1099       _processed(0), _pred(0), _dist(0), _source(s) {}
  1098 
  1100 
  1099   };
  1101   };
  1100 
  1102 
  1101   /// Auxiliary class for the function type interface of Dijkstra algorithm.
  1103   /// Auxiliary class for the function type interface of Dijkstra algorithm.
  1102 
  1104 
  1171     {
  1173     {
  1172       if(Base::_source==INVALID) throw UninitializedParameter();
  1174       if(Base::_source==INVALID) throw UninitializedParameter();
  1173       Dijkstra<Digraph,LengthMap,TR>
  1175       Dijkstra<Digraph,LengthMap,TR>
  1174         dij(*reinterpret_cast<const Digraph*>(Base::_g),
  1176         dij(*reinterpret_cast<const Digraph*>(Base::_g),
  1175             *reinterpret_cast<const LengthMap*>(Base::_length));
  1177             *reinterpret_cast<const LengthMap*>(Base::_length));
  1176       if(Base::_pred) dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
  1178       if(Base::_processed)
  1177       if(Base::_dist) dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
  1179         dij.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
       
  1180       if(Base::_pred)
       
  1181         dij.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
       
  1182       if(Base::_dist)
       
  1183         dij.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
  1178       dij.run(Base::_source);
  1184       dij.run(Base::_source);
  1179     }
  1185     }
  1180 
  1186 
  1181     ///Runs Dijkstra algorithm from the given node.
  1187     ///Runs Dijkstra algorithm from the given node.
  1182 
  1188