Several fixes and improvements in list_graph.h.
- Fix incorrect or misleading renamings in the code and in the documentation.
- Improve the documentation.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2007
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #ifndef LEMON_TEST_MAP_TEST_H
20 #define LEMON_TEST_MAP_TEST_H
24 #include <lemon/maps.h>
26 #include "test_tools.h"
31 //! \brief Some utilities to test map classes.
37 template <typename Graph>
38 void checkGraphNodeMap() {
42 typedef typename Graph::Node Node;
44 std::vector<Node> nodes;
45 for (int i = 0; i < num; ++i) {
46 nodes.push_back(graph.addNode());
48 typedef typename Graph::template NodeMap<int> IntNodeMap;
49 IntNodeMap map(graph, 42);
50 for (int i = 0; i < int(nodes.size()); ++i) {
51 check(map[nodes[i]] == 42, "Wrong map constructor.");
53 for (int i = 0; i < num; ++i) {
54 nodes.push_back(graph.addNode());
55 map[nodes.back()] = 23;
57 map = constMap<Node>(12);
58 for (int i = 0; i < int(nodes.size()); ++i) {
59 check(map[nodes[i]] == 12, "Wrong map constructor.");
65 template <typename Graph>
66 void checkGraphArcMap() {
70 typedef typename Graph::Node Node;
71 typedef typename Graph::Arc Arc;
73 std::vector<Node> nodes;
74 for (int i = 0; i < num; ++i) {
75 nodes.push_back(graph.addNode());
78 std::vector<Arc> edges;
79 for (int i = 0; i < num; ++i) {
80 for (int j = 0; j < i; ++j) {
81 edges.push_back(graph.addArc(nodes[i], nodes[j]));
85 typedef typename Graph::template ArcMap<int> IntArcMap;
86 IntArcMap map(graph, 42);
88 for (int i = 0; i < int(edges.size()); ++i) {
89 check(map[edges[i]] == 42, "Wrong map constructor.");
92 for (int i = 0; i < num; ++i) {
93 for (int j = i + 1; j < num; ++j) {
94 edges.push_back(graph.addArc(nodes[i], nodes[j]));
95 map[edges.back()] = 23;
98 map = constMap<Arc>(12);
99 for (int i = 0; i < int(edges.size()); ++i) {
100 check(map[edges[i]] == 12, "Wrong map constructor.");
106 template <typename Graph>
107 void checkGraphEdgeMap() {
111 typedef typename Graph::Node Node;
112 typedef typename Graph::Edge Edge;
114 std::vector<Node> nodes;
115 for (int i = 0; i < num; ++i) {
116 nodes.push_back(graph.addNode());
119 std::vector<Edge> edges;
120 for (int i = 0; i < num; ++i) {
121 for (int j = 0; j < i; ++j) {
122 edges.push_back(graph.addEdge(nodes[i], nodes[j]));
126 typedef typename Graph::template EdgeMap<int> IntEdgeMap;
127 IntEdgeMap map(graph, 42);
129 for (int i = 0; i < int(edges.size()); ++i) {
130 check(map[edges[i]] == 42, "Wrong map constructor.");
133 for (int i = 0; i < num; ++i) {
134 for (int j = i + 1; j < num; ++j) {
135 edges.push_back(graph.addEdge(nodes[i], nodes[j]));
136 map[edges.back()] = 23;
139 map = constMap<Edge>(12);
140 for (int i = 0; i < int(edges.size()); ++i) {
141 check(map[edges[i]] == 12, "Wrong map constructor.");