1.1 --- a/src/work/athos/dijkstra_at.h Sun Apr 17 18:57:22 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,123 +0,0 @@
1.4 -/*
1.5 -Egy pontból összes többibe vezető legrövidebb utak irányított gráfban
1.6 -
1.7 -Preconditions:
1.8 -A gráf típus tud:
1.9 -- pontból kimenő éleket sorban visszaadni
1.10 -A T számtípus, ami tud összehasonlítást, összedást
1.11 -A bemenetre:
1.12 -weight nemnegatív
1.13 -
1.14 -*/
1.15 -#ifndef DIJKSTRA_AT_H
1.16 -#define DIJKSTRA_AT_H
1.17 -
1.18 -
1.19 -
1.20 -//#include <algorithm>
1.21 -//#include <deque>
1.22 -//#include <vector>
1.23 -//#include "pf_hiba.hh"
1.24 -//#include <marci_list_graph.hh>
1.25 -//#include <marci_graph_traits.hh>
1.26 -
1.27 -
1.28 -using namespace std;
1.29 -
1.30 -namespace lemon {
1.31 -
1.32 - template <typename graph_type, typename T>
1.33 - class dijkstra_at {
1.34 -
1.35 - //Hasznos typedef-ek
1.36 - typedef typename graph_type::NodeIt NodeIt;
1.37 - typedef typename graph_type::EdgeIt EdgeIt;
1.38 - typedef typename graph_type::EachNodeIt EachNodeIt;
1.39 - typedef typename graph_type::EachEdgeIt EachEdgeIt;
1.40 - typedef typename graph_type::OutEdgeIt OutEdgeIt;
1.41 - typedef typename graph_type::InEdgeIt InEdgeIt;
1.42 - typedef typename graph_type::SymEdgeIt SymEdgeIt;
1.43 -
1.44 -
1.45 -
1.46 - //---------------------------------------------
1.47 - //Parameters of the algorithm
1.48 - //---------------------------------------------
1.49 -
1.50 - //---------------------------------------------
1.51 - //Parameters of the algorithm
1.52 - //---------------------------------------------
1.53 -
1.54 - private:
1.55 - //input
1.56 - graph_type& G;
1.57 - NodeIt s;
1.58 - typename graph_type::EdgeMap<T> &weight;
1.59 - //typename graph_type::EdgeMap<T> &capacity;
1.60 - //output
1.61 - //typename graph_type::EdgeMap<T>
1.62 - // typename graph_type::EdgeMap<T> preflow;
1.63 -
1.64 - //auxiliary variables for computation
1.65 - deque<NodeIt> next_to_reach;
1.66 -
1.67 -
1.68 - typename graph_type::NodeMap<bool> reached;
1.69 -
1.70 - //Variables holding output
1.71 - //Predessors in the shortest paths arborescence
1.72 - typename graph_type::NodeMap<NodeIt> pred;
1.73 -
1.74 -
1.75 - public:
1.76 -
1.77 -
1.78 - dijkstra_at(
1.79 - graph_type& _G,
1.80 - NodeIt _s,
1.81 - typename graph_type::EdgeMap<T> & _weight)
1.82 - : G(_G), s(_s),
1.83 - weight(_weight),
1.84 - next_to_reach(),
1.85 - reached(_G),
1.86 - pred(G)
1.87 -
1.88 - {
1.89 - }
1.90 - /*By Misi.*/
1.91 - struct Node_dist_comp
1.92 - {
1.93 - NodeMap<graph_type, T> &d;
1.94 - Node_dist_comp(NodeMap<graph_type, T> &_d) : d(_d) {}
1.95 -
1.96 - bool operator()(const NodeIt& u, const NodeIt& v) const
1.97 - { return d.get(u) < d.get(v); }
1.98 - };
1.99 -
1.100 -
1.101 -
1.102 - void run() {
1.103 -
1.104 - NodeMap<graph_type, bool> scanned(G, false);
1.105 - std::priority_queue<NodeIt, vector<NodeIt>, Node_dist_comp>
1.106 - heap(( Node_dist_comp(distance) ));
1.107 -
1.108 - heap.push(s);
1.109 - reached.set(s, true);
1.110 -
1.111 - }
1.112 -
1.113 -
1.114 - };
1.115 -
1.116 -
1.117 -
1.118 -
1.119 -
1.120 -
1.121 - }; //class dijkstra_at
1.122 -
1.123 -
1.124 -}//namespace lemon
1.125 -
1.126 -#endif //DIJKSTRA_AT