Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dijkstra.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file dijkstra.h
1 /* This software is distributed under the GNU Lesser General Public License */
2 //==========================================================================
3 //
4 // dijkstra.h
5 //
6 //==========================================================================
7 // $Id: dijkstra.h,v 1.8 2003/02/25 09:18:19 chris Exp $
8 
9 #ifndef GTL_DIJKSTRA_H
10 #define GTL_DIJKSTRA_H
11 
12 #include <GTL/GTL.h>
13 #include <GTL/graph.h>
14 #include <GTL/node_map.h>
15 #include <GTL/edge_map.h>
16 #include <GTL/algorithm.h>
17 
19 
31 {
32 public:
36  typedef list<node>::const_iterator shortest_path_node_iterator;
37 
41  typedef list<edge>::const_iterator shortest_path_edge_iterator;
42 
46  enum node_color {white, grey, black};
47 
55  dijkstra();
56 
62  virtual ~dijkstra();
63 
73  void source(const node& n);
74 
84  void target(const node& n);
85 
93  void weights(const edge_map<double>& weight);
94 
106  void store_preds(bool set);
107 
126  virtual int check(graph& G);
127 
142  int run(graph& G);
143 
149  node source() const;
150 
156  node target() const;
157 
165  bool store_preds() const;
166 
174  bool reached(const node& n) const;
175 
183  double distance(const node& n) const;
184 
202  node predecessor_node(const node& n) const;
203 
221  edge predecessor_edge(const node& n) const;
222 
237  shortest_path_node_iterator shortest_path_nodes_begin(const node& dest);
238 
253  shortest_path_node_iterator shortest_path_nodes_end(const node& dest);
254 
269  shortest_path_edge_iterator shortest_path_edges_begin(const node& dest);
270 
285  shortest_path_edge_iterator shortest_path_edges_end(const node& dest);
286 
297  virtual void reset();
298 private:
306 
314 
322 
329  bool preds_set;
330 
338 
347 
354 
363 
375 
387 
392  void reset_algorithm();
393 
398  void init(graph& G);
399 
405  void fill_node_list(const node& t);
406 
412  void fill_edge_list(const node& t);
413 };
414 
416 
417 #endif // GTL_DIJKSTRA_H
418 
419 //--------------------------------------------------------------------------
420 // end of file
421 //--------------------------------------------------------------------------