Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History
00001 //========================================================================== 00002 // 00003 // bid_dijkstra.h 00004 // 00005 //========================================================================== 00006 // $Id: bid_dijkstra.h,v 1.3 2003/03/24 15:58:54 raitner Exp $ 00007 00008 #ifndef GTL_BID_DIJKSTRA_H 00009 #define GTL_BID_DIJKSTRA_H 00010 00011 #include <GTL/GTL.h> 00012 #include <GTL/graph.h> 00013 #include <GTL/node_map.h> 00014 #include <GTL/edge_map.h> 00015 #include <GTL/algorithm.h> 00016 00017 __GTL_BEGIN_NAMESPACE 00018 00035 class GTL_EXTERN bid_dijkstra : public algorithm 00036 { 00037 public: 00041 typedef list<node>::const_iterator shortest_path_node_iterator; 00042 00046 typedef list<edge>::const_iterator shortest_path_edge_iterator; 00047 00051 enum node_color {white, grey, black}; 00052 00060 bid_dijkstra(); 00061 00067 virtual ~bid_dijkstra(); 00068 00077 void source_target(const node& s, const node& t); 00078 00086 void weights(const edge_map<double>& weight); 00087 00099 void store_path(bool set); 00100 00119 virtual int check(graph& G); 00120 00135 int run(graph& G); 00136 00142 node source() const; 00143 00149 node target() const; 00150 00158 bool store_path() const; 00159 00165 bool reached() const; 00166 00173 double distance() const; 00174 00186 shortest_path_node_iterator shortest_path_nodes_begin(); 00187 00199 shortest_path_node_iterator shortest_path_nodes_end(); 00200 00212 shortest_path_edge_iterator shortest_path_edges_begin(); 00213 00225 shortest_path_edge_iterator shortest_path_edges_end(); 00226 00237 virtual void reset(); 00238 private: 00245 node s; 00246 00253 node t; 00254 00261 bool weights_set; 00262 00269 bool path_set; 00270 00277 edge_map<double> weight; 00278 00284 double dist; 00285 00291 bool reached_t; 00292 00298 node_map<edge> pred; 00299 00305 node_map<edge> succ; 00306 00312 node_map<int> source_mark; 00313 00319 node_map<int> target_mark; 00320 00326 node_map<double> source_dist; 00327 00333 node_map<double> target_dist; 00334 00344 list<node> shortest_path_node_list; 00345 00355 list<edge> shortest_path_edge_list; 00356 00361 void reset_algorithm(); 00362 00367 void init(graph& G); 00368 00377 void fill_node_edge_lists(const node& n); 00378 }; 00379 00380 __GTL_END_NAMESPACE 00381 00382 #endif // GTL_BID_DIJKSTRA_H 00383 00384 //-------------------------------------------------------------------------- 00385 // end of file 00386 //--------------------------------------------------------------------------
University of Passau - FMI - Theoretical Computer Science