Easy input-output function for common graphs.
Modified Exception handling in graph_reader.
7 #include <lemon/concept_check.h>
9 #include <lemon/smart_graph.h>
11 #include <lemon/graph_reader.h>
13 #include <lemon/bin_heap.h>
14 #include <lemon/fib_heap.h>
15 #include <lemon/radix_heap.h>
17 #include "test_tools.h"
19 #include "heap_test.h"
22 using namespace lemon;
24 template <typename Item, typename Prio, typename ItemIntMap>
28 template <typename _Heap>
36 ignore_unused_variable_warning(item);
37 ignore_unused_variable_warning(prio);
39 typedef typename _Heap::state_enum state_enum;
42 ignore_unused_variable_warning(state);
44 _Heap heap1 = _Heap(map);
46 ignore_unused_variable_warning(heap1);
48 heap.push(item, prio);
56 heap.decrease(item, prio);
57 heap.increase(item, prio);
62 state = heap.state(item);
64 state = _Heap::PRE_HEAP;
65 state = _Heap::IN_HEAP;
66 state = _Heap::POST_HEAP;
78 typedef IntIntMap ItemIntMap;
80 typedef ListGraph Graph;
82 typedef Graph::Edge Edge;
83 typedef Graph::Node Node;
84 typedef Graph::EdgeIt EdgeIt;
85 typedef Graph::NodeIt NodeIt;
86 typedef Graph::EdgeMap<int> LengthMap;
89 LengthMap length(graph);
92 /// \todo create own test graph
93 std::ifstream input("dijkstra_test.lemon");
94 readGraph(input, graph, length, start);
97 std::cerr << "Checking Bin Heap" << std::endl;
99 typedef BinHeap<Item, Prio, ItemIntMap> IntHeap;
100 checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
101 heapSortTest<IntHeap>(100);
102 heapIncreaseTest<IntHeap>(100);
104 typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
105 checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
106 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
109 std::cerr << "Checking Fib Heap" << std::endl;
111 typedef FibHeap<Item, Prio, ItemIntMap> IntHeap;
112 checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
113 heapSortTest<IntHeap>(100);
114 heapIncreaseTest<IntHeap>(100);
116 typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
117 checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
118 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
121 std::cerr << "Checking Radix Heap" << std::endl;
123 typedef RadixHeap<Item, ItemIntMap> IntHeap;
124 checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
125 heapSortTest<IntHeap>(100);
126 heapIncreaseTest<IntHeap>(100);
128 typedef RadixHeap<Node, Graph::NodeMap<int> > NodeHeap;
129 checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
130 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
133 std::cout << __FILE__ ": All tests passed.\n";