0
4
0
... | ... |
@@ -40,78 +40,78 @@ |
40 | 40 |
struct BfsDefaultTraits |
41 | 41 |
{ |
42 | 42 |
///The type of the digraph the algorithm runs on. |
43 | 43 |
typedef GR Digraph; |
44 | 44 |
|
45 | 45 |
///\brief The type of the map that stores the predecessor |
46 | 46 |
///arcs of the shortest paths. |
47 | 47 |
/// |
48 | 48 |
///The type of the map that stores the predecessor |
49 | 49 |
///arcs of the shortest paths. |
50 | 50 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
51 | 51 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
52 |
///Instantiates a |
|
52 |
///Instantiates a PredMap. |
|
53 | 53 |
|
54 |
///This function instantiates a |
|
54 |
///This function instantiates a PredMap. |
|
55 | 55 |
///\param g is the digraph, to which we would like to define the |
56 |
/// |
|
56 |
///PredMap. |
|
57 | 57 |
static PredMap *createPredMap(const Digraph &g) |
58 | 58 |
{ |
59 | 59 |
return new PredMap(g); |
60 | 60 |
} |
61 | 61 |
|
62 | 62 |
///The type of the map that indicates which nodes are processed. |
63 | 63 |
|
64 | 64 |
///The type of the map that indicates which nodes are processed. |
65 | 65 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
66 | 66 |
typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
67 |
///Instantiates a |
|
67 |
///Instantiates a ProcessedMap. |
|
68 | 68 |
|
69 |
///This function instantiates a |
|
69 |
///This function instantiates a ProcessedMap. |
|
70 | 70 |
///\param g is the digraph, to which |
71 |
///we would like to define the |
|
71 |
///we would like to define the ProcessedMap |
|
72 | 72 |
#ifdef DOXYGEN |
73 | 73 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
74 | 74 |
#else |
75 | 75 |
static ProcessedMap *createProcessedMap(const Digraph &) |
76 | 76 |
#endif |
77 | 77 |
{ |
78 | 78 |
return new ProcessedMap(); |
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
///The type of the map that indicates which nodes are reached. |
82 | 82 |
|
83 | 83 |
///The type of the map that indicates which nodes are reached. |
84 | 84 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
85 | 85 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
86 |
///Instantiates a |
|
86 |
///Instantiates a ReachedMap. |
|
87 | 87 |
|
88 |
///This function instantiates a |
|
88 |
///This function instantiates a ReachedMap. |
|
89 | 89 |
///\param g is the digraph, to which |
90 |
///we would like to define the |
|
90 |
///we would like to define the ReachedMap. |
|
91 | 91 |
static ReachedMap *createReachedMap(const Digraph &g) |
92 | 92 |
{ |
93 | 93 |
return new ReachedMap(g); |
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
///The type of the map that stores the distances of the nodes. |
97 | 97 |
|
98 | 98 |
///The type of the map that stores the distances of the nodes. |
99 | 99 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
100 | 100 |
typedef typename Digraph::template NodeMap<int> DistMap; |
101 |
///Instantiates a |
|
101 |
///Instantiates a DistMap. |
|
102 | 102 |
|
103 |
///This function instantiates a |
|
103 |
///This function instantiates a DistMap. |
|
104 | 104 |
///\param g is the digraph, to which we would like to define the |
105 |
/// |
|
105 |
///DistMap. |
|
106 | 106 |
static DistMap *createDistMap(const Digraph &g) |
107 | 107 |
{ |
108 | 108 |
return new DistMap(g); |
109 | 109 |
} |
110 | 110 |
}; |
111 | 111 |
|
112 | 112 |
///%BFS algorithm class. |
113 | 113 |
|
114 | 114 |
///\ingroup search |
115 | 115 |
///This class provides an efficient implementation of the %BFS algorithm. |
116 | 116 |
/// |
117 | 117 |
///There is also a \ref bfs() "function-type interface" for the BFS |
... | ... |
@@ -218,103 +218,103 @@ |
218 | 218 |
///@{ |
219 | 219 |
|
220 | 220 |
template <class T> |
221 | 221 |
struct SetPredMapTraits : public Traits { |
222 | 222 |
typedef T PredMap; |
223 | 223 |
static PredMap *createPredMap(const Digraph &) |
224 | 224 |
{ |
225 | 225 |
LEMON_ASSERT(false, "PredMap is not initialized"); |
226 | 226 |
return 0; // ignore warnings |
227 | 227 |
} |
228 | 228 |
}; |
229 | 229 |
///\brief \ref named-templ-param "Named parameter" for setting |
230 |
/// |
|
230 |
///PredMap type. |
|
231 | 231 |
/// |
232 | 232 |
///\ref named-templ-param "Named parameter" for setting |
233 |
/// |
|
233 |
///PredMap type. |
|
234 | 234 |
template <class T> |
235 | 235 |
struct SetPredMap : public Bfs< Digraph, SetPredMapTraits<T> > { |
236 | 236 |
typedef Bfs< Digraph, SetPredMapTraits<T> > Create; |
237 | 237 |
}; |
238 | 238 |
|
239 | 239 |
template <class T> |
240 | 240 |
struct SetDistMapTraits : public Traits { |
241 | 241 |
typedef T DistMap; |
242 | 242 |
static DistMap *createDistMap(const Digraph &) |
243 | 243 |
{ |
244 | 244 |
LEMON_ASSERT(false, "DistMap is not initialized"); |
245 | 245 |
return 0; // ignore warnings |
246 | 246 |
} |
247 | 247 |
}; |
248 | 248 |
///\brief \ref named-templ-param "Named parameter" for setting |
249 |
/// |
|
249 |
///DistMap type. |
|
250 | 250 |
/// |
251 | 251 |
///\ref named-templ-param "Named parameter" for setting |
252 |
/// |
|
252 |
///DistMap type. |
|
253 | 253 |
template <class T> |
254 | 254 |
struct SetDistMap : public Bfs< Digraph, SetDistMapTraits<T> > { |
255 | 255 |
typedef Bfs< Digraph, SetDistMapTraits<T> > Create; |
256 | 256 |
}; |
257 | 257 |
|
258 | 258 |
template <class T> |
259 | 259 |
struct SetReachedMapTraits : public Traits { |
260 | 260 |
typedef T ReachedMap; |
261 | 261 |
static ReachedMap *createReachedMap(const Digraph &) |
262 | 262 |
{ |
263 | 263 |
LEMON_ASSERT(false, "ReachedMap is not initialized"); |
264 | 264 |
return 0; // ignore warnings |
265 | 265 |
} |
266 | 266 |
}; |
267 | 267 |
///\brief \ref named-templ-param "Named parameter" for setting |
268 |
/// |
|
268 |
///ReachedMap type. |
|
269 | 269 |
/// |
270 | 270 |
///\ref named-templ-param "Named parameter" for setting |
271 |
/// |
|
271 |
///ReachedMap type. |
|
272 | 272 |
template <class T> |
273 | 273 |
struct SetReachedMap : public Bfs< Digraph, SetReachedMapTraits<T> > { |
274 | 274 |
typedef Bfs< Digraph, SetReachedMapTraits<T> > Create; |
275 | 275 |
}; |
276 | 276 |
|
277 | 277 |
template <class T> |
278 | 278 |
struct SetProcessedMapTraits : public Traits { |
279 | 279 |
typedef T ProcessedMap; |
280 | 280 |
static ProcessedMap *createProcessedMap(const Digraph &) |
281 | 281 |
{ |
282 | 282 |
LEMON_ASSERT(false, "ProcessedMap is not initialized"); |
283 | 283 |
return 0; // ignore warnings |
284 | 284 |
} |
285 | 285 |
}; |
286 | 286 |
///\brief \ref named-templ-param "Named parameter" for setting |
287 |
/// |
|
287 |
///ProcessedMap type. |
|
288 | 288 |
/// |
289 | 289 |
///\ref named-templ-param "Named parameter" for setting |
290 |
/// |
|
290 |
///ProcessedMap type. |
|
291 | 291 |
template <class T> |
292 | 292 |
struct SetProcessedMap : public Bfs< Digraph, SetProcessedMapTraits<T> > { |
293 | 293 |
typedef Bfs< Digraph, SetProcessedMapTraits<T> > Create; |
294 | 294 |
}; |
295 | 295 |
|
296 | 296 |
struct SetStandardProcessedMapTraits : public Traits { |
297 | 297 |
typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
298 | 298 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
299 | 299 |
{ |
300 | 300 |
return new ProcessedMap(g); |
301 | 301 |
return 0; // ignore warnings |
302 | 302 |
} |
303 | 303 |
}; |
304 | 304 |
///\brief \ref named-templ-param "Named parameter" for setting |
305 |
/// |
|
305 |
///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
|
306 | 306 |
/// |
307 | 307 |
///\ref named-templ-param "Named parameter" for setting |
308 |
/// |
|
308 |
///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
|
309 | 309 |
///If you don't set it explicitly, it will be automatically allocated. |
310 | 310 |
struct SetStandardProcessedMap : |
311 | 311 |
public Bfs< Digraph, SetStandardProcessedMapTraits > { |
312 | 312 |
typedef Bfs< Digraph, SetStandardProcessedMapTraits > Create; |
313 | 313 |
}; |
314 | 314 |
|
315 | 315 |
///@} |
316 | 316 |
|
317 | 317 |
public: |
318 | 318 |
|
319 | 319 |
///Constructor. |
320 | 320 |
|
... | ... |
@@ -826,92 +826,92 @@ |
826 | 826 |
struct BfsWizardDefaultTraits |
827 | 827 |
{ |
828 | 828 |
///The type of the digraph the algorithm runs on. |
829 | 829 |
typedef GR Digraph; |
830 | 830 |
|
831 | 831 |
///\brief The type of the map that stores the predecessor |
832 | 832 |
///arcs of the shortest paths. |
833 | 833 |
/// |
834 | 834 |
///The type of the map that stores the predecessor |
835 | 835 |
///arcs of the shortest paths. |
836 | 836 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
837 | 837 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
838 |
///Instantiates a |
|
838 |
///Instantiates a PredMap. |
|
839 | 839 |
|
840 |
///This function instantiates a |
|
840 |
///This function instantiates a PredMap. |
|
841 | 841 |
///\param g is the digraph, to which we would like to define the |
842 |
/// |
|
842 |
///PredMap. |
|
843 | 843 |
static PredMap *createPredMap(const Digraph &g) |
844 | 844 |
{ |
845 | 845 |
return new PredMap(g); |
846 | 846 |
} |
847 | 847 |
|
848 | 848 |
///The type of the map that indicates which nodes are processed. |
849 | 849 |
|
850 | 850 |
///The type of the map that indicates which nodes are processed. |
851 | 851 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
852 | 852 |
///By default it is a NullMap. |
853 | 853 |
typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
854 |
///Instantiates a |
|
854 |
///Instantiates a ProcessedMap. |
|
855 | 855 |
|
856 |
///This function instantiates a |
|
856 |
///This function instantiates a ProcessedMap. |
|
857 | 857 |
///\param g is the digraph, to which |
858 |
///we would like to define the |
|
858 |
///we would like to define the ProcessedMap. |
|
859 | 859 |
#ifdef DOXYGEN |
860 | 860 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
861 | 861 |
#else |
862 | 862 |
static ProcessedMap *createProcessedMap(const Digraph &) |
863 | 863 |
#endif |
864 | 864 |
{ |
865 | 865 |
return new ProcessedMap(); |
866 | 866 |
} |
867 | 867 |
|
868 | 868 |
///The type of the map that indicates which nodes are reached. |
869 | 869 |
|
870 | 870 |
///The type of the map that indicates which nodes are reached. |
871 | 871 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
872 | 872 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
873 |
///Instantiates a |
|
873 |
///Instantiates a ReachedMap. |
|
874 | 874 |
|
875 |
///This function instantiates a |
|
875 |
///This function instantiates a ReachedMap. |
|
876 | 876 |
///\param g is the digraph, to which |
877 |
///we would like to define the |
|
877 |
///we would like to define the ReachedMap. |
|
878 | 878 |
static ReachedMap *createReachedMap(const Digraph &g) |
879 | 879 |
{ |
880 | 880 |
return new ReachedMap(g); |
881 | 881 |
} |
882 | 882 |
|
883 | 883 |
///The type of the map that stores the distances of the nodes. |
884 | 884 |
|
885 | 885 |
///The type of the map that stores the distances of the nodes. |
886 | 886 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
887 | 887 |
typedef typename Digraph::template NodeMap<int> DistMap; |
888 |
///Instantiates a |
|
888 |
///Instantiates a DistMap. |
|
889 | 889 |
|
890 |
///This function instantiates a |
|
890 |
///This function instantiates a DistMap. |
|
891 | 891 |
///\param g is the digraph, to which we would like to define |
892 |
///the |
|
892 |
///the DistMap |
|
893 | 893 |
static DistMap *createDistMap(const Digraph &g) |
894 | 894 |
{ |
895 | 895 |
return new DistMap(g); |
896 | 896 |
} |
897 | 897 |
|
898 | 898 |
///The type of the shortest paths. |
899 | 899 |
|
900 | 900 |
///The type of the shortest paths. |
901 | 901 |
///It must meet the \ref concepts::Path "Path" concept. |
902 | 902 |
typedef lemon::Path<Digraph> Path; |
903 | 903 |
}; |
904 | 904 |
|
905 |
/// Default traits class used by |
|
905 |
/// Default traits class used by BfsWizard |
|
906 | 906 |
|
907 | 907 |
/// To make it easier to use Bfs algorithm |
908 | 908 |
/// we have created a wizard class. |
909 | 909 |
/// This \ref BfsWizard class needs default traits, |
910 | 910 |
/// as well as the \ref Bfs class. |
911 | 911 |
/// The \ref BfsWizardBase is a class to be the default traits of the |
912 | 912 |
/// \ref BfsWizard class. |
913 | 913 |
template<class GR> |
914 | 914 |
class BfsWizardBase : public BfsWizardDefaultTraits<GR> |
915 | 915 |
{ |
916 | 916 |
|
917 | 917 |
typedef BfsWizardDefaultTraits<GR> Base; |
... | ... |
@@ -1059,82 +1059,82 @@ |
1059 | 1059 |
void run() |
1060 | 1060 |
{ |
1061 | 1061 |
run(INVALID); |
1062 | 1062 |
} |
1063 | 1063 |
|
1064 | 1064 |
template<class T> |
1065 | 1065 |
struct SetPredMapBase : public Base { |
1066 | 1066 |
typedef T PredMap; |
1067 | 1067 |
static PredMap *createPredMap(const Digraph &) { return 0; }; |
1068 | 1068 |
SetPredMapBase(const TR &b) : TR(b) {} |
1069 | 1069 |
}; |
1070 | 1070 |
///\brief \ref named-func-param "Named parameter" |
1071 |
///for setting |
|
1071 |
///for setting PredMap object. |
|
1072 | 1072 |
/// |
1073 | 1073 |
///\ref named-func-param "Named parameter" |
1074 |
///for setting |
|
1074 |
///for setting PredMap object. |
|
1075 | 1075 |
template<class T> |
1076 | 1076 |
BfsWizard<SetPredMapBase<T> > predMap(const T &t) |
1077 | 1077 |
{ |
1078 | 1078 |
Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1079 | 1079 |
return BfsWizard<SetPredMapBase<T> >(*this); |
1080 | 1080 |
} |
1081 | 1081 |
|
1082 | 1082 |
template<class T> |
1083 | 1083 |
struct SetReachedMapBase : public Base { |
1084 | 1084 |
typedef T ReachedMap; |
1085 | 1085 |
static ReachedMap *createReachedMap(const Digraph &) { return 0; }; |
1086 | 1086 |
SetReachedMapBase(const TR &b) : TR(b) {} |
1087 | 1087 |
}; |
1088 | 1088 |
///\brief \ref named-func-param "Named parameter" |
1089 |
///for setting |
|
1089 |
///for setting ReachedMap object. |
|
1090 | 1090 |
/// |
1091 | 1091 |
/// \ref named-func-param "Named parameter" |
1092 |
///for setting |
|
1092 |
///for setting ReachedMap object. |
|
1093 | 1093 |
template<class T> |
1094 | 1094 |
BfsWizard<SetReachedMapBase<T> > reachedMap(const T &t) |
1095 | 1095 |
{ |
1096 | 1096 |
Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1097 | 1097 |
return BfsWizard<SetReachedMapBase<T> >(*this); |
1098 | 1098 |
} |
1099 | 1099 |
|
1100 | 1100 |
template<class T> |
1101 | 1101 |
struct SetDistMapBase : public Base { |
1102 | 1102 |
typedef T DistMap; |
1103 | 1103 |
static DistMap *createDistMap(const Digraph &) { return 0; }; |
1104 | 1104 |
SetDistMapBase(const TR &b) : TR(b) {} |
1105 | 1105 |
}; |
1106 | 1106 |
///\brief \ref named-func-param "Named parameter" |
1107 |
///for setting |
|
1107 |
///for setting DistMap object. |
|
1108 | 1108 |
/// |
1109 | 1109 |
/// \ref named-func-param "Named parameter" |
1110 |
///for setting |
|
1110 |
///for setting DistMap object. |
|
1111 | 1111 |
template<class T> |
1112 | 1112 |
BfsWizard<SetDistMapBase<T> > distMap(const T &t) |
1113 | 1113 |
{ |
1114 | 1114 |
Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1115 | 1115 |
return BfsWizard<SetDistMapBase<T> >(*this); |
1116 | 1116 |
} |
1117 | 1117 |
|
1118 | 1118 |
template<class T> |
1119 | 1119 |
struct SetProcessedMapBase : public Base { |
1120 | 1120 |
typedef T ProcessedMap; |
1121 | 1121 |
static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1122 | 1122 |
SetProcessedMapBase(const TR &b) : TR(b) {} |
1123 | 1123 |
}; |
1124 | 1124 |
///\brief \ref named-func-param "Named parameter" |
1125 |
///for setting |
|
1125 |
///for setting ProcessedMap object. |
|
1126 | 1126 |
/// |
1127 | 1127 |
/// \ref named-func-param "Named parameter" |
1128 |
///for setting |
|
1128 |
///for setting ProcessedMap object. |
|
1129 | 1129 |
template<class T> |
1130 | 1130 |
BfsWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
1131 | 1131 |
{ |
1132 | 1132 |
Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1133 | 1133 |
return BfsWizard<SetProcessedMapBase<T> >(*this); |
1134 | 1134 |
} |
1135 | 1135 |
|
1136 | 1136 |
template<class T> |
1137 | 1137 |
struct SetPathBase : public Base { |
1138 | 1138 |
typedef T Path; |
1139 | 1139 |
SetPathBase(const TR &b) : TR(b) {} |
1140 | 1140 |
}; |
... | ... |
@@ -1258,29 +1258,29 @@ |
1258 | 1258 |
template<class _Digraph> |
1259 | 1259 |
struct BfsVisitDefaultTraits { |
1260 | 1260 |
|
1261 | 1261 |
/// \brief The type of the digraph the algorithm runs on. |
1262 | 1262 |
typedef _Digraph Digraph; |
1263 | 1263 |
|
1264 | 1264 |
/// \brief The type of the map that indicates which nodes are reached. |
1265 | 1265 |
/// |
1266 | 1266 |
/// The type of the map that indicates which nodes are reached. |
1267 | 1267 |
/// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
1268 | 1268 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
1269 | 1269 |
|
1270 |
/// \brief Instantiates a |
|
1270 |
/// \brief Instantiates a ReachedMap. |
|
1271 | 1271 |
/// |
1272 |
/// This function instantiates a |
|
1272 |
/// This function instantiates a ReachedMap. |
|
1273 | 1273 |
/// \param digraph is the digraph, to which |
1274 |
/// we would like to define the |
|
1274 |
/// we would like to define the ReachedMap. |
|
1275 | 1275 |
static ReachedMap *createReachedMap(const Digraph &digraph) { |
1276 | 1276 |
return new ReachedMap(digraph); |
1277 | 1277 |
} |
1278 | 1278 |
|
1279 | 1279 |
}; |
1280 | 1280 |
|
1281 | 1281 |
/// \ingroup search |
1282 | 1282 |
/// |
1283 | 1283 |
/// \brief %BFS algorithm class with visitor interface. |
1284 | 1284 |
/// |
1285 | 1285 |
/// This class provides an efficient implementation of the %BFS algorithm |
1286 | 1286 |
/// with visitor interface. |
... | ... |
@@ -41,78 +41,78 @@ |
41 | 41 |
struct DfsDefaultTraits |
42 | 42 |
{ |
43 | 43 |
///The type of the digraph the algorithm runs on. |
44 | 44 |
typedef GR Digraph; |
45 | 45 |
|
46 | 46 |
///\brief The type of the map that stores the predecessor |
47 | 47 |
///arcs of the %DFS paths. |
48 | 48 |
/// |
49 | 49 |
///The type of the map that stores the predecessor |
50 | 50 |
///arcs of the %DFS paths. |
51 | 51 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
52 | 52 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
53 |
///Instantiates a |
|
53 |
///Instantiates a PredMap. |
|
54 | 54 |
|
55 |
///This function instantiates a |
|
55 |
///This function instantiates a PredMap. |
|
56 | 56 |
///\param g is the digraph, to which we would like to define the |
57 |
/// |
|
57 |
///PredMap. |
|
58 | 58 |
static PredMap *createPredMap(const Digraph &g) |
59 | 59 |
{ |
60 | 60 |
return new PredMap(g); |
61 | 61 |
} |
62 | 62 |
|
63 | 63 |
///The type of the map that indicates which nodes are processed. |
64 | 64 |
|
65 | 65 |
///The type of the map that indicates which nodes are processed. |
66 | 66 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
67 | 67 |
typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
68 |
///Instantiates a |
|
68 |
///Instantiates a ProcessedMap. |
|
69 | 69 |
|
70 |
///This function instantiates a |
|
70 |
///This function instantiates a ProcessedMap. |
|
71 | 71 |
///\param g is the digraph, to which |
72 |
///we would like to define the |
|
72 |
///we would like to define the ProcessedMap |
|
73 | 73 |
#ifdef DOXYGEN |
74 | 74 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
75 | 75 |
#else |
76 | 76 |
static ProcessedMap *createProcessedMap(const Digraph &) |
77 | 77 |
#endif |
78 | 78 |
{ |
79 | 79 |
return new ProcessedMap(); |
80 | 80 |
} |
81 | 81 |
|
82 | 82 |
///The type of the map that indicates which nodes are reached. |
83 | 83 |
|
84 | 84 |
///The type of the map that indicates which nodes are reached. |
85 | 85 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
86 | 86 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
87 |
///Instantiates a |
|
87 |
///Instantiates a ReachedMap. |
|
88 | 88 |
|
89 |
///This function instantiates a |
|
89 |
///This function instantiates a ReachedMap. |
|
90 | 90 |
///\param g is the digraph, to which |
91 |
///we would like to define the |
|
91 |
///we would like to define the ReachedMap. |
|
92 | 92 |
static ReachedMap *createReachedMap(const Digraph &g) |
93 | 93 |
{ |
94 | 94 |
return new ReachedMap(g); |
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
///The type of the map that stores the distances of the nodes. |
98 | 98 |
|
99 | 99 |
///The type of the map that stores the distances of the nodes. |
100 | 100 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
101 | 101 |
typedef typename Digraph::template NodeMap<int> DistMap; |
102 |
///Instantiates a |
|
102 |
///Instantiates a DistMap. |
|
103 | 103 |
|
104 |
///This function instantiates a |
|
104 |
///This function instantiates a DistMap. |
|
105 | 105 |
///\param g is the digraph, to which we would like to define the |
106 |
/// |
|
106 |
///DistMap. |
|
107 | 107 |
static DistMap *createDistMap(const Digraph &g) |
108 | 108 |
{ |
109 | 109 |
return new DistMap(g); |
110 | 110 |
} |
111 | 111 |
}; |
112 | 112 |
|
113 | 113 |
///%DFS algorithm class. |
114 | 114 |
|
115 | 115 |
///\ingroup search |
116 | 116 |
///This class provides an efficient implementation of the %DFS algorithm. |
117 | 117 |
/// |
118 | 118 |
///There is also a \ref dfs() "function-type interface" for the DFS |
... | ... |
@@ -218,102 +218,102 @@ |
218 | 218 |
///@{ |
219 | 219 |
|
220 | 220 |
template <class T> |
221 | 221 |
struct SetPredMapTraits : public Traits { |
222 | 222 |
typedef T PredMap; |
223 | 223 |
static PredMap *createPredMap(const Digraph &) |
224 | 224 |
{ |
225 | 225 |
LEMON_ASSERT(false, "PredMap is not initialized"); |
226 | 226 |
return 0; // ignore warnings |
227 | 227 |
} |
228 | 228 |
}; |
229 | 229 |
///\brief \ref named-templ-param "Named parameter" for setting |
230 |
/// |
|
230 |
///PredMap type. |
|
231 | 231 |
/// |
232 | 232 |
///\ref named-templ-param "Named parameter" for setting |
233 |
/// |
|
233 |
///PredMap type. |
|
234 | 234 |
template <class T> |
235 | 235 |
struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > { |
236 | 236 |
typedef Dfs<Digraph, SetPredMapTraits<T> > Create; |
237 | 237 |
}; |
238 | 238 |
|
239 | 239 |
template <class T> |
240 | 240 |
struct SetDistMapTraits : public Traits { |
241 | 241 |
typedef T DistMap; |
242 | 242 |
static DistMap *createDistMap(const Digraph &) |
243 | 243 |
{ |
244 | 244 |
LEMON_ASSERT(false, "DistMap is not initialized"); |
245 | 245 |
return 0; // ignore warnings |
246 | 246 |
} |
247 | 247 |
}; |
248 | 248 |
///\brief \ref named-templ-param "Named parameter" for setting |
249 |
/// |
|
249 |
///DistMap type. |
|
250 | 250 |
/// |
251 | 251 |
///\ref named-templ-param "Named parameter" for setting |
252 |
/// |
|
252 |
///DistMap type. |
|
253 | 253 |
template <class T> |
254 | 254 |
struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > { |
255 | 255 |
typedef Dfs<Digraph, SetDistMapTraits<T> > Create; |
256 | 256 |
}; |
257 | 257 |
|
258 | 258 |
template <class T> |
259 | 259 |
struct SetReachedMapTraits : public Traits { |
260 | 260 |
typedef T ReachedMap; |
261 | 261 |
static ReachedMap *createReachedMap(const Digraph &) |
262 | 262 |
{ |
263 | 263 |
LEMON_ASSERT(false, "ReachedMap is not initialized"); |
264 | 264 |
return 0; // ignore warnings |
265 | 265 |
} |
266 | 266 |
}; |
267 | 267 |
///\brief \ref named-templ-param "Named parameter" for setting |
268 |
/// |
|
268 |
///ReachedMap type. |
|
269 | 269 |
/// |
270 | 270 |
///\ref named-templ-param "Named parameter" for setting |
271 |
/// |
|
271 |
///ReachedMap type. |
|
272 | 272 |
template <class T> |
273 | 273 |
struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > { |
274 | 274 |
typedef Dfs< Digraph, SetReachedMapTraits<T> > Create; |
275 | 275 |
}; |
276 | 276 |
|
277 | 277 |
template <class T> |
278 | 278 |
struct SetProcessedMapTraits : public Traits { |
279 | 279 |
typedef T ProcessedMap; |
280 | 280 |
static ProcessedMap *createProcessedMap(const Digraph &) |
281 | 281 |
{ |
282 | 282 |
LEMON_ASSERT(false, "ProcessedMap is not initialized"); |
283 | 283 |
return 0; // ignore warnings |
284 | 284 |
} |
285 | 285 |
}; |
286 | 286 |
///\brief \ref named-templ-param "Named parameter" for setting |
287 |
/// |
|
287 |
///ProcessedMap type. |
|
288 | 288 |
/// |
289 | 289 |
///\ref named-templ-param "Named parameter" for setting |
290 |
/// |
|
290 |
///ProcessedMap type. |
|
291 | 291 |
template <class T> |
292 | 292 |
struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > { |
293 | 293 |
typedef Dfs< Digraph, SetProcessedMapTraits<T> > Create; |
294 | 294 |
}; |
295 | 295 |
|
296 | 296 |
struct SetStandardProcessedMapTraits : public Traits { |
297 | 297 |
typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
298 | 298 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
299 | 299 |
{ |
300 | 300 |
return new ProcessedMap(g); |
301 | 301 |
} |
302 | 302 |
}; |
303 | 303 |
///\brief \ref named-templ-param "Named parameter" for setting |
304 |
/// |
|
304 |
///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
|
305 | 305 |
/// |
306 | 306 |
///\ref named-templ-param "Named parameter" for setting |
307 |
/// |
|
307 |
///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
|
308 | 308 |
///If you don't set it explicitly, it will be automatically allocated. |
309 | 309 |
struct SetStandardProcessedMap : |
310 | 310 |
public Dfs< Digraph, SetStandardProcessedMapTraits > { |
311 | 311 |
typedef Dfs< Digraph, SetStandardProcessedMapTraits > Create; |
312 | 312 |
}; |
313 | 313 |
|
314 | 314 |
///@} |
315 | 315 |
|
316 | 316 |
public: |
317 | 317 |
|
318 | 318 |
///Constructor. |
319 | 319 |
|
... | ... |
@@ -759,79 +759,79 @@ |
759 | 759 |
struct DfsWizardDefaultTraits |
760 | 760 |
{ |
761 | 761 |
///The type of the digraph the algorithm runs on. |
762 | 762 |
typedef GR Digraph; |
763 | 763 |
|
764 | 764 |
///\brief The type of the map that stores the predecessor |
765 | 765 |
///arcs of the %DFS paths. |
766 | 766 |
/// |
767 | 767 |
///The type of the map that stores the predecessor |
768 | 768 |
///arcs of the %DFS paths. |
769 | 769 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
770 | 770 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
771 |
///Instantiates a |
|
771 |
///Instantiates a PredMap. |
|
772 | 772 |
|
773 |
///This function instantiates a |
|
773 |
///This function instantiates a PredMap. |
|
774 | 774 |
///\param g is the digraph, to which we would like to define the |
775 |
/// |
|
775 |
///PredMap. |
|
776 | 776 |
static PredMap *createPredMap(const Digraph &g) |
777 | 777 |
{ |
778 | 778 |
return new PredMap(g); |
779 | 779 |
} |
780 | 780 |
|
781 | 781 |
///The type of the map that indicates which nodes are processed. |
782 | 782 |
|
783 | 783 |
///The type of the map that indicates which nodes are processed. |
784 | 784 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
785 | 785 |
///By default it is a NullMap. |
786 | 786 |
typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
787 |
///Instantiates a |
|
787 |
///Instantiates a ProcessedMap. |
|
788 | 788 |
|
789 |
///This function instantiates a |
|
789 |
///This function instantiates a ProcessedMap. |
|
790 | 790 |
///\param g is the digraph, to which |
791 |
///we would like to define the |
|
791 |
///we would like to define the ProcessedMap. |
|
792 | 792 |
#ifdef DOXYGEN |
793 | 793 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
794 | 794 |
#else |
795 | 795 |
static ProcessedMap *createProcessedMap(const Digraph &) |
796 | 796 |
#endif |
797 | 797 |
{ |
798 | 798 |
return new ProcessedMap(); |
799 | 799 |
} |
800 | 800 |
|
801 | 801 |
///The type of the map that indicates which nodes are reached. |
802 | 802 |
|
803 | 803 |
///The type of the map that indicates which nodes are reached. |
804 | 804 |
///It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
805 | 805 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
806 |
///Instantiates a |
|
806 |
///Instantiates a ReachedMap. |
|
807 | 807 |
|
808 |
///This function instantiates a |
|
808 |
///This function instantiates a ReachedMap. |
|
809 | 809 |
///\param g is the digraph, to which |
810 |
///we would like to define the |
|
810 |
///we would like to define the ReachedMap. |
|
811 | 811 |
static ReachedMap *createReachedMap(const Digraph &g) |
812 | 812 |
{ |
813 | 813 |
return new ReachedMap(g); |
814 | 814 |
} |
815 | 815 |
|
816 | 816 |
///The type of the map that stores the distances of the nodes. |
817 | 817 |
|
818 | 818 |
///The type of the map that stores the distances of the nodes. |
819 | 819 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
820 | 820 |
typedef typename Digraph::template NodeMap<int> DistMap; |
821 |
///Instantiates a |
|
821 |
///Instantiates a DistMap. |
|
822 | 822 |
|
823 |
///This function instantiates a |
|
823 |
///This function instantiates a DistMap. |
|
824 | 824 |
///\param g is the digraph, to which we would like to define |
825 |
///the |
|
825 |
///the DistMap |
|
826 | 826 |
static DistMap *createDistMap(const Digraph &g) |
827 | 827 |
{ |
828 | 828 |
return new DistMap(g); |
829 | 829 |
} |
830 | 830 |
|
831 | 831 |
///The type of the DFS paths. |
832 | 832 |
|
833 | 833 |
///The type of the DFS paths. |
834 | 834 |
///It must meet the \ref concepts::Path "Path" concept. |
835 | 835 |
typedef lemon::Path<Digraph> Path; |
836 | 836 |
}; |
837 | 837 |
|
... | ... |
@@ -992,82 +992,82 @@ |
992 | 992 |
void run() |
993 | 993 |
{ |
994 | 994 |
run(INVALID); |
995 | 995 |
} |
996 | 996 |
|
997 | 997 |
template<class T> |
998 | 998 |
struct SetPredMapBase : public Base { |
999 | 999 |
typedef T PredMap; |
1000 | 1000 |
static PredMap *createPredMap(const Digraph &) { return 0; }; |
1001 | 1001 |
SetPredMapBase(const TR &b) : TR(b) {} |
1002 | 1002 |
}; |
1003 | 1003 |
///\brief \ref named-func-param "Named parameter" |
1004 |
///for setting |
|
1004 |
///for setting PredMap object. |
|
1005 | 1005 |
/// |
1006 | 1006 |
///\ref named-func-param "Named parameter" |
1007 |
///for setting |
|
1007 |
///for setting PredMap object. |
|
1008 | 1008 |
template<class T> |
1009 | 1009 |
DfsWizard<SetPredMapBase<T> > predMap(const T &t) |
1010 | 1010 |
{ |
1011 | 1011 |
Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1012 | 1012 |
return DfsWizard<SetPredMapBase<T> >(*this); |
1013 | 1013 |
} |
1014 | 1014 |
|
1015 | 1015 |
template<class T> |
1016 | 1016 |
struct SetReachedMapBase : public Base { |
1017 | 1017 |
typedef T ReachedMap; |
1018 | 1018 |
static ReachedMap *createReachedMap(const Digraph &) { return 0; }; |
1019 | 1019 |
SetReachedMapBase(const TR &b) : TR(b) {} |
1020 | 1020 |
}; |
1021 | 1021 |
///\brief \ref named-func-param "Named parameter" |
1022 |
///for setting |
|
1022 |
///for setting ReachedMap object. |
|
1023 | 1023 |
/// |
1024 | 1024 |
/// \ref named-func-param "Named parameter" |
1025 |
///for setting |
|
1025 |
///for setting ReachedMap object. |
|
1026 | 1026 |
template<class T> |
1027 | 1027 |
DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t) |
1028 | 1028 |
{ |
1029 | 1029 |
Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1030 | 1030 |
return DfsWizard<SetReachedMapBase<T> >(*this); |
1031 | 1031 |
} |
1032 | 1032 |
|
1033 | 1033 |
template<class T> |
1034 | 1034 |
struct SetDistMapBase : public Base { |
1035 | 1035 |
typedef T DistMap; |
1036 | 1036 |
static DistMap *createDistMap(const Digraph &) { return 0; }; |
1037 | 1037 |
SetDistMapBase(const TR &b) : TR(b) {} |
1038 | 1038 |
}; |
1039 | 1039 |
///\brief \ref named-func-param "Named parameter" |
1040 |
///for setting |
|
1040 |
///for setting DistMap object. |
|
1041 | 1041 |
/// |
1042 | 1042 |
/// \ref named-func-param "Named parameter" |
1043 |
///for setting |
|
1043 |
///for setting DistMap object. |
|
1044 | 1044 |
template<class T> |
1045 | 1045 |
DfsWizard<SetDistMapBase<T> > distMap(const T &t) |
1046 | 1046 |
{ |
1047 | 1047 |
Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1048 | 1048 |
return DfsWizard<SetDistMapBase<T> >(*this); |
1049 | 1049 |
} |
1050 | 1050 |
|
1051 | 1051 |
template<class T> |
1052 | 1052 |
struct SetProcessedMapBase : public Base { |
1053 | 1053 |
typedef T ProcessedMap; |
1054 | 1054 |
static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1055 | 1055 |
SetProcessedMapBase(const TR &b) : TR(b) {} |
1056 | 1056 |
}; |
1057 | 1057 |
///\brief \ref named-func-param "Named parameter" |
1058 |
///for setting |
|
1058 |
///for setting ProcessedMap object. |
|
1059 | 1059 |
/// |
1060 | 1060 |
/// \ref named-func-param "Named parameter" |
1061 |
///for setting |
|
1061 |
///for setting ProcessedMap object. |
|
1062 | 1062 |
template<class T> |
1063 | 1063 |
DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
1064 | 1064 |
{ |
1065 | 1065 |
Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1066 | 1066 |
return DfsWizard<SetProcessedMapBase<T> >(*this); |
1067 | 1067 |
} |
1068 | 1068 |
|
1069 | 1069 |
template<class T> |
1070 | 1070 |
struct SetPathBase : public Base { |
1071 | 1071 |
typedef T Path; |
1072 | 1072 |
SetPathBase(const TR &b) : TR(b) {} |
1073 | 1073 |
}; |
... | ... |
@@ -1204,29 +1204,29 @@ |
1204 | 1204 |
template<class _Digraph> |
1205 | 1205 |
struct DfsVisitDefaultTraits { |
1206 | 1206 |
|
1207 | 1207 |
/// \brief The type of the digraph the algorithm runs on. |
1208 | 1208 |
typedef _Digraph Digraph; |
1209 | 1209 |
|
1210 | 1210 |
/// \brief The type of the map that indicates which nodes are reached. |
1211 | 1211 |
/// |
1212 | 1212 |
/// The type of the map that indicates which nodes are reached. |
1213 | 1213 |
/// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
1214 | 1214 |
typedef typename Digraph::template NodeMap<bool> ReachedMap; |
1215 | 1215 |
|
1216 |
/// \brief Instantiates a |
|
1216 |
/// \brief Instantiates a ReachedMap. |
|
1217 | 1217 |
/// |
1218 |
/// This function instantiates a |
|
1218 |
/// This function instantiates a ReachedMap. |
|
1219 | 1219 |
/// \param digraph is the digraph, to which |
1220 |
/// we would like to define the |
|
1220 |
/// we would like to define the ReachedMap. |
|
1221 | 1221 |
static ReachedMap *createReachedMap(const Digraph &digraph) { |
1222 | 1222 |
return new ReachedMap(digraph); |
1223 | 1223 |
} |
1224 | 1224 |
|
1225 | 1225 |
}; |
1226 | 1226 |
|
1227 | 1227 |
/// \ingroup search |
1228 | 1228 |
/// |
1229 | 1229 |
/// \brief %DFS algorithm class with visitor interface. |
1230 | 1230 |
/// |
1231 | 1231 |
/// This class provides an efficient implementation of the %DFS algorithm |
1232 | 1232 |
/// with visitor interface. |
... | ... |
@@ -130,64 +130,64 @@ |
130 | 130 |
static Heap *createHeap(HeapCrossRef& r) |
131 | 131 |
{ |
132 | 132 |
return new Heap(r); |
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
///\brief The type of the map that stores the predecessor |
136 | 136 |
///arcs of the shortest paths. |
137 | 137 |
/// |
138 | 138 |
///The type of the map that stores the predecessor |
139 | 139 |
///arcs of the shortest paths. |
140 | 140 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
141 | 141 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
142 |
///Instantiates a |
|
142 |
///Instantiates a PredMap. |
|
143 | 143 |
|
144 |
///This function instantiates a |
|
144 |
///This function instantiates a PredMap. |
|
145 | 145 |
///\param g is the digraph, to which we would like to define the |
146 |
/// |
|
146 |
///PredMap. |
|
147 | 147 |
static PredMap *createPredMap(const Digraph &g) |
148 | 148 |
{ |
149 | 149 |
return new PredMap(g); |
150 | 150 |
} |
151 | 151 |
|
152 | 152 |
///The type of the map that indicates which nodes are processed. |
153 | 153 |
|
154 | 154 |
///The type of the map that indicates which nodes are processed. |
155 | 155 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
156 | 156 |
///By default it is a NullMap. |
157 | 157 |
typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
158 |
///Instantiates a |
|
158 |
///Instantiates a ProcessedMap. |
|
159 | 159 |
|
160 |
///This function instantiates a |
|
160 |
///This function instantiates a ProcessedMap. |
|
161 | 161 |
///\param g is the digraph, to which |
162 |
///we would like to define the |
|
162 |
///we would like to define the ProcessedMap |
|
163 | 163 |
#ifdef DOXYGEN |
164 | 164 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
165 | 165 |
#else |
166 | 166 |
static ProcessedMap *createProcessedMap(const Digraph &) |
167 | 167 |
#endif |
168 | 168 |
{ |
169 | 169 |
return new ProcessedMap(); |
170 | 170 |
} |
171 | 171 |
|
172 | 172 |
///The type of the map that stores the distances of the nodes. |
173 | 173 |
|
174 | 174 |
///The type of the map that stores the distances of the nodes. |
175 | 175 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
176 | 176 |
typedef typename Digraph::template NodeMap<typename LM::Value> DistMap; |
177 |
///Instantiates a |
|
177 |
///Instantiates a DistMap. |
|
178 | 178 |
|
179 |
///This function instantiates a |
|
179 |
///This function instantiates a DistMap. |
|
180 | 180 |
///\param g is the digraph, to which we would like to define |
181 |
///the |
|
181 |
///the DistMap |
|
182 | 182 |
static DistMap *createDistMap(const Digraph &g) |
183 | 183 |
{ |
184 | 184 |
return new DistMap(g); |
185 | 185 |
} |
186 | 186 |
}; |
187 | 187 |
|
188 | 188 |
///%Dijkstra algorithm class. |
189 | 189 |
|
190 | 190 |
/// \ingroup shortest_path |
191 | 191 |
///This class provides an efficient implementation of the %Dijkstra algorithm. |
192 | 192 |
/// |
193 | 193 |
///The arc lengths are passed to the algorithm using a |
... | ... |
@@ -318,86 +318,86 @@ |
318 | 318 |
///@{ |
319 | 319 |
|
320 | 320 |
template <class T> |
321 | 321 |
struct SetPredMapTraits : public Traits { |
322 | 322 |
typedef T PredMap; |
323 | 323 |
static PredMap *createPredMap(const Digraph &) |
324 | 324 |
{ |
325 | 325 |
LEMON_ASSERT(false, "PredMap is not initialized"); |
326 | 326 |
return 0; // ignore warnings |
327 | 327 |
} |
328 | 328 |
}; |
329 | 329 |
///\brief \ref named-templ-param "Named parameter" for setting |
330 |
/// |
|
330 |
///PredMap type. |
|
331 | 331 |
/// |
332 | 332 |
///\ref named-templ-param "Named parameter" for setting |
333 |
/// |
|
333 |
///PredMap type. |
|
334 | 334 |
template <class T> |
335 | 335 |
struct SetPredMap |
336 | 336 |
: public Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > { |
337 | 337 |
typedef Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > Create; |
338 | 338 |
}; |
339 | 339 |
|
340 | 340 |
template <class T> |
341 | 341 |
struct SetDistMapTraits : public Traits { |
342 | 342 |
typedef T DistMap; |
343 | 343 |
static DistMap *createDistMap(const Digraph &) |
344 | 344 |
{ |
345 | 345 |
LEMON_ASSERT(false, "DistMap is not initialized"); |
346 | 346 |
return 0; // ignore warnings |
347 | 347 |
} |
348 | 348 |
}; |
349 | 349 |
///\brief \ref named-templ-param "Named parameter" for setting |
350 |
/// |
|
350 |
///DistMap type. |
|
351 | 351 |
/// |
352 | 352 |
///\ref named-templ-param "Named parameter" for setting |
353 |
/// |
|
353 |
///DistMap type. |
|
354 | 354 |
template <class T> |
355 | 355 |
struct SetDistMap |
356 | 356 |
: public Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > { |
357 | 357 |
typedef Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > Create; |
358 | 358 |
}; |
359 | 359 |
|
360 | 360 |
template <class T> |
361 | 361 |
struct SetProcessedMapTraits : public Traits { |
362 | 362 |
typedef T ProcessedMap; |
363 | 363 |
static ProcessedMap *createProcessedMap(const Digraph &) |
364 | 364 |
{ |
365 | 365 |
LEMON_ASSERT(false, "ProcessedMap is not initialized"); |
366 | 366 |
return 0; // ignore warnings |
367 | 367 |
} |
368 | 368 |
}; |
369 | 369 |
///\brief \ref named-templ-param "Named parameter" for setting |
370 |
/// |
|
370 |
///ProcessedMap type. |
|
371 | 371 |
/// |
372 | 372 |
///\ref named-templ-param "Named parameter" for setting |
373 |
/// |
|
373 |
///ProcessedMap type. |
|
374 | 374 |
template <class T> |
375 | 375 |
struct SetProcessedMap |
376 | 376 |
: public Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > { |
377 | 377 |
typedef Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > Create; |
378 | 378 |
}; |
379 | 379 |
|
380 | 380 |
struct SetStandardProcessedMapTraits : public Traits { |
381 | 381 |
typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
382 | 382 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
383 | 383 |
{ |
384 | 384 |
return new ProcessedMap(g); |
385 | 385 |
} |
386 | 386 |
}; |
387 | 387 |
///\brief \ref named-templ-param "Named parameter" for setting |
388 |
/// |
|
388 |
///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
|
389 | 389 |
/// |
390 | 390 |
///\ref named-templ-param "Named parameter" for setting |
391 |
/// |
|
391 |
///ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
|
392 | 392 |
///If you don't set it explicitly, it will be automatically allocated. |
393 | 393 |
struct SetStandardProcessedMap |
394 | 394 |
: public Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits > { |
395 | 395 |
typedef Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits > |
396 | 396 |
Create; |
397 | 397 |
}; |
398 | 398 |
|
399 | 399 |
template <class H, class CR> |
400 | 400 |
struct SetHeapTraits : public Traits { |
401 | 401 |
typedef CR HeapCrossRef; |
402 | 402 |
typedef H Heap; |
403 | 403 |
static HeapCrossRef *createHeapCrossRef(const Digraph &) { |
... | ... |
@@ -977,64 +977,64 @@ |
977 | 977 |
static Heap *createHeap(HeapCrossRef& r) |
978 | 978 |
{ |
979 | 979 |
return new Heap(r); |
980 | 980 |
} |
981 | 981 |
|
982 | 982 |
///\brief The type of the map that stores the predecessor |
983 | 983 |
///arcs of the shortest paths. |
984 | 984 |
/// |
985 | 985 |
///The type of the map that stores the predecessor |
986 | 986 |
///arcs of the shortest paths. |
987 | 987 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
988 | 988 |
typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap; |
989 |
///Instantiates a |
|
989 |
///Instantiates a PredMap. |
|
990 | 990 |
|
991 |
///This function instantiates a |
|
991 |
///This function instantiates a PredMap. |
|
992 | 992 |
///\param g is the digraph, to which we would like to define the |
993 |
/// |
|
993 |
///PredMap. |
|
994 | 994 |
static PredMap *createPredMap(const Digraph &g) |
995 | 995 |
{ |
996 | 996 |
return new PredMap(g); |
997 | 997 |
} |
998 | 998 |
|
999 | 999 |
///The type of the map that indicates which nodes are processed. |
1000 | 1000 |
|
1001 | 1001 |
///The type of the map that indicates which nodes are processed. |
1002 | 1002 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
1003 | 1003 |
///By default it is a NullMap. |
1004 | 1004 |
typedef NullMap<typename Digraph::Node,bool> ProcessedMap; |
1005 |
///Instantiates a |
|
1005 |
///Instantiates a ProcessedMap. |
|
1006 | 1006 |
|
1007 |
///This function instantiates a |
|
1007 |
///This function instantiates a ProcessedMap. |
|
1008 | 1008 |
///\param g is the digraph, to which |
1009 |
///we would like to define the |
|
1009 |
///we would like to define the ProcessedMap. |
|
1010 | 1010 |
#ifdef DOXYGEN |
1011 | 1011 |
static ProcessedMap *createProcessedMap(const Digraph &g) |
1012 | 1012 |
#else |
1013 | 1013 |
static ProcessedMap *createProcessedMap(const Digraph &) |
1014 | 1014 |
#endif |
1015 | 1015 |
{ |
1016 | 1016 |
return new ProcessedMap(); |
1017 | 1017 |
} |
1018 | 1018 |
|
1019 | 1019 |
///The type of the map that stores the distances of the nodes. |
1020 | 1020 |
|
1021 | 1021 |
///The type of the map that stores the distances of the nodes. |
1022 | 1022 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
1023 | 1023 |
typedef typename Digraph::template NodeMap<typename LM::Value> DistMap; |
1024 |
///Instantiates a |
|
1024 |
///Instantiates a DistMap. |
|
1025 | 1025 |
|
1026 |
///This function instantiates a |
|
1026 |
///This function instantiates a DistMap. |
|
1027 | 1027 |
///\param g is the digraph, to which we would like to define |
1028 |
///the |
|
1028 |
///the DistMap |
|
1029 | 1029 |
static DistMap *createDistMap(const Digraph &g) |
1030 | 1030 |
{ |
1031 | 1031 |
return new DistMap(g); |
1032 | 1032 |
} |
1033 | 1033 |
|
1034 | 1034 |
///The type of the shortest paths. |
1035 | 1035 |
|
1036 | 1036 |
///The type of the shortest paths. |
1037 | 1037 |
///It must meet the \ref concepts::Path "Path" concept. |
1038 | 1038 |
typedef lemon::Path<Digraph> Path; |
1039 | 1039 |
}; |
1040 | 1040 |
|
... | ... |
@@ -1189,64 +1189,64 @@ |
1189 | 1189 |
if (Base::_di) |
1190 | 1190 |
*reinterpret_cast<Value*>(Base::_di) = dijk.dist(t); |
1191 | 1191 |
return dijk.reached(t); |
1192 | 1192 |
} |
1193 | 1193 |
|
1194 | 1194 |
template<class T> |
1195 | 1195 |
struct SetPredMapBase : public Base { |
1196 | 1196 |
typedef T PredMap; |
1197 | 1197 |
static PredMap *createPredMap(const Digraph &) { return 0; }; |
1198 | 1198 |
SetPredMapBase(const TR &b) : TR(b) {} |
1199 | 1199 |
}; |
1200 | 1200 |
///\brief \ref named-func-param "Named parameter" |
1201 |
///for setting |
|
1201 |
///for setting PredMap object. |
|
1202 | 1202 |
/// |
1203 | 1203 |
///\ref named-func-param "Named parameter" |
1204 |
///for setting |
|
1204 |
///for setting PredMap object. |
|
1205 | 1205 |
template<class T> |
1206 | 1206 |
DijkstraWizard<SetPredMapBase<T> > predMap(const T &t) |
1207 | 1207 |
{ |
1208 | 1208 |
Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1209 | 1209 |
return DijkstraWizard<SetPredMapBase<T> >(*this); |
1210 | 1210 |
} |
1211 | 1211 |
|
1212 | 1212 |
template<class T> |
1213 | 1213 |
struct SetDistMapBase : public Base { |
1214 | 1214 |
typedef T DistMap; |
1215 | 1215 |
static DistMap *createDistMap(const Digraph &) { return 0; }; |
1216 | 1216 |
SetDistMapBase(const TR &b) : TR(b) {} |
1217 | 1217 |
}; |
1218 | 1218 |
///\brief \ref named-func-param "Named parameter" |
1219 |
///for setting |
|
1219 |
///for setting DistMap object. |
|
1220 | 1220 |
/// |
1221 | 1221 |
///\ref named-func-param "Named parameter" |
1222 |
///for setting |
|
1222 |
///for setting DistMap object. |
|
1223 | 1223 |
template<class T> |
1224 | 1224 |
DijkstraWizard<SetDistMapBase<T> > distMap(const T &t) |
1225 | 1225 |
{ |
1226 | 1226 |
Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1227 | 1227 |
return DijkstraWizard<SetDistMapBase<T> >(*this); |
1228 | 1228 |
} |
1229 | 1229 |
|
1230 | 1230 |
template<class T> |
1231 | 1231 |
struct SetProcessedMapBase : public Base { |
1232 | 1232 |
typedef T ProcessedMap; |
1233 | 1233 |
static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1234 | 1234 |
SetProcessedMapBase(const TR &b) : TR(b) {} |
1235 | 1235 |
}; |
1236 | 1236 |
///\brief \ref named-func-param "Named parameter" |
1237 |
///for setting |
|
1237 |
///for setting ProcessedMap object. |
|
1238 | 1238 |
/// |
1239 | 1239 |
/// \ref named-func-param "Named parameter" |
1240 |
///for setting |
|
1240 |
///for setting ProcessedMap object. |
|
1241 | 1241 |
template<class T> |
1242 | 1242 |
DijkstraWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
1243 | 1243 |
{ |
1244 | 1244 |
Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1245 | 1245 |
return DijkstraWizard<SetProcessedMapBase<T> >(*this); |
1246 | 1246 |
} |
1247 | 1247 |
|
1248 | 1248 |
template<class T> |
1249 | 1249 |
struct SetPathBase : public Base { |
1250 | 1250 |
typedef T Path; |
1251 | 1251 |
SetPathBase(const TR &b) : TR(b) {} |
1252 | 1252 |
}; |
... | ... |
@@ -64,40 +64,40 @@ |
64 | 64 |
class NullMap : public MapBase<K, V> { |
65 | 65 |
public: |
66 | 66 |
typedef MapBase<K, V> Parent; |
67 | 67 |
typedef typename Parent::Key Key; |
68 | 68 |
typedef typename Parent::Value Value; |
69 | 69 |
|
70 | 70 |
/// Gives back a default constructed element. |
71 | 71 |
Value operator[](const Key&) const { return Value(); } |
72 | 72 |
/// Absorbs the value. |
73 | 73 |
void set(const Key&, const Value&) {} |
74 | 74 |
}; |
75 | 75 |
|
76 |
/// Returns a \ref NullMap class |
|
77 |
|
|
78 |
/// |
|
76 |
/// Returns a \c NullMap class |
|
77 |
|
|
78 |
/// This function just returns a \c NullMap class. |
|
79 | 79 |
/// \relates NullMap |
80 | 80 |
template <typename K, typename V> |
81 | 81 |
NullMap<K, V> nullMap() { |
82 | 82 |
return NullMap<K, V>(); |
83 | 83 |
} |
84 | 84 |
|
85 | 85 |
|
86 | 86 |
/// Constant map. |
87 | 87 |
|
88 | 88 |
/// This \ref concepts::ReadMap "readable map" assigns a specified |
89 | 89 |
/// value to each key. |
90 | 90 |
/// |
91 |
/// In other aspects it is equivalent to \ |
|
91 |
/// In other aspects it is equivalent to \c NullMap. |
|
92 | 92 |
/// So it conforms the \ref concepts::ReadWriteMap "ReadWriteMap" |
93 | 93 |
/// concept, but it absorbs the data written to it. |
94 | 94 |
/// |
95 | 95 |
/// The simplest way of using this map is through the constMap() |
96 | 96 |
/// function. |
97 | 97 |
/// |
98 | 98 |
/// \sa NullMap |
99 | 99 |
/// \sa IdentityMap |
100 | 100 |
template<typename K, typename V> |
101 | 101 |
class ConstMap : public MapBase<K, V> { |
102 | 102 |
private: |
103 | 103 |
V _value; |
... | ... |
@@ -124,48 +124,48 @@ |
124 | 124 |
/// Absorbs the value. |
125 | 125 |
void set(const Key&, const Value&) {} |
126 | 126 |
|
127 | 127 |
/// Sets the value that is assigned to each key. |
128 | 128 |
void setAll(const Value &v) { |
129 | 129 |
_value = v; |
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
template<typename V1> |
133 | 133 |
ConstMap(const ConstMap<K, V1> &, const Value &v) : _value(v) {} |
134 | 134 |
}; |
135 | 135 |
|
136 |
/// Returns a \ref ConstMap class |
|
137 |
|
|
138 |
/// |
|
136 |
/// Returns a \c ConstMap class |
|
137 |
|
|
138 |
/// This function just returns a \c ConstMap class. |
|
139 | 139 |
/// \relates ConstMap |
140 | 140 |
template<typename K, typename V> |
141 | 141 |
inline ConstMap<K, V> constMap(const V &v) { |
142 | 142 |
return ConstMap<K, V>(v); |
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
template<typename K, typename V> |
146 | 146 |
inline ConstMap<K, V> constMap() { |
147 | 147 |
return ConstMap<K, V>(); |
148 | 148 |
} |
149 | 149 |
|
150 | 150 |
|
151 | 151 |
template<typename T, T v> |
152 | 152 |
struct Const {}; |
153 | 153 |
|
154 | 154 |
/// Constant map with inlined constant value. |
155 | 155 |
|
156 | 156 |
/// This \ref concepts::ReadMap "readable map" assigns a specified |
157 | 157 |
/// value to each key. |
158 | 158 |
/// |
159 |
/// In other aspects it is equivalent to \ |
|
159 |
/// In other aspects it is equivalent to \c NullMap. |
|
160 | 160 |
/// So it conforms the \ref concepts::ReadWriteMap "ReadWriteMap" |
161 | 161 |
/// concept, but it absorbs the data written to it. |
162 | 162 |
/// |
163 | 163 |
/// The simplest way of using this map is through the constMap() |
164 | 164 |
/// function. |
165 | 165 |
/// |
166 | 166 |
/// \sa NullMap |
167 | 167 |
/// \sa IdentityMap |
168 | 168 |
template<typename K, typename V, V v> |
169 | 169 |
class ConstMap<K, Const<V, v> > : public MapBase<K, V> { |
170 | 170 |
public: |
171 | 171 |
typedef MapBase<K, V> Parent; |
... | ... |
@@ -173,27 +173,27 @@ |
173 | 173 |
typedef typename Parent::Value Value; |
174 | 174 |
|
175 | 175 |
/// Constructor. |
176 | 176 |
ConstMap() {} |
177 | 177 |
|
178 | 178 |
/// Gives back the specified value. |
179 | 179 |
Value operator[](const Key&) const { return v; } |
180 | 180 |
|
181 | 181 |
/// Absorbs the value. |
182 | 182 |
void set(const Key&, const Value&) {} |
183 | 183 |
}; |
184 | 184 |
|
185 |
/// Returns a \ref ConstMap class with inlined constant value |
|
186 |
|
|
187 |
/// |
|
185 |
/// Returns a \c ConstMap class with inlined constant value |
|
186 |
|
|
187 |
/// This function just returns a \c ConstMap class with inlined |
|
188 | 188 |
/// constant value. |
189 | 189 |
/// \relates ConstMap |
190 | 190 |
template<typename K, typename V, V v> |
191 | 191 |
inline ConstMap<K, Const<V, v> > constMap() { |
192 | 192 |
return ConstMap<K, Const<V, v> >(); |
193 | 193 |
} |
194 | 194 |
|
195 | 195 |
|
196 | 196 |
/// Identity map. |
197 | 197 |
|
198 | 198 |
/// This \ref concepts::ReadMap "read-only map" gives back the given |
199 | 199 |
/// key as value without any modification. |
... | ... |
@@ -203,41 +203,41 @@ |
203 | 203 |
class IdentityMap : public MapBase<T, T> { |
204 | 204 |
public: |
205 | 205 |
typedef MapBase<T, T> Parent; |
206 | 206 |
typedef typename Parent::Key Key; |
207 | 207 |
typedef typename Parent::Value Value; |
208 | 208 |
|
209 | 209 |
/// Gives back the given value without any modification. |
210 | 210 |
Value operator[](const Key &k) const { |
211 | 211 |
return k; |
212 | 212 |
} |
213 | 213 |
}; |
214 | 214 |
|
215 |
/// Returns an \ref IdentityMap class |
|
216 |
|
|
217 |
/// |
|
215 |
/// Returns an \c IdentityMap class |
|
216 |
|
|
217 |
/// This function just returns an \c IdentityMap class. |
|
218 | 218 |
/// \relates IdentityMap |
219 | 219 |
template<typename T> |
220 | 220 |
inline IdentityMap<T> identityMap() { |
221 | 221 |
return IdentityMap<T>(); |
222 | 222 |
} |
223 | 223 |
|
224 | 224 |
|
225 | 225 |
/// \brief Map for storing values for integer keys from the range |
226 | 226 |
/// <tt>[0..size-1]</tt>. |
227 | 227 |
/// |
228 | 228 |
/// This map is essentially a wrapper for \c std::vector. It assigns |
229 | 229 |
/// values to integer keys from the range <tt>[0..size-1]</tt>. |
230 | 230 |
/// It can be used with some data structures, for example |
231 |
/// \ |
|
231 |
/// \c UnionFind, \c BinHeap, when the used items are small |
|
232 | 232 |
/// integers. This map conforms the \ref concepts::ReferenceMap |
233 | 233 |
/// "ReferenceMap" concept. |
234 | 234 |
/// |
235 | 235 |
/// The simplest way of using this map is through the rangeMap() |
236 | 236 |
/// function. |
237 | 237 |
template <typename V> |
238 | 238 |
class RangeMap : public MapBase<int, V> { |
239 | 239 |
template <typename V1> |
240 | 240 |
friend class RangeMap; |
241 | 241 |
private: |
242 | 242 |
|
243 | 243 |
typedef std::vector<V> Vector; |
... | ... |
@@ -259,25 +259,25 @@ |
259 | 259 |
|
260 | 260 |
public: |
261 | 261 |
|
262 | 262 |
/// Constructor with specified default value. |
263 | 263 |
RangeMap(int size = 0, const Value &value = Value()) |
264 | 264 |
: _vector(size, value) {} |
265 | 265 |
|
266 | 266 |
/// Constructs the map from an appropriate \c std::vector. |
267 | 267 |
template <typename V1> |
268 | 268 |
RangeMap(const std::vector<V1>& vector) |
269 | 269 |
: _vector(vector.begin(), vector.end()) {} |
270 | 270 |
|
271 |
/// Constructs the map from another \ |
|
271 |
/// Constructs the map from another \c RangeMap. |
|
272 | 272 |
template <typename V1> |
273 | 273 |
RangeMap(const RangeMap<V1> &c) |
274 | 274 |
: _vector(c._vector.begin(), c._vector.end()) {} |
275 | 275 |
|
276 | 276 |
/// Returns the size of the map. |
277 | 277 |
int size() { |
278 | 278 |
return _vector.size(); |
279 | 279 |
} |
280 | 280 |
|
281 | 281 |
/// Resizes the map. |
282 | 282 |
|
283 | 283 |
/// Resizes the underlying \c std::vector container, so changes the |
... | ... |
@@ -302,37 +302,37 @@ |
302 | 302 |
|
303 | 303 |
///\e |
304 | 304 |
ConstReference operator[](const Key &k) const { |
305 | 305 |
return _vector[k]; |
306 | 306 |
} |
307 | 307 |
|
308 | 308 |
///\e |
309 | 309 |
void set(const Key &k, const Value &v) { |
310 | 310 |
_vector[k] = v; |
311 | 311 |
} |
312 | 312 |
}; |
313 | 313 |
|
314 |
/// Returns a \ref RangeMap class |
|
315 |
|
|
316 |
/// |
|
314 |
/// Returns a \c RangeMap class |
|
315 |
|
|
316 |
/// This function just returns a \c RangeMap class. |
|
317 | 317 |
/// \relates RangeMap |
318 | 318 |
template<typename V> |
319 | 319 |
inline RangeMap<V> rangeMap(int size = 0, const V &value = V()) { |
320 | 320 |
return RangeMap<V>(size, value); |
321 | 321 |
} |
322 | 322 |
|
323 |
/// \brief Returns a \ |
|
323 |
/// \brief Returns a \c RangeMap class created from an appropriate |
|
324 | 324 |
/// \c std::vector |
325 | 325 |
|
326 |
/// This function just returns a \ |
|
326 |
/// This function just returns a \c RangeMap class created from an |
|
327 | 327 |
/// appropriate \c std::vector. |
328 | 328 |
/// \relates RangeMap |
329 | 329 |
template<typename V> |
330 | 330 |
inline RangeMap<V> rangeMap(const std::vector<V> &vector) { |
331 | 331 |
return RangeMap<V>(vector); |
332 | 332 |
} |
333 | 333 |
|
334 | 334 |
|
335 | 335 |
/// Map type based on \c std::map |
336 | 336 |
|
337 | 337 |
/// This map is essentially a wrapper for \c std::map with addition |
338 | 338 |
/// that you can specify a default value for the keys that are not |
... | ... |
@@ -379,25 +379,25 @@ |
379 | 379 |
|
380 | 380 |
public: |
381 | 381 |
|
382 | 382 |
/// \brief Constructor with specified default value. |
383 | 383 |
SparseMap(const Value &value = Value()) : _value(value) {} |
384 | 384 |
/// \brief Constructs the map from an appropriate \c std::map, and |
385 | 385 |
/// explicitly specifies a default value. |
386 | 386 |
template <typename V1, typename Comp1> |
387 | 387 |
SparseMap(const std::map<Key, V1, Comp1> &map, |
388 | 388 |
const Value &value = Value()) |
389 | 389 |
: _map(map.begin(), map.end()), _value(value) {} |
390 | 390 |
|
391 |
/// \brief Constructs the map from another \ |
|
391 |
/// \brief Constructs the map from another \c SparseMap. |
|
392 | 392 |
template<typename V1, typename Comp1> |
393 | 393 |
SparseMap(const SparseMap<Key, V1, Comp1> &c) |
394 | 394 |
: _map(c._map.begin(), c._map.end()), _value(c._value) {} |
395 | 395 |
|
396 | 396 |
private: |
397 | 397 |
|
398 | 398 |
SparseMap& operator=(const SparseMap&); |
399 | 399 |
|
400 | 400 |
public: |
401 | 401 |
|
402 | 402 |
///\e |
403 | 403 |
Reference operator[](const Key &k) { |
... | ... |
@@ -424,43 +424,43 @@ |
424 | 424 |
it->second = v; |
425 | 425 |
else |
426 | 426 |
_map.insert(it, std::make_pair(k, v)); |
427 | 427 |
} |
428 | 428 |
|
429 | 429 |
///\e |
430 | 430 |
void setAll(const Value &v) { |
431 | 431 |
_value = v; |
432 | 432 |
_map.clear(); |
433 | 433 |
} |
434 | 434 |
}; |
435 | 435 |
|
436 |
/// Returns a \ref SparseMap class |
|
437 |
|
|
438 |
/// |
|
436 |
/// Returns a \c SparseMap class |
|
437 |
|
|
438 |
/// This function just returns a \c SparseMap class with specified |
|
439 | 439 |
/// default value. |
440 | 440 |
/// \relates SparseMap |
441 | 441 |
template<typename K, typename V, typename Compare> |
442 | 442 |
inline SparseMap<K, V, Compare> sparseMap(const V& value = V()) { |
443 | 443 |
return SparseMap<K, V, Compare>(value); |
444 | 444 |
} |
445 | 445 |
|
446 | 446 |
template<typename K, typename V> |
447 | 447 |
inline SparseMap<K, V, std::less<K> > sparseMap(const V& value = V()) { |
448 | 448 |
return SparseMap<K, V, std::less<K> >(value); |
449 | 449 |
} |
450 | 450 |
|
451 |
/// \brief Returns a \ |
|
451 |
/// \brief Returns a \c SparseMap class created from an appropriate |
|
452 | 452 |
/// \c std::map |
453 | 453 |
|
454 |
/// This function just returns a \ |
|
454 |
/// This function just returns a \c SparseMap class created from an |
|
455 | 455 |
/// appropriate \c std::map. |
456 | 456 |
/// \relates SparseMap |
457 | 457 |
template<typename K, typename V, typename Compare> |
458 | 458 |
inline SparseMap<K, V, Compare> |
459 | 459 |
sparseMap(const std::map<K, V, Compare> &map, const V& value = V()) |
460 | 460 |
{ |
461 | 461 |
return SparseMap<K, V, Compare>(map, value); |
462 | 462 |
} |
463 | 463 |
|
464 | 464 |
/// @} |
465 | 465 |
|
466 | 466 |
/// \addtogroup map_adaptors |
... | ... |
@@ -492,27 +492,27 @@ |
492 | 492 |
typedef MapBase<typename M2::Key, typename M1::Value> Parent; |
493 | 493 |
typedef typename Parent::Key Key; |
494 | 494 |
typedef typename Parent::Value Value; |
495 | 495 |
|
496 | 496 |
/// Constructor |
497 | 497 |
ComposeMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
498 | 498 |
|
499 | 499 |
/// \e |
500 | 500 |
typename MapTraits<M1>::ConstReturnValue |
501 | 501 |
operator[](const Key &k) const { return _m1[_m2[k]]; } |
502 | 502 |
}; |
503 | 503 |
|
504 |
/// Returns a \ref ComposeMap class |
|
505 |
|
|
506 |
/// |
|
504 |
/// Returns a \c ComposeMap class |
|
505 |
|
|
506 |
/// This function just returns a \c ComposeMap class. |
|
507 | 507 |
/// |
508 | 508 |
/// If \c m1 and \c m2 are maps and the \c Value type of \c m2 is |
509 | 509 |
/// convertible to the \c Key of \c m1, then <tt>composeMap(m1,m2)[x]</tt> |
510 | 510 |
/// will be equal to <tt>m1[m2[x]]</tt>. |
511 | 511 |
/// |
512 | 512 |
/// \relates ComposeMap |
513 | 513 |
template <typename M1, typename M2> |
514 | 514 |
inline ComposeMap<M1, M2> composeMap(const M1 &m1, const M2 &m2) { |
515 | 515 |
return ComposeMap<M1, M2>(m1, m2); |
516 | 516 |
} |
517 | 517 |
|
518 | 518 |
|
... | ... |
@@ -547,27 +547,27 @@ |
547 | 547 |
public: |
548 | 548 |
typedef MapBase<typename M1::Key, V> Parent; |
549 | 549 |
typedef typename Parent::Key Key; |
550 | 550 |
typedef typename Parent::Value Value; |
551 | 551 |
|
552 | 552 |
/// Constructor |
553 | 553 |
CombineMap(const M1 &m1, const M2 &m2, const F &f = F()) |
554 | 554 |
: _m1(m1), _m2(m2), _f(f) {} |
555 | 555 |
/// \e |
556 | 556 |
Value operator[](const Key &k) const { return _f(_m1[k],_m2[k]); } |
557 | 557 |
}; |
558 | 558 |
|
559 |
/// Returns a \ref CombineMap class |
|
560 |
|
|
561 |
/// |
|
559 |
/// Returns a \c CombineMap class |
|
560 |
|
|
561 |
/// This function just returns a \c CombineMap class. |
|
562 | 562 |
/// |
563 | 563 |
/// For example, if \c m1 and \c m2 are both maps with \c double |
564 | 564 |
/// values, then |
565 | 565 |
/// \code |
566 | 566 |
/// combineMap(m1,m2,std::plus<double>()) |
567 | 567 |
/// \endcode |
568 | 568 |
/// is equivalent to |
569 | 569 |
/// \code |
570 | 570 |
/// addMap(m1,m2) |
571 | 571 |
/// \endcode |
572 | 572 |
/// |
573 | 573 |
/// This function is specialized for adaptable binary function |
... | ... |
@@ -616,27 +616,27 @@ |
616 | 616 |
F _f; |
617 | 617 |
public: |
618 | 618 |
typedef MapBase<K, V> Parent; |
619 | 619 |
typedef typename Parent::Key Key; |
620 | 620 |
typedef typename Parent::Value Value; |
621 | 621 |
|
622 | 622 |
/// Constructor |
623 | 623 |
FunctorToMap(const F &f = F()) : _f(f) {} |
624 | 624 |
/// \e |
625 | 625 |
Value operator[](const Key &k) const { return _f(k); } |
626 | 626 |
}; |
627 | 627 |
|
628 |
/// Returns a \ref FunctorToMap class |
|
629 |
|
|
630 |
/// |
|
628 |
/// Returns a \c FunctorToMap class |
|
629 |
|
|
630 |
/// This function just returns a \c FunctorToMap class. |
|
631 | 631 |
/// |
632 | 632 |
/// This function is specialized for adaptable binary function |
633 | 633 |
/// classes and C++ functions. |
634 | 634 |
/// |
635 | 635 |
/// \relates FunctorToMap |
636 | 636 |
template<typename K, typename V, typename F> |
637 | 637 |
inline FunctorToMap<F, K, V> functorToMap(const F &f) { |
638 | 638 |
return FunctorToMap<F, K, V>(f); |
639 | 639 |
} |
640 | 640 |
|
641 | 641 |
template <typename F> |
642 | 642 |
inline FunctorToMap<F, typename F::argument_type, typename F::result_type> |
... | ... |
@@ -675,27 +675,27 @@ |
675 | 675 |
|
676 | 676 |
typedef typename Parent::Key argument_type; |
677 | 677 |
typedef typename Parent::Value result_type; |
678 | 678 |
|
679 | 679 |
/// Constructor |
680 | 680 |
MapToFunctor(const M &m) : _m(m) {} |
681 | 681 |
/// \e |
682 | 682 |
Value operator()(const Key &k) const { return _m[k]; } |
683 | 683 |
/// \e |
684 | 684 |
Value operator[](const Key &k) const { return _m[k]; } |
685 | 685 |
}; |
686 | 686 |
|
687 |
/// Returns a \ref MapToFunctor class |
|
688 |
|
|
689 |
/// |
|
687 |
/// Returns a \c MapToFunctor class |
|
688 |
|
|
689 |
/// This function just returns a \c MapToFunctor class. |
|
690 | 690 |
/// \relates MapToFunctor |
691 | 691 |
template<typename M> |
692 | 692 |
inline MapToFunctor<M> mapToFunctor(const M &m) { |
693 | 693 |
return MapToFunctor<M>(m); |
694 | 694 |
} |
695 | 695 |
|
696 | 696 |
|
697 | 697 |
/// \brief Map adaptor to convert the \c Value type of a map to |
698 | 698 |
/// another type using the default conversion. |
699 | 699 |
|
700 | 700 |
/// Map adaptor to convert the \c Value type of a \ref concepts::ReadMap |
701 | 701 |
/// "readable map" to another type using the default conversion. |
... | ... |
@@ -714,27 +714,27 @@ |
714 | 714 |
typedef typename Parent::Value Value; |
715 | 715 |
|
716 | 716 |
/// Constructor |
717 | 717 |
|
718 | 718 |
/// Constructor. |
719 | 719 |
/// \param m The underlying map. |
720 | 720 |
ConvertMap(const M &m) : _m(m) {} |
721 | 721 |
|
722 | 722 |
/// \e |
723 | 723 |
Value operator[](const Key &k) const { return _m[k]; } |
724 | 724 |
}; |
725 | 725 |
|
726 |
/// Returns a \ref ConvertMap class |
|
727 |
|
|
728 |
/// |
|
726 |
/// Returns a \c ConvertMap class |
|
727 |
|
|
728 |
/// This function just returns a \c ConvertMap class. |
|
729 | 729 |
/// \relates ConvertMap |
730 | 730 |
template<typename V, typename M> |
731 | 731 |
inline ConvertMap<M, V> convertMap(const M &map) { |
732 | 732 |
return ConvertMap<M, V>(map); |
733 | 733 |
} |
734 | 734 |
|
735 | 735 |
|
736 | 736 |
/// Applies all map setting operations to two maps |
737 | 737 |
|
738 | 738 |
/// This map has two \ref concepts::WriteMap "writable map" parameters |
739 | 739 |
/// and each write request will be passed to both of them. |
740 | 740 |
/// If \c M1 is also \ref concepts::ReadMap "readable", then the read |
... | ... |
@@ -754,27 +754,27 @@ |
754 | 754 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
755 | 755 |
typedef typename Parent::Key Key; |
756 | 756 |
typedef typename Parent::Value Value; |
757 | 757 |
|
758 | 758 |
/// Constructor |
759 | 759 |
ForkMap(M1 &m1, M2 &m2) : _m1(m1), _m2(m2) {} |
760 | 760 |
/// Returns the value associated with the given key in the first map. |
761 | 761 |
Value operator[](const Key &k) const { return _m1[k]; } |
762 | 762 |
/// Sets the value associated with the given key in both maps. |
763 | 763 |
void set(const Key &k, const Value &v) { _m1.set(k,v); _m2.set(k,v); } |
764 | 764 |
}; |
765 | 765 |
|
766 |
/// Returns a \ref ForkMap class |
|
767 |
|
|
768 |
/// |
|
766 |
/// Returns a \c ForkMap class |
|
767 |
|
|
768 |
/// This function just returns a \c ForkMap class. |
|
769 | 769 |
/// \relates ForkMap |
770 | 770 |
template <typename M1, typename M2> |
771 | 771 |
inline ForkMap<M1,M2> forkMap(M1 &m1, M2 &m2) { |
772 | 772 |
return ForkMap<M1,M2>(m1,m2); |
773 | 773 |
} |
774 | 774 |
|
775 | 775 |
|
776 | 776 |
/// Sum of two maps |
777 | 777 |
|
778 | 778 |
/// This \ref concepts::ReadMap "read-only map" returns the sum |
779 | 779 |
/// of the values of the two given maps. |
780 | 780 |
/// Its \c Key and \c Value types are inherited from \c M1. |
... | ... |
@@ -798,27 +798,27 @@ |
798 | 798 |
const M2 &_m2; |
799 | 799 |
public: |
800 | 800 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
801 | 801 |
typedef typename Parent::Key Key; |
802 | 802 |
typedef typename Parent::Value Value; |
803 | 803 |
|
804 | 804 |
/// Constructor |
805 | 805 |
AddMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
806 | 806 |
/// \e |
807 | 807 |
Value operator[](const Key &k) const { return _m1[k]+_m2[k]; } |
808 | 808 |
}; |
809 | 809 |
|
810 |
/// Returns an \ref AddMap class |
|
811 |
|
|
812 |
/// |
|
810 |
/// Returns an \c AddMap class |
|
811 |
|
|
812 |
/// This function just returns an \c AddMap class. |
|
813 | 813 |
/// |
814 | 814 |
/// For example, if \c m1 and \c m2 are both maps with \c double |
815 | 815 |
/// values, then <tt>addMap(m1,m2)[x]</tt> will be equal to |
816 | 816 |
/// <tt>m1[x]+m2[x]</tt>. |
817 | 817 |
/// |
818 | 818 |
/// \relates AddMap |
819 | 819 |
template<typename M1, typename M2> |
820 | 820 |
inline AddMap<M1, M2> addMap(const M1 &m1, const M2 &m2) { |
821 | 821 |
return AddMap<M1, M2>(m1,m2); |
822 | 822 |
} |
823 | 823 |
|
824 | 824 |
|
... | ... |
@@ -846,27 +846,27 @@ |
846 | 846 |
const M2 &_m2; |
847 | 847 |
public: |
848 | 848 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
849 | 849 |
typedef typename Parent::Key Key; |
850 | 850 |
typedef typename Parent::Value Value; |
851 | 851 |
|
852 | 852 |
/// Constructor |
853 | 853 |
SubMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
854 | 854 |
/// \e |
855 | 855 |
Value operator[](const Key &k) const { return _m1[k]-_m2[k]; } |
856 | 856 |
}; |
857 | 857 |
|
858 |
/// Returns a \ref SubMap class |
|
859 |
|
|
860 |
/// |
|
858 |
/// Returns a \c SubMap class |
|
859 |
|
|
860 |
/// This function just returns a \c SubMap class. |
|
861 | 861 |
/// |
862 | 862 |
/// For example, if \c m1 and \c m2 are both maps with \c double |
863 | 863 |
/// values, then <tt>subMap(m1,m2)[x]</tt> will be equal to |
864 | 864 |
/// <tt>m1[x]-m2[x]</tt>. |
865 | 865 |
/// |
866 | 866 |
/// \relates SubMap |
867 | 867 |
template<typename M1, typename M2> |
868 | 868 |
inline SubMap<M1, M2> subMap(const M1 &m1, const M2 &m2) { |
869 | 869 |
return SubMap<M1, M2>(m1,m2); |
870 | 870 |
} |
871 | 871 |
|
872 | 872 |
|
... | ... |
@@ -895,27 +895,27 @@ |
895 | 895 |
const M2 &_m2; |
896 | 896 |
public: |
897 | 897 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
898 | 898 |
typedef typename Parent::Key Key; |
899 | 899 |
typedef typename Parent::Value Value; |
900 | 900 |
|
901 | 901 |
/// Constructor |
902 | 902 |
MulMap(const M1 &m1,const M2 &m2) : _m1(m1), _m2(m2) {} |
903 | 903 |
/// \e |
904 | 904 |
Value operator[](const Key &k) const { return _m1[k]*_m2[k]; } |
905 | 905 |
}; |
906 | 906 |
|
907 |
/// Returns a \ref MulMap class |
|
908 |
|
|
909 |
/// |
|
907 |
/// Returns a \c MulMap class |
|
908 |
|
|
909 |
/// This function just returns a \c MulMap class. |
|
910 | 910 |
/// |
911 | 911 |
/// For example, if \c m1 and \c m2 are both maps with \c double |
912 | 912 |
/// values, then <tt>mulMap(m1,m2)[x]</tt> will be equal to |
913 | 913 |
/// <tt>m1[x]*m2[x]</tt>. |
914 | 914 |
/// |
915 | 915 |
/// \relates MulMap |
916 | 916 |
template<typename M1, typename M2> |
917 | 917 |
inline MulMap<M1, M2> mulMap(const M1 &m1,const M2 &m2) { |
918 | 918 |
return MulMap<M1, M2>(m1,m2); |
919 | 919 |
} |
920 | 920 |
|
921 | 921 |
|
... | ... |
@@ -943,27 +943,27 @@ |
943 | 943 |
const M2 &_m2; |
944 | 944 |
public: |
945 | 945 |
typedef MapBase<typename M1::Key, typename M1::Value> Parent; |
946 | 946 |
typedef typename Parent::Key Key; |
947 | 947 |
typedef typename Parent::Value Value; |
948 | 948 |
|
949 | 949 |
/// Constructor |
950 | 950 |
DivMap(const M1 &m1,const M2 &m2) : _m1(m1), _m2(m2) {} |
951 | 951 |
/// \e |
952 | 952 |
Value operator[](const Key &k) const { return _m1[k]/_m2[k]; } |
953 | 953 |
}; |
954 | 954 |
|
955 |
/// Returns a \ref DivMap class |
|
956 |
|
|
957 |
/// |
|
955 |
/// Returns a \c DivMap class |
|
956 |
|
|
957 |
/// This function just returns a \c DivMap class. |
|
958 | 958 |
/// |
959 | 959 |
/// For example, if \c m1 and \c m2 are both maps with \c double |
960 | 960 |
/// values, then <tt>divMap(m1,m2)[x]</tt> will be equal to |
961 | 961 |
/// <tt>m1[x]/m2[x]</tt>. |
962 | 962 |
/// |
963 | 963 |
/// \relates DivMap |
964 | 964 |
template<typename M1, typename M2> |
965 | 965 |
inline DivMap<M1, M2> divMap(const M1 &m1,const M2 &m2) { |
966 | 966 |
return DivMap<M1, M2>(m1,m2); |
967 | 967 |
} |
968 | 968 |
|
969 | 969 |
|
... | ... |
@@ -1029,41 +1029,41 @@ |
1029 | 1029 |
/// Constructor |
1030 | 1030 |
|
1031 | 1031 |
/// Constructor. |
1032 | 1032 |
/// \param m The undelying map. |
1033 | 1033 |
/// \param v The constant value. |
1034 | 1034 |
ShiftWriteMap(M &m, const C &v) : _m(m), _v(v) {} |
1035 | 1035 |
/// \e |
1036 | 1036 |
Value operator[](const Key &k) const { return _m[k]+_v; } |
1037 | 1037 |
/// \e |
1038 | 1038 |
void set(const Key &k, const Value &v) { _m.set(k, v-_v); } |
1039 | 1039 |
}; |
1040 | 1040 |
|
1041 |
/// Returns a \ref ShiftMap class |
|
1042 |
|
|
1043 |
/// |
|
1041 |
/// Returns a \c ShiftMap class |
|
1042 |
|
|
1043 |
/// This function just returns a \c ShiftMap class. |
|
1044 | 1044 |
/// |
1045 | 1045 |
/// For example, if \c m is a map with \c double values and \c v is |
1046 | 1046 |
/// \c double, then <tt>shiftMap(m,v)[x]</tt> will be equal to |
1047 | 1047 |
/// <tt>m[x]+v</tt>. |
1048 | 1048 |
/// |
1049 | 1049 |
/// \relates ShiftMap |
1050 | 1050 |
template<typename M, typename C> |
1051 | 1051 |
inline ShiftMap<M, C> shiftMap(const M &m, const C &v) { |
1052 | 1052 |
return ShiftMap<M, C>(m,v); |
1053 | 1053 |
} |
1054 | 1054 |
|
1055 |
/// Returns a \ref ShiftWriteMap class |
|
1056 |
|
|
1057 |
/// |
|
1055 |
/// Returns a \c ShiftWriteMap class |
|
1056 |
|
|
1057 |
/// This function just returns a \c ShiftWriteMap class. |
|
1058 | 1058 |
/// |
1059 | 1059 |
/// For example, if \c m is a map with \c double values and \c v is |
1060 | 1060 |
/// \c double, then <tt>shiftWriteMap(m,v)[x]</tt> will be equal to |
1061 | 1061 |
/// <tt>m[x]+v</tt>. |
1062 | 1062 |
/// Moreover it makes also possible to write the map. |
1063 | 1063 |
/// |
1064 | 1064 |
/// \relates ShiftWriteMap |
1065 | 1065 |
template<typename M, typename C> |
1066 | 1066 |
inline ShiftWriteMap<M, C> shiftWriteMap(M &m, const C &v) { |
1067 | 1067 |
return ShiftWriteMap<M, C>(m,v); |
1068 | 1068 |
} |
1069 | 1069 |
|
... | ... |
@@ -1131,41 +1131,41 @@ |
1131 | 1131 |
/// Constructor |
1132 | 1132 |
|
1133 | 1133 |
/// Constructor. |
1134 | 1134 |
/// \param m The undelying map. |
1135 | 1135 |
/// \param v The constant value. |
1136 | 1136 |
ScaleWriteMap(M &m, const C &v) : _m(m), _v(v) {} |
1137 | 1137 |
/// \e |
1138 | 1138 |
Value operator[](const Key &k) const { return _v*_m[k]; } |
1139 | 1139 |
/// \e |
1140 | 1140 |
void set(const Key &k, const Value &v) { _m.set(k, v/_v); } |
1141 | 1141 |
}; |
1142 | 1142 |
|
1143 |
/// Returns a \ref ScaleMap class |
|
1144 |
|
|
1145 |
/// |
|
1143 |
/// Returns a \c ScaleMap class |
|
1144 |
|
|
1145 |
/// This function just returns a \c ScaleMap class. |
|
1146 | 1146 |
/// |
1147 | 1147 |
/// For example, if \c m is a map with \c double values and \c v is |
1148 | 1148 |
/// \c double, then <tt>scaleMap(m,v)[x]</tt> will be equal to |
1149 | 1149 |
/// <tt>v*m[x]</tt>. |
1150 | 1150 |
/// |
1151 | 1151 |
/// \relates ScaleMap |
1152 | 1152 |
template<typename M, typename C> |
1153 | 1153 |
inline ScaleMap<M, C> scaleMap(const M &m, const C &v) { |
1154 | 1154 |
return ScaleMap<M, C>(m,v); |
1155 | 1155 |
} |
1156 | 1156 |
|
1157 |
/// Returns a \ref ScaleWriteMap class |
|
1158 |
|
|
1159 |
/// |
|
1157 |
/// Returns a \c ScaleWriteMap class |
|
1158 |
|
|
1159 |
/// This function just returns a \c ScaleWriteMap class. |
|
1160 | 1160 |
/// |
1161 | 1161 |
/// For example, if \c m is a map with \c double values and \c v is |
1162 | 1162 |
/// \c double, then <tt>scaleWriteMap(m,v)[x]</tt> will be equal to |
1163 | 1163 |
/// <tt>v*m[x]</tt>. |
1164 | 1164 |
/// Moreover it makes also possible to write the map. |
1165 | 1165 |
/// |
1166 | 1166 |
/// \relates ScaleWriteMap |
1167 | 1167 |
template<typename M, typename C> |
1168 | 1168 |
inline ScaleWriteMap<M, C> scaleWriteMap(M &m, const C &v) { |
1169 | 1169 |
return ScaleWriteMap<M, C>(m,v); |
1170 | 1170 |
} |
1171 | 1171 |
|
... | ... |
@@ -1231,40 +1231,40 @@ |
1231 | 1231 |
typedef MapBase<typename M::Key, typename M::Value> Parent; |
1232 | 1232 |
typedef typename Parent::Key Key; |
1233 | 1233 |
typedef typename Parent::Value Value; |
1234 | 1234 |
|
1235 | 1235 |
/// Constructor |
1236 | 1236 |
NegWriteMap(M &m) : _m(m) {} |
1237 | 1237 |
/// \e |
1238 | 1238 |
Value operator[](const Key &k) const { return -_m[k]; } |
1239 | 1239 |
/// \e |
1240 | 1240 |
void set(const Key &k, const Value &v) { _m.set(k, -v); } |
1241 | 1241 |
}; |
1242 | 1242 |
|
1243 |
/// Returns a \ref NegMap class |
|
1244 |
|
|
1245 |
/// |
|
1243 |
/// Returns a \c NegMap class |
|
1244 |
|
|
1245 |
/// This function just returns a \c NegMap class. |
|
1246 | 1246 |
/// |
1247 | 1247 |
/// For example, if \c m is a map with \c double values, then |
1248 | 1248 |
/// <tt>negMap(m)[x]</tt> will be equal to <tt>-m[x]</tt>. |
1249 | 1249 |
/// |
1250 | 1250 |
/// \relates NegMap |
1251 | 1251 |
template <typename M> |
1252 | 1252 |
inline NegMap<M> negMap(const M &m) { |
1253 | 1253 |
return NegMap<M>(m); |
1254 | 1254 |
} |
1255 | 1255 |
|
1256 |
/// Returns a \ref NegWriteMap class |
|
1257 |
|
|
1258 |
/// |
|
1256 |
/// Returns a \c NegWriteMap class |
|
1257 |
|
|
1258 |
/// This function just returns a \c NegWriteMap class. |
|
1259 | 1259 |
/// |
1260 | 1260 |
/// For example, if \c m is a map with \c double values, then |
1261 | 1261 |
/// <tt>negWriteMap(m)[x]</tt> will be equal to <tt>-m[x]</tt>. |
1262 | 1262 |
/// Moreover it makes also possible to write the map. |
1263 | 1263 |
/// |
1264 | 1264 |
/// \relates NegWriteMap |
1265 | 1265 |
template <typename M> |
1266 | 1266 |
inline NegWriteMap<M> negWriteMap(M &m) { |
1267 | 1267 |
return NegWriteMap<M>(m); |
1268 | 1268 |
} |
1269 | 1269 |
|
1270 | 1270 |
|
... | ... |
@@ -1287,27 +1287,27 @@ |
1287 | 1287 |
typedef typename Parent::Value Value; |
1288 | 1288 |
|
1289 | 1289 |
/// Constructor |
1290 | 1290 |
AbsMap(const M &m) : _m(m) {} |
1291 | 1291 |
/// \e |
1292 | 1292 |
Value operator[](const Key &k) const { |
1293 | 1293 |
Value tmp = _m[k]; |
1294 | 1294 |
return tmp >= 0 ? tmp : -tmp; |
1295 | 1295 |
} |
1296 | 1296 |
|
1297 | 1297 |
}; |
1298 | 1298 |
|
1299 |
/// Returns an \ref AbsMap class |
|
1300 |
|
|
1301 |
/// |
|
1299 |
/// Returns an \c AbsMap class |
|
1300 |
|
|
1301 |
/// This function just returns an \c AbsMap class. |
|
1302 | 1302 |
/// |
1303 | 1303 |
/// For example, if \c m is a map with \c double values, then |
1304 | 1304 |
/// <tt>absMap(m)[x]</tt> will be equal to <tt>m[x]</tt> if |
1305 | 1305 |
/// it is positive or zero and <tt>-m[x]</tt> if <tt>m[x]</tt> is |
1306 | 1306 |
/// negative. |
1307 | 1307 |
/// |
1308 | 1308 |
/// \relates AbsMap |
1309 | 1309 |
template<typename M> |
1310 | 1310 |
inline AbsMap<M> absMap(const M &m) { |
1311 | 1311 |
return AbsMap<M>(m); |
1312 | 1312 |
} |
1313 | 1313 |
|
... | ... |
@@ -1336,27 +1336,27 @@ |
1336 | 1336 |
/// \sa ConstMap |
1337 | 1337 |
template <typename K> |
1338 | 1338 |
class TrueMap : public MapBase<K, bool> { |
1339 | 1339 |
public: |
1340 | 1340 |
typedef MapBase<K, bool> Parent; |
1341 | 1341 |
typedef typename Parent::Key Key; |
1342 | 1342 |
typedef typename Parent::Value Value; |
1343 | 1343 |
|
1344 | 1344 |
/// Gives back \c true. |
1345 | 1345 |
Value operator[](const Key&) const { return true; } |
1346 | 1346 |
}; |
1347 | 1347 |
|
1348 |
/// Returns a \ref TrueMap class |
|
1349 |
|
|
1350 |
/// |
|
1348 |
/// Returns a \c TrueMap class |
|
1349 |
|
|
1350 |
/// This function just returns a \c TrueMap class. |
|
1351 | 1351 |
/// \relates TrueMap |
1352 | 1352 |
template<typename K> |
1353 | 1353 |
inline TrueMap<K> trueMap() { |
1354 | 1354 |
return TrueMap<K>(); |
1355 | 1355 |
} |
1356 | 1356 |
|
1357 | 1357 |
|
1358 | 1358 |
/// Constant \c false map. |
1359 | 1359 |
|
1360 | 1360 |
/// This \ref concepts::ReadMap "read-only map" assigns \c false to |
1361 | 1361 |
/// each key. |
1362 | 1362 |
/// |
... | ... |
@@ -1373,27 +1373,27 @@ |
1373 | 1373 |
/// \sa ConstMap |
1374 | 1374 |
template <typename K> |
1375 | 1375 |
class FalseMap : public MapBase<K, bool> { |
1376 | 1376 |
public: |
1377 | 1377 |
typedef MapBase<K, bool> Parent; |
1378 | 1378 |
typedef typename Parent::Key Key; |
1379 | 1379 |
typedef typename Parent::Value Value; |
1380 | 1380 |
|
1381 | 1381 |
/// Gives back \c false. |
1382 | 1382 |
Value operator[](const Key&) const { return false; } |
1383 | 1383 |
}; |
1384 | 1384 |
|
1385 |
/// Returns a \ref FalseMap class |
|
1386 |
|
|
1387 |
/// |
|
1385 |
/// Returns a \c FalseMap class |
|
1386 |
|
|
1387 |
/// This function just returns a \c FalseMap class. |
|
1388 | 1388 |
/// \relates FalseMap |
1389 | 1389 |
template<typename K> |
1390 | 1390 |
inline FalseMap<K> falseMap() { |
1391 | 1391 |
return FalseMap<K>(); |
1392 | 1392 |
} |
1393 | 1393 |
|
1394 | 1394 |
/// @} |
1395 | 1395 |
|
1396 | 1396 |
/// \addtogroup map_adaptors |
1397 | 1397 |
/// @{ |
1398 | 1398 |
|
1399 | 1399 |
/// Logical 'and' of two maps |
... | ... |
@@ -1420,27 +1420,27 @@ |
1420 | 1420 |
const M2 &_m2; |
1421 | 1421 |
public: |
1422 | 1422 |
typedef MapBase<typename M1::Key, bool> Parent; |
1423 | 1423 |
typedef typename Parent::Key Key; |
1424 | 1424 |
typedef typename Parent::Value Value; |
1425 | 1425 |
|
1426 | 1426 |
/// Constructor |
1427 | 1427 |
AndMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
1428 | 1428 |
/// \e |
1429 | 1429 |
Value operator[](const Key &k) const { return _m1[k]&&_m2[k]; } |
1430 | 1430 |
}; |
1431 | 1431 |
|
1432 |
/// Returns an \ref AndMap class |
|
1433 |
|
|
1434 |
/// |
|
1432 |
/// Returns an \c AndMap class |
|
1433 |
|
|
1434 |
/// This function just returns an \c AndMap class. |
|
1435 | 1435 |
/// |
1436 | 1436 |
/// For example, if \c m1 and \c m2 are both maps with \c bool values, |
1437 | 1437 |
/// then <tt>andMap(m1,m2)[x]</tt> will be equal to |
1438 | 1438 |
/// <tt>m1[x]&&m2[x]</tt>. |
1439 | 1439 |
/// |
1440 | 1440 |
/// \relates AndMap |
1441 | 1441 |
template<typename M1, typename M2> |
1442 | 1442 |
inline AndMap<M1, M2> andMap(const M1 &m1, const M2 &m2) { |
1443 | 1443 |
return AndMap<M1, M2>(m1,m2); |
1444 | 1444 |
} |
1445 | 1445 |
|
1446 | 1446 |
|
... | ... |
@@ -1468,27 +1468,27 @@ |
1468 | 1468 |
const M2 &_m2; |
1469 | 1469 |
public: |
1470 | 1470 |
typedef MapBase<typename M1::Key, bool> Parent; |
1471 | 1471 |
typedef typename Parent::Key Key; |
1472 | 1472 |
typedef typename Parent::Value Value; |
1473 | 1473 |
|
1474 | 1474 |
/// Constructor |
1475 | 1475 |
OrMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
1476 | 1476 |
/// \e |
1477 | 1477 |
Value operator[](const Key &k) const { return _m1[k]||_m2[k]; } |
1478 | 1478 |
}; |
1479 | 1479 |
|
1480 |
/// Returns an \ref OrMap class |
|
1481 |
|
|
1482 |
/// |
|
1480 |
/// Returns an \c OrMap class |
|
1481 |
|
|
1482 |
/// This function just returns an \c OrMap class. |
|
1483 | 1483 |
/// |
1484 | 1484 |
/// For example, if \c m1 and \c m2 are both maps with \c bool values, |
1485 | 1485 |
/// then <tt>orMap(m1,m2)[x]</tt> will be equal to |
1486 | 1486 |
/// <tt>m1[x]||m2[x]</tt>. |
1487 | 1487 |
/// |
1488 | 1488 |
/// \relates OrMap |
1489 | 1489 |
template<typename M1, typename M2> |
1490 | 1490 |
inline OrMap<M1, M2> orMap(const M1 &m1, const M2 &m2) { |
1491 | 1491 |
return OrMap<M1, M2>(m1,m2); |
1492 | 1492 |
} |
1493 | 1493 |
|
1494 | 1494 |
|
... | ... |
@@ -1535,40 +1535,40 @@ |
1535 | 1535 |
typedef MapBase<typename M::Key, bool> Parent; |
1536 | 1536 |
typedef typename Parent::Key Key; |
1537 | 1537 |
typedef typename Parent::Value Value; |
1538 | 1538 |
|
1539 | 1539 |
/// Constructor |
1540 | 1540 |
NotWriteMap(M &m) : _m(m) {} |
1541 | 1541 |
/// \e |
1542 | 1542 |
Value operator[](const Key &k) const { return !_m[k]; } |
1543 | 1543 |
/// \e |
1544 | 1544 |
void set(const Key &k, bool v) { _m.set(k, !v); } |
1545 | 1545 |
}; |
1546 | 1546 |
|
1547 |
/// Returns a \ref NotMap class |
|
1548 |
|
|
1549 |
/// |
|
1547 |
/// Returns a \c NotMap class |
|
1548 |
|
|
1549 |
/// This function just returns a \c NotMap class. |
|
1550 | 1550 |
/// |
1551 | 1551 |
/// For example, if \c m is a map with \c bool values, then |
1552 | 1552 |
/// <tt>notMap(m)[x]</tt> will be equal to <tt>!m[x]</tt>. |
1553 | 1553 |
/// |
1554 | 1554 |
/// \relates NotMap |
1555 | 1555 |
template <typename M> |
1556 | 1556 |
inline NotMap<M> notMap(const M &m) { |
1557 | 1557 |
return NotMap<M>(m); |
1558 | 1558 |
} |
1559 | 1559 |
|
1560 |
/// Returns a \ref NotWriteMap class |
|
1561 |
|
|
1562 |
/// |
|
1560 |
/// Returns a \c NotWriteMap class |
|
1561 |
|
|
1562 |
/// This function just returns a \c NotWriteMap class. |
|
1563 | 1563 |
/// |
1564 | 1564 |
/// For example, if \c m is a map with \c bool values, then |
1565 | 1565 |
/// <tt>notWriteMap(m)[x]</tt> will be equal to <tt>!m[x]</tt>. |
1566 | 1566 |
/// Moreover it makes also possible to write the map. |
1567 | 1567 |
/// |
1568 | 1568 |
/// \relates NotWriteMap |
1569 | 1569 |
template <typename M> |
1570 | 1570 |
inline NotWriteMap<M> notWriteMap(M &m) { |
1571 | 1571 |
return NotWriteMap<M>(m); |
1572 | 1572 |
} |
1573 | 1573 |
|
1574 | 1574 |
|
... | ... |
@@ -1596,27 +1596,27 @@ |
1596 | 1596 |
const M2 &_m2; |
1597 | 1597 |
public: |
1598 | 1598 |
typedef MapBase<typename M1::Key, bool> Parent; |
1599 | 1599 |
typedef typename Parent::Key Key; |
1600 | 1600 |
typedef typename Parent::Value Value; |
1601 | 1601 |
|
1602 | 1602 |
/// Constructor |
1603 | 1603 |
EqualMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
1604 | 1604 |
/// \e |
1605 | 1605 |
Value operator[](const Key &k) const { return _m1[k]==_m2[k]; } |
1606 | 1606 |
}; |
1607 | 1607 |
|
1608 |
/// Returns an \ref EqualMap class |
|
1609 |
|
|
1610 |
/// |
|
1608 |
/// Returns an \c EqualMap class |
|
1609 |
|
|
1610 |
/// This function just returns an \c EqualMap class. |
|
1611 | 1611 |
/// |
1612 | 1612 |
/// For example, if \c m1 and \c m2 are maps with keys and values of |
1613 | 1613 |
/// the same type, then <tt>equalMap(m1,m2)[x]</tt> will be equal to |
1614 | 1614 |
/// <tt>m1[x]==m2[x]</tt>. |
1615 | 1615 |
/// |
1616 | 1616 |
/// \relates EqualMap |
1617 | 1617 |
template<typename M1, typename M2> |
1618 | 1618 |
inline EqualMap<M1, M2> equalMap(const M1 &m1, const M2 &m2) { |
1619 | 1619 |
return EqualMap<M1, M2>(m1,m2); |
1620 | 1620 |
} |
1621 | 1621 |
|
1622 | 1622 |
|
... | ... |
@@ -1644,27 +1644,27 @@ |
1644 | 1644 |
const M2 &_m2; |
1645 | 1645 |
public: |
1646 | 1646 |
typedef MapBase<typename M1::Key, bool> Parent; |
1647 | 1647 |
typedef typename Parent::Key Key; |
1648 | 1648 |
typedef typename Parent::Value Value; |
1649 | 1649 |
|
1650 | 1650 |
/// Constructor |
1651 | 1651 |
LessMap(const M1 &m1, const M2 &m2) : _m1(m1), _m2(m2) {} |
1652 | 1652 |
/// \e |
1653 | 1653 |
Value operator[](const Key &k) const { return _m1[k]<_m2[k]; } |
1654 | 1654 |
}; |
1655 | 1655 |
|
1656 |
/// Returns an \ref LessMap class |
|
1657 |
|
|
1658 |
/// |
|
1656 |
/// Returns an \c LessMap class |
|
1657 |
|
|
1658 |
/// This function just returns an \c LessMap class. |
|
1659 | 1659 |
/// |
1660 | 1660 |
/// For example, if \c m1 and \c m2 are maps with keys and values of |
1661 | 1661 |
/// the same type, then <tt>lessMap(m1,m2)[x]</tt> will be equal to |
1662 | 1662 |
/// <tt>m1[x]<m2[x]</tt>. |
1663 | 1663 |
/// |
1664 | 1664 |
/// \relates LessMap |
1665 | 1665 |
template<typename M1, typename M2> |
1666 | 1666 |
inline LessMap<M1, M2> lessMap(const M1 &m1, const M2 &m2) { |
1667 | 1667 |
return LessMap<M1, M2>(m1,m2); |
1668 | 1668 |
} |
1669 | 1669 |
|
1670 | 1670 |
namespace _maps_bits { |
... | ... |
@@ -1736,47 +1736,47 @@ |
1736 | 1736 |
/// The set function of the map |
1737 | 1737 |
void set(const Key& key, Value value) { |
1738 | 1738 |
if (value) { |
1739 | 1739 |
*_end++ = key; |
1740 | 1740 |
} |
1741 | 1741 |
} |
1742 | 1742 |
|
1743 | 1743 |
private: |
1744 | 1744 |
Iterator _begin; |
1745 | 1745 |
Iterator _end; |
1746 | 1746 |
}; |
1747 | 1747 |
|
1748 |
/// Returns a \ref LoggerBoolMap class |
|
1749 |
|
|
1750 |
/// |
|
1748 |
/// Returns a \c LoggerBoolMap class |
|
1749 |
|
|
1750 |
/// This function just returns a \c LoggerBoolMap class. |
|
1751 | 1751 |
/// |
1752 | 1752 |
/// The most important usage of it is storing certain nodes or arcs |
1753 | 1753 |
/// that were marked \c true by an algorithm. |
1754 | 1754 |
/// For example it makes easier to store the nodes in the processing |
1755 | 1755 |
/// order of Dfs algorithm, as the following examples show. |
1756 | 1756 |
/// \code |
1757 | 1757 |
/// std::vector<Node> v; |
1758 | 1758 |
/// dfs(g,s).processedMap(loggerBoolMap(std::back_inserter(v))).run(); |
1759 | 1759 |
/// \endcode |
1760 | 1760 |
/// \code |
1761 | 1761 |
/// std::vector<Node> v(countNodes(g)); |
1762 | 1762 |
/// dfs(g,s).processedMap(loggerBoolMap(v.begin())).run(); |
1763 | 1763 |
/// \endcode |
1764 | 1764 |
/// |
1765 | 1765 |
/// \note The container of the iterator must contain enough space |
1766 | 1766 |
/// for the elements or the iterator should be an inserter iterator. |
1767 | 1767 |
/// |
1768 | 1768 |
/// \note LoggerBoolMap is just \ref concepts::WriteMap "writable", so |
1769 | 1769 |
/// it cannot be used when a readable map is needed, for example as |
1770 |
/// \c ReachedMap for \ |
|
1770 |
/// \c ReachedMap for \c Bfs, \c Dfs and \c Dijkstra algorithms. |
|
1771 | 1771 |
/// |
1772 | 1772 |
/// \relates LoggerBoolMap |
1773 | 1773 |
template<typename Iterator> |
1774 | 1774 |
inline LoggerBoolMap<Iterator> loggerBoolMap(Iterator it) { |
1775 | 1775 |
return LoggerBoolMap<Iterator>(it); |
1776 | 1776 |
} |
1777 | 1777 |
|
1778 | 1778 |
/// Provides an immutable and unique id for each item in the graph. |
1779 | 1779 |
|
1780 | 1780 |
/// The IdMap class provides a unique and immutable id for each item of the |
1781 | 1781 |
/// same type (e.g. node) in the graph. This id is <ul><li>\b unique: |
1782 | 1782 |
/// different items (nodes) get different ids <li>\b immutable: the id of an |
... | ... |
@@ -2273,27 +2273,27 @@ |
2273 | 2273 |
/// |
2274 | 2274 |
/// The subscript operator. |
2275 | 2275 |
/// \param arc The arc |
2276 | 2276 |
/// \return The source of the arc |
2277 | 2277 |
Value operator[](const Key& arc) const { |
2278 | 2278 |
return _digraph.source(arc); |
2279 | 2279 |
} |
2280 | 2280 |
|
2281 | 2281 |
private: |
2282 | 2282 |
const Digraph& _digraph; |
2283 | 2283 |
}; |
2284 | 2284 |
|
2285 |
/// \brief Returns a \ |
|
2285 |
/// \brief Returns a \c SourceMap class. |
|
2286 | 2286 |
/// |
2287 |
/// This function just returns an \ |
|
2287 |
/// This function just returns an \c SourceMap class. |
|
2288 | 2288 |
/// \relates SourceMap |
2289 | 2289 |
template <typename Digraph> |
2290 | 2290 |
inline SourceMap<Digraph> sourceMap(const Digraph& digraph) { |
2291 | 2291 |
return SourceMap<Digraph>(digraph); |
2292 | 2292 |
} |
2293 | 2293 |
|
2294 | 2294 |
/// \brief Returns the target of the given arc. |
2295 | 2295 |
/// |
2296 | 2296 |
/// The TargetMap gives back the target Node of the given arc. |
2297 | 2297 |
/// \see SourceMap |
2298 | 2298 |
template <typename Digraph> |
2299 | 2299 |
class TargetMap { |
... | ... |
@@ -2312,27 +2312,27 @@ |
2312 | 2312 |
/// |
2313 | 2313 |
/// The subscript operator. |
2314 | 2314 |
/// \param e The arc |
2315 | 2315 |
/// \return The target of the arc |
2316 | 2316 |
Value operator[](const Key& e) const { |
2317 | 2317 |
return _digraph.target(e); |
2318 | 2318 |
} |
2319 | 2319 |
|
2320 | 2320 |
private: |
2321 | 2321 |
const Digraph& _digraph; |
2322 | 2322 |
}; |
2323 | 2323 |
|
2324 |
/// \brief Returns a \ |
|
2324 |
/// \brief Returns a \c TargetMap class. |
|
2325 | 2325 |
/// |
2326 |
/// This function just returns a \ |
|
2326 |
/// This function just returns a \c TargetMap class. |
|
2327 | 2327 |
/// \relates TargetMap |
2328 | 2328 |
template <typename Digraph> |
2329 | 2329 |
inline TargetMap<Digraph> targetMap(const Digraph& digraph) { |
2330 | 2330 |
return TargetMap<Digraph>(digraph); |
2331 | 2331 |
} |
2332 | 2332 |
|
2333 | 2333 |
/// \brief Returns the "forward" directed arc view of an edge. |
2334 | 2334 |
/// |
2335 | 2335 |
/// Returns the "forward" directed arc view of an edge. |
2336 | 2336 |
/// \see BackwardMap |
2337 | 2337 |
template <typename Graph> |
2338 | 2338 |
class ForwardMap { |
... | ... |
@@ -2351,27 +2351,27 @@ |
2351 | 2351 |
/// |
2352 | 2352 |
/// The subscript operator. |
2353 | 2353 |
/// \param key An edge |
2354 | 2354 |
/// \return The "forward" directed arc view of edge |
2355 | 2355 |
Value operator[](const Key& key) const { |
2356 | 2356 |
return _graph.direct(key, true); |
2357 | 2357 |
} |
2358 | 2358 |
|
2359 | 2359 |
private: |
2360 | 2360 |
const Graph& _graph; |
2361 | 2361 |
}; |
2362 | 2362 |
|
2363 |
/// \brief Returns a \ |
|
2363 |
/// \brief Returns a \c ForwardMap class. |
|
2364 | 2364 |
/// |
2365 |
/// This function just returns an \ |
|
2365 |
/// This function just returns an \c ForwardMap class. |
|
2366 | 2366 |
/// \relates ForwardMap |
2367 | 2367 |
template <typename Graph> |
2368 | 2368 |
inline ForwardMap<Graph> forwardMap(const Graph& graph) { |
2369 | 2369 |
return ForwardMap<Graph>(graph); |
2370 | 2370 |
} |
2371 | 2371 |
|
2372 | 2372 |
/// \brief Returns the "backward" directed arc view of an edge. |
2373 | 2373 |
/// |
2374 | 2374 |
/// Returns the "backward" directed arc view of an edge. |
2375 | 2375 |
/// \see ForwardMap |
2376 | 2376 |
template <typename Graph> |
2377 | 2377 |
class BackwardMap { |
... | ... |
@@ -2390,27 +2390,27 @@ |
2390 | 2390 |
/// |
2391 | 2391 |
/// The subscript operator. |
2392 | 2392 |
/// \param key An edge |
2393 | 2393 |
/// \return The "backward" directed arc view of edge |
2394 | 2394 |
Value operator[](const Key& key) const { |
2395 | 2395 |
return _graph.direct(key, false); |
2396 | 2396 |
} |
2397 | 2397 |
|
2398 | 2398 |
private: |
2399 | 2399 |
const Graph& _graph; |
2400 | 2400 |
}; |
2401 | 2401 |
|
2402 |
/// \brief Returns a \ref BackwardMap class |
|
2403 |
|
|
2404 |
/// |
|
2402 |
/// \brief Returns a \c BackwardMap class |
|
2403 |
|
|
2404 |
/// This function just returns a \c BackwardMap class. |
|
2405 | 2405 |
/// \relates BackwardMap |
2406 | 2406 |
template <typename Graph> |
2407 | 2407 |
inline BackwardMap<Graph> backwardMap(const Graph& graph) { |
2408 | 2408 |
return BackwardMap<Graph>(graph); |
2409 | 2409 |
} |
2410 | 2410 |
|
2411 | 2411 |
/// \brief Potential difference map |
2412 | 2412 |
/// |
2413 | 2413 |
/// If there is an potential map on the nodes then we |
2414 | 2414 |
/// can get an arc map as we get the substraction of the |
2415 | 2415 |
/// values of the target and source. |
2416 | 2416 |
template <typename Digraph, typename NodeMap> |
0 comments (0 inline)