# HG changeset patch # User jacint # Date 1078161874 0 # Node ID 01d47457aff3b950dc8534f3f7fb796e438f3ead # Parent a17d2a6462ee5c041e8cbec25fa6c8398b1dc1e4 nagytakaritas diff -r a17d2a6462ee -r 01d47457aff3 src/work/jacint/README_FLOW --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/jacint/README_FLOW Mon Mar 01 17:24:34 2004 +0000 @@ -0,0 +1,55 @@ + Heurisztikak: + +gap: ha egy 0 -#include - -#include -#include - - -namespace std { - namespace hugo { - - - - - - template - class dijkstra{ - typedef typename graph_traits::NodeIt NodeIt; - typedef typename graph_traits::EdgeIt EdgeIt; - typedef typename graph_traits::EachNodeIt EachNodeIt; - typedef typename graph_traits::InEdgeIt InEdgeIt; - typedef typename graph_traits::OutEdgeIt OutEdgeIt; - - - graph_type& G; - NodeIt s; - NodeMap predecessor; - NodeMap distance; - EdgeMap length; - NodeMap reached; - - public : - - /* - The distance of all the Nodes is 0. - */ - dijkstra(graph_type& _G, NodeIt _s, EdgeMap& _length) : - G(_G), s(_s), predecessor(G, 0), distance(G, 0), length(_length), reached(G, false) { } - - - - /*By Misi.*/ - struct Node_dist_comp - { - NodeMap &d; - Node_dist_comp(NodeMap &_d) : d(_d) {} - - bool operator()(const NodeIt& u, const NodeIt& v) const - { return d.get(u) < d.get(v); } - }; - - - - void run() { - - NodeMap scanned(G, false); - std::priority_queue, Node_dist_comp> - heap(( Node_dist_comp(distance) )); - - heap.push(s); - reached.put(s, true); - - while (!heap.empty()) { - - NodeIt v=heap.top(); - heap.pop(); - - - if (!scanned.get(v)) { - - for(OutEdgeIt e=G.template first(v); e.valid(); ++e) { - NodeIt w=G.head(e); - - if (!scanned.get(w)) { - if (!reached.get(w)) { - reached.put(w,true); - distance.put(w, distance.get(v)-length.get(e)); - predecessor.put(w,e); - } else if (distance.get(v)-length.get(e)>distance.get(w)) { - distance.put(w, distance.get(v)-length.get(e)); - predecessor.put(w,e); - } - - heap.push(w); - - } - - } - scanned.put(v,true); - - } // if (!scanned.get(v)) - - - - } // while (!heap.empty()) - - - } //void run() - - - - - - /* - *Returns the distance of the Node v. - *It is 0 for the root and for the Nodes not - *reachable form the root. - */ - T dist(NodeIt v) { - return -distance.get(v); - } - - - - /* - * Returns the last Edge of a shortest s-v path. - * Returns an invalid iterator if v=root or v is not - * reachable from the root. - */ - EdgeIt pred(NodeIt v) { - if (v!=s) { return predecessor.get(v);} - else {return EdgeIt();} - } - - - - bool reach(NodeIt v) { - return reached.get(v); - } - - - - - - - - - - };// class dijkstra - - - - } // namespace hugo -} -#endif //DIJKSTRA_HH - - diff -r a17d2a6462ee -r 01d47457aff3 src/work/jacint/makefile --- a/src/work/jacint/makefile Mon Mar 01 16:32:50 2004 +0000 +++ b/src/work/jacint/makefile Mon Mar 01 17:24:34 2004 +0000 @@ -3,44 +3,15 @@ CXXFLAGS = -W -Wall -ansi -pedantic LEDAROOT = /ledasrc/LEDA-4.1 -BINARIES = preflow_jgraph +BINARIES = preflow all: $(BINARIES) makefile: .depend sinclude .depend - - -preflow_jgraph: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_jgraph preflow_jgraph.cc - -preflowalpar: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../alpar -I../jacint -o preflowalpar preflowalpar.cc - -preflow_max_flow: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_max_flow preflow_max_flow.cc - preflow: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow preflow.cc - -preflow_hl0: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_hl0 preflow_hl0.cc - -preflow_hl1: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_hl1 preflow_hl1.cc - -preflow_hl2: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_hl2 preflow_hl2.cc - -preflow_hl3: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_hl3 preflow_hl3.cc - -preflow_hl4: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_hl4 preflow_hl4.cc - -preflow_param: - $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../jacint -o preflow_param preflow_param.cc + $(CXX3) $(CXXFLAGS) -O3 -I. -I.. -I../marci -o preflow preflow.cc clean: $(RM) *.o $(BINARIES) .depend