# HG changeset patch # User deba # Date 1113075532 0 # Node ID 13a863ce81d97760dbd734d3f4306c9a3c766d64 # Parent 84979b9b8939136cee9cc795f824e6cfd16df5e4 Obsolte test removed. diff -r 84979b9b8939 -r 13a863ce81d9 src/test/dijkstra_heap_test.cc --- a/src/test/dijkstra_heap_test.cc Sat Apr 09 19:36:46 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +0,0 @@ -/* -*- C++ -*- - * src/test/dijkstra_heap_test.cc - Part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Combinatorial Optimization Research Group, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -//Tests dijsktra.h with two heap implementations: -//the default binary heap of bin_heap.h, and the -//Fibonacci heap of fib_heap.h. - -//The input is a graph in standard dimacs format from the standard input (like -//in /lemon_loc/testfiles/dimacs). It runs dijkstra.h on this graph with both -//heaps, checking two postconditions: - -//- if the edges e=uv of the shortest path tree reported by dijkstra.h have -//dist(v)-dist(u)=length(e) - -// - if all edges e=uv with u reachable from the root have -//dist(v)-dist(u)>=length(e) -#include -#include - -#include - -#include -#include - - -#include -#include -#include -#include - -#include -#include -#include - -using namespace lemon; - -typedef ListGraph Graph; - -typedef Graph::Edge Edge; -typedef Graph::Node Node; -typedef Graph::EdgeIt EdgeIt; -typedef Graph::NodeIt NodeIt; -typedef Graph::EdgeMap LengthMap; - - -struct FibTraits : public DijkstraDefaultTraits { - typedef FibHeap > Heap; -}; - -struct RadixTraits : public DijkstraDefaultTraits { - typedef RadixHeap > Heap; -}; - - -int main(int argc, const char* argv[]) { - - - Graph graph; - Node s, t; - LengthMap cap(graph); - readDimacs(std::cin, graph, cap, s, t); - Timer ts; - - GraphWriter writer(std::cout, graph); - - IdMap nodeIdMap(graph); - writer.addNodeMap("id", nodeIdMap); - - IdMap edgeIdMap(graph); - writer.addEdgeMap("id", edgeIdMap); - - writer.addEdgeMap("cap", cap); - - writer.run(); - - std::cout << - "\n Testing dijkstra.h with binary heap implementation bin_heap.h," - < - dijkstra_test(graph, cap); - ts.reset(); - dijkstra_test.run(s); - std::cout << "elapsed time: " << ts << std::endl; - - int error1=0; - int error2=0; - - for(EdgeIt e(graph); e!=INVALID; ++e) { - Node u=graph.source(e); - Node v=graph.target(e); - if ( dijkstra_test.dist(v) - dijkstra_test.dist(u) > cap[e] ) - if ( dijkstra_test.reached(u) ) { - std::cout<<"Error! dist(target)-dist(source)- edge_length= " - < - dijkstra_test2(graph, cap); - ts.reset(); - dijkstra_test2.run(s); - std::cout << "elapsed time: " << ts << std::endl; - - error1=0; - error2=0; - - for(EdgeIt e(graph); e!=INVALID; ++e) { - Node u=graph.source(e); - Node v=graph.target(e); - if ( dijkstra_test2.dist(v) - dijkstra_test2.dist(u) > cap[e] ) - if ( dijkstra_test2.reached(u) ) { - std::cout<<"Error! dist(target)-dist(source)- edge_length= " - < - dijkstra_test3(graph, cap); - ts.reset(); - dijkstra_test3.run(s); - std::cout << "elapsed time: " << ts << std::endl; - - - error1=0; - error2=0; - - for(EdgeIt e(graph); e!=INVALID; ++e) { - Node u=graph.source(e); - Node v=graph.target(e); - if ( dijkstra_test3.dist(v) - dijkstra_test3.dist(u) > cap[e] ) - if ( dijkstra_test3.reached(u) ) { - std::cout<<"Error! dist(target)-dist(source)- edge_length= " - <