New version of XML reader/writer.
Now, there are only a single XmlIo class both for reading and writing.
8 #include <lemon/concept_check.h>
9 #include <lemon/concept/heap.h>
11 #include <lemon/smart_graph.h>
13 #include <lemon/graph_reader.h>
15 #include <lemon/bin_heap.h>
16 #include <lemon/fib_heap.h>
17 #include <lemon/radix_heap.h>
18 #include <lemon/linear_heap.h>
20 #include "test_tools.h"
22 #include "heap_test.h"
24 #include <lemon/time_measure.h>
26 using namespace lemon;
27 using namespace lemon::concept;
34 typedef IntIntMap ItemIntMap;
36 typedef ListGraph Graph;
38 typedef Graph::Edge Edge;
39 typedef Graph::Node Node;
40 typedef Graph::EdgeIt EdgeIt;
41 typedef Graph::NodeIt NodeIt;
42 typedef Graph::EdgeMap<int> LengthMap;
45 LengthMap length(graph);
48 /// \todo create own test graph
51 if( getenv("srcdir") )
52 f_name = std::string(getenv("srcdir"));
54 f_name += "/dijkstra_test.lgf";
56 std::ifstream input(f_name.c_str());
57 check(input, "Input file '" << f_name << "' not found.");
58 readGraph(input, graph, length, start);
61 std::cerr << "Checking Bin Heap" << std::endl;
63 typedef BinHeap<Item, Prio, ItemIntMap> IntHeap;
64 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
65 heapSortTest<IntHeap>(100);
66 heapIncreaseTest<IntHeap>(100);
68 typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
69 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
71 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
72 std::cout << timer << std::endl;
75 std::cerr << "Checking Fib Heap" << std::endl;
77 typedef FibHeap<Item, Prio, ItemIntMap> IntHeap;
78 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
79 heapSortTest<IntHeap>(100);
80 heapIncreaseTest<IntHeap>(100);
82 typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
83 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
85 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
86 std::cout << timer << std::endl;
89 std::cerr << "Checking Radix Heap" << std::endl;
91 typedef RadixHeap<Item, ItemIntMap> IntHeap;
92 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
93 heapSortTest<IntHeap>(100);
94 heapIncreaseTest<IntHeap>(100);
96 typedef RadixHeap<Node, Graph::NodeMap<int> > NodeHeap;
97 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
99 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
100 std::cout << timer << std::endl;
104 std::cerr << "Checking Linear Heap" << std::endl;
106 typedef LinearHeap<Item, ItemIntMap> IntHeap;
107 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
108 heapSortTest<IntHeap>(100);
109 heapIncreaseTest<IntHeap>(100);
111 typedef LinearHeap<Node, Graph::NodeMap<int> > NodeHeap;
112 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
114 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
115 std::cout << timer << std::endl;
118 std::cout << __FILE__ ": All tests passed.\n";