0
14
0
6
3
6
3
44
22
... | ... |
@@ -86,13 +86,14 @@ |
86 | 86 |
\code |
87 | 87 |
ALL_UPPER_CASE_WITH_UNDERSCORES |
88 | 88 |
\endcode |
89 | 89 |
|
90 | 90 |
\subsection cs-loc-var Class and instance member variables, auto variables |
91 | 91 |
|
92 |
The names of class and instance member variables and auto variables |
|
92 |
The names of class and instance member variables and auto variables |
|
93 |
(=variables used locally in methods) should look like the following. |
|
93 | 94 |
|
94 | 95 |
\code |
95 | 96 |
all_lower_case_with_underscores |
96 | 97 |
\endcode |
97 | 98 |
|
98 | 99 |
\subsection pri-loc-var Private member variables |
... | ... |
@@ -224,13 +224,14 @@ |
224 | 224 |
a single target that is maximum. Formally, there is a \f$G=(V,A)\f$ |
225 | 225 |
directed graph, an \f$c_a:A\rightarrow\mathbf{R}^+_0\f$ capacity |
226 | 226 |
function and given \f$s, t \in V\f$ source and target node. The |
227 | 227 |
maximum flow is the \f$f_a\f$ solution of the next optimization problem: |
228 | 228 |
|
229 | 229 |
\f[ 0 \le f_a \le c_a \f] |
230 |
\f[ \sum_{v\in\delta^{-}(u)}f_{vu}=\sum_{v\in\delta^{+}(u)}f_{uv} |
|
230 |
\f[ \sum_{v\in\delta^{-}(u)}f_{vu}=\sum_{v\in\delta^{+}(u)}f_{uv} |
|
231 |
\qquad \forall u \in V \setminus \{s,t\}\f] |
|
231 | 232 |
\f[ \max \sum_{v\in\delta^{+}(s)}f_{uv} - \sum_{v\in\delta^{-}(s)}f_{vu}\f] |
232 | 233 |
|
233 | 234 |
LEMON contains several algorithms for solving maximum flow problems: |
234 | 235 |
- \ref lemon::EdmondsKarp "Edmonds-Karp" |
235 | 236 |
- \ref lemon::Preflow "Goldberg's Preflow algorithm" |
236 | 237 |
- \ref lemon::DinitzSleatorTarjan "Dinitz's blocking flow algorithm with dynamic trees" |
... | ... |
@@ -264,13 +265,14 @@ |
264 | 265 |
The minimum cut problem is to find a non-empty and non-complete |
265 | 266 |
\f$X\f$ subset of the vertices with minimum overall capacity on |
266 | 267 |
outgoing arcs. Formally, there is \f$G=(V,A)\f$ directed graph, an |
267 | 268 |
\f$c_a:A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum |
268 | 269 |
cut is the \f$X\f$ solution of the next optimization problem: |
269 | 270 |
|
270 |
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}} |
|
271 |
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}} |
|
272 |
\sum_{uv\in A, u\in X, v\not\in X}c_{uv}\f] |
|
271 | 273 |
|
272 | 274 |
LEMON contains several algorithms related to minimum cut problems: |
273 | 275 |
|
274 | 276 |
- \ref lemon::HaoOrlin "Hao-Orlin algorithm" to calculate minimum cut |
275 | 277 |
in directed graphs |
276 | 278 |
- \ref lemon::NagamochiIbaraki "Nagamochi-Ibaraki algorithm" to |
... | ... |
@@ -297,13 +299,14 @@ |
297 | 299 |
|
298 | 300 |
/** |
299 | 301 |
@defgroup planar Planarity embedding and drawing |
300 | 302 |
@ingroup algs |
301 | 303 |
\brief Algorithms for planarity checking, embedding and drawing |
302 | 304 |
|
303 |
This group describes the algorithms for planarity checking, |
|
305 |
This group describes the algorithms for planarity checking, |
|
306 |
embedding and drawing. |
|
304 | 307 |
|
305 | 308 |
\image html planar.png |
306 | 309 |
\image latex planar.eps "Plane graph" width=\textwidth |
307 | 310 |
*/ |
308 | 311 |
|
309 | 312 |
/** |
... | ... |
@@ -474,13 +477,14 @@ |
474 | 477 |
|
475 | 478 |
/** |
476 | 479 |
@defgroup lemon_io Lemon Input-Output |
477 | 480 |
@ingroup io_group |
478 | 481 |
\brief Reading and writing \ref lgf-format "Lemon Graph Format". |
479 | 482 |
|
480 |
This group describes methods for reading and writing |
|
483 |
This group describes methods for reading and writing |
|
484 |
\ref lgf-format "Lemon Graph Format". |
|
481 | 485 |
*/ |
482 | 486 |
|
483 | 487 |
/** |
484 | 488 |
@defgroup eps_io Postscript exporting |
485 | 489 |
@ingroup io_group |
486 | 490 |
\brief General \c EPS drawer and graph exporter |
... | ... |
@@ -392,22 +392,22 @@ |
392 | 392 |
{ |
393 | 393 |
int set=0; |
394 | 394 |
for(GroupData::Opts::iterator o=i->second.opts.begin(); |
395 | 395 |
o!=i->second.opts.end();++o) |
396 | 396 |
if(_opts.find(*o)->second.set) ++set; |
397 | 397 |
if(i->second.mandatory&&!set) { |
398 |
std::cerr << _command_name |
|
399 |
<< ": At least one of the following arguments is mandatory.\n"; |
|
398 |
std::cerr << _command_name << |
|
399 |
": At least one of the following arguments is mandatory.\n"; |
|
400 | 400 |
ok=false; |
401 | 401 |
for(GroupData::Opts::iterator o=i->second.opts.begin(); |
402 | 402 |
o!=i->second.opts.end();++o) |
403 | 403 |
showHelp(_opts.find(*o)); |
404 | 404 |
} |
405 | 405 |
if(i->second.only_one&&set>1) { |
406 |
std::cerr << _command_name |
|
407 |
<< ": At most one of the following arguments can be given.\n"; |
|
406 |
std::cerr << _command_name << |
|
407 |
": At most one of the following arguments can be given.\n"; |
|
408 | 408 |
ok=false; |
409 | 409 |
for(GroupData::Opts::iterator o=i->second.opts.begin(); |
410 | 410 |
o!=i->second.opts.end();++o) |
411 | 411 |
showHelp(_opts.find(*o)); |
412 | 412 |
} |
413 | 413 |
} |
... | ... |
@@ -148,14 +148,15 @@ |
148 | 148 |
/// - \c LEMON_ASSERT_ABORT This mode is similar to the \c |
149 | 149 |
/// LEMON_ASSERT_LOG, but it aborts the program. It is the default |
150 | 150 |
/// behaviour. |
151 | 151 |
/// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler |
152 | 152 |
/// function. |
153 | 153 |
/// \code |
154 |
/// void custom_assert_handler(const char* file, int line, const char* function, |
|
155 |
/// const char* message, const char* assertion); |
|
154 |
/// void custom_assert_handler(const char* file, int line, |
|
155 |
/// const char* function, const char* message, |
|
156 |
/// const char* assertion); |
|
156 | 157 |
/// \endcode |
157 | 158 |
/// The name of the function should be defined as the \c |
158 | 159 |
/// LEMON_CUSTOM_ASSERT_HANDLER macro name. |
159 | 160 |
/// \code |
160 | 161 |
/// #define LEMON_CUSTOM_ASSERT_HANDLER custom_assert_handler |
161 | 162 |
/// \endcode |
... | ... |
@@ -100,13 +100,14 @@ |
100 | 100 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
101 | 101 |
/// |
102 | 102 |
typedef typename Digraph::template NodeMap<int> DistMap; |
103 | 103 |
///Instantiates a DistMap. |
104 | 104 |
|
105 | 105 |
///This function instantiates a \ref DistMap. |
106 |
///\param G is the digraph, to which we would like to define |
|
106 |
///\param G is the digraph, to which we would like to define |
|
107 |
///the \ref DistMap |
|
107 | 108 |
static DistMap *createDistMap(const GR &G) |
108 | 109 |
{ |
109 | 110 |
return new DistMap(G); |
110 | 111 |
} |
111 | 112 |
}; |
112 | 113 |
|
... | ... |
@@ -822,13 +823,14 @@ |
822 | 823 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
823 | 824 |
/// |
824 | 825 |
typedef NullMap<typename Digraph::Node,int> DistMap; |
825 | 826 |
///Instantiates a DistMap. |
826 | 827 |
|
827 | 828 |
///This function instantiates a \ref DistMap. |
828 |
///\param g is the digraph, to which we would like to define |
|
829 |
///\param g is the digraph, to which we would like to define |
|
830 |
///the \ref DistMap |
|
829 | 831 |
#ifdef DOXYGEN |
830 | 832 |
static DistMap *createDistMap(const GR &g) |
831 | 833 |
#else |
832 | 834 |
static DistMap *createDistMap(const GR &) |
833 | 835 |
#endif |
834 | 836 |
{ |
... | ... |
@@ -1196,13 +1198,14 @@ |
1196 | 1198 |
/// with visitor interface. |
1197 | 1199 |
/// |
1198 | 1200 |
/// The %BfsVisit class provides an alternative interface to the Bfs |
1199 | 1201 |
/// class. It works with callback mechanism, the BfsVisit object calls |
1200 | 1202 |
/// on every bfs event the \c Visitor class member functions. |
1201 | 1203 |
/// |
1202 |
/// \tparam _Digraph The digraph type the algorithm runs on. |
|
1204 |
/// \tparam _Digraph The digraph type the algorithm runs on. |
|
1205 |
/// The default value is |
|
1203 | 1206 |
/// \ref ListDigraph. The value of _Digraph is not used directly by Bfs, it |
1204 | 1207 |
/// is only passed to \ref BfsDefaultTraits. |
1205 | 1208 |
/// \tparam _Visitor The Visitor object for the algorithm. The |
1206 | 1209 |
/// \ref BfsVisitor "BfsVisitor<_Digraph>" is an empty Visitor which |
1207 | 1210 |
/// does not observe the Bfs events. If you want to observe the bfs |
1208 | 1211 |
/// events you should implement your own Visitor class. |
... | ... |
@@ -40,13 +40,14 @@ |
40 | 40 |
template<typename K, typename T> |
41 | 41 |
class ReadMap |
42 | 42 |
{ |
43 | 43 |
public: |
44 | 44 |
/// The key type of the map. |
45 | 45 |
typedef K Key; |
46 |
/// The value type of the map. |
|
46 |
/// \brief The value type of the map. |
|
47 |
/// (The type of objects associated with the keys). |
|
47 | 48 |
typedef T Value; |
48 | 49 |
|
49 | 50 |
/// Returns the value associated with the given key. |
50 | 51 |
Value operator[](const Key &) const { |
51 | 52 |
return *static_cast<Value *>(0); |
52 | 53 |
} |
... | ... |
@@ -79,13 +80,14 @@ |
79 | 80 |
template<typename K, typename T> |
80 | 81 |
class WriteMap |
81 | 82 |
{ |
82 | 83 |
public: |
83 | 84 |
/// The key type of the map. |
84 | 85 |
typedef K Key; |
85 |
/// The value type of the map. |
|
86 |
/// \brief The value type of the map. |
|
87 |
/// (The type of objects associated with the keys). |
|
86 | 88 |
typedef T Value; |
87 | 89 |
|
88 | 90 |
/// Sets the value associated with the given key. |
89 | 91 |
void set(const Key &, const Value &) {} |
90 | 92 |
|
91 | 93 |
/// Default constructor. |
... | ... |
@@ -118,13 +120,14 @@ |
118 | 120 |
class ReadWriteMap : public ReadMap<K,T>, |
119 | 121 |
public WriteMap<K,T> |
120 | 122 |
{ |
121 | 123 |
public: |
122 | 124 |
/// The key type of the map. |
123 | 125 |
typedef K Key; |
124 |
/// The value type of the map. |
|
126 |
/// \brief The value type of the map. |
|
127 |
/// (The type of objects associated with the keys). |
|
125 | 128 |
typedef T Value; |
126 | 129 |
|
127 | 130 |
/// Returns the value associated with the given key. |
128 | 131 |
Value operator[](const Key &) const { |
129 | 132 |
return *static_cast<Value *>(0); |
130 | 133 |
} |
... | ... |
@@ -151,13 +154,14 @@ |
151 | 154 |
{ |
152 | 155 |
public: |
153 | 156 |
/// Tag for reference maps. |
154 | 157 |
typedef True ReferenceMapTag; |
155 | 158 |
/// The key type of the map. |
156 | 159 |
typedef K Key; |
157 |
/// The value type of the map. |
|
160 |
/// \brief The value type of the map. |
|
161 |
/// (The type of objects associated with the keys). |
|
158 | 162 |
typedef T Value; |
159 | 163 |
/// The reference type of the map. |
160 | 164 |
typedef R Reference; |
161 | 165 |
/// The const reference type of the map. |
162 | 166 |
typedef CR ConstReference; |
163 | 167 |
... | ... |
@@ -102,13 +102,14 @@ |
102 | 102 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
103 | 103 |
/// |
104 | 104 |
typedef typename Digraph::template NodeMap<int> DistMap; |
105 | 105 |
///Instantiates a DistMap. |
106 | 106 |
|
107 | 107 |
///This function instantiates a \ref DistMap. |
108 |
///\param G is the digraph, to which we would like to define |
|
108 |
///\param G is the digraph, to which we would like to define |
|
109 |
///the \ref DistMap |
|
109 | 110 |
static DistMap *createDistMap(const GR &G) |
110 | 111 |
{ |
111 | 112 |
return new DistMap(G); |
112 | 113 |
} |
113 | 114 |
}; |
114 | 115 |
|
... | ... |
@@ -805,13 +806,14 @@ |
805 | 806 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
806 | 807 |
/// |
807 | 808 |
typedef NullMap<typename Digraph::Node,int> DistMap; |
808 | 809 |
///Instantiates a DistMap. |
809 | 810 |
|
810 | 811 |
///This function instantiates a \ref DistMap. |
811 |
///\param g is the digraph, to which we would like to define |
|
812 |
///\param g is the digraph, to which we would like to define |
|
813 |
///the \ref DistMap |
|
812 | 814 |
#ifdef DOXYGEN |
813 | 815 |
static DistMap *createDistMap(const GR &g) |
814 | 816 |
#else |
815 | 817 |
static DistMap *createDistMap(const GR &) |
816 | 818 |
#endif |
817 | 819 |
{ |
... | ... |
@@ -1190,13 +1192,14 @@ |
1190 | 1192 |
/// with visitor interface. |
1191 | 1193 |
/// |
1192 | 1194 |
/// The %DfsVisit class provides an alternative interface to the Dfs |
1193 | 1195 |
/// class. It works with callback mechanism, the DfsVisit object calls |
1194 | 1196 |
/// on every dfs event the \c Visitor class member functions. |
1195 | 1197 |
/// |
1196 |
/// \tparam _Digraph The digraph type the algorithm runs on. |
|
1198 |
/// \tparam _Digraph The digraph type the algorithm runs on. |
|
1199 |
/// The default value is |
|
1197 | 1200 |
/// \ref ListDigraph. The value of _Digraph is not used directly by Dfs, it |
1198 | 1201 |
/// is only passed to \ref DfsDefaultTraits. |
1199 | 1202 |
/// \tparam _Visitor The Visitor object for the algorithm. The |
1200 | 1203 |
/// \ref DfsVisitor "DfsVisitor<_Digraph>" is an empty Visitor which |
1201 | 1204 |
/// does not observe the Dfs events. If you want to observe the dfs |
1202 | 1205 |
/// events you should implement your own Visitor class. |
... | ... |
@@ -170,13 +170,14 @@ |
170 | 170 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
171 | 171 |
/// |
172 | 172 |
typedef typename Digraph::template NodeMap<typename LM::Value> DistMap; |
173 | 173 |
///Instantiates a DistMap. |
174 | 174 |
|
175 | 175 |
///This function instantiates a \ref DistMap. |
176 |
///\param G is the digraph, to which we would like to define |
|
176 |
///\param G is the digraph, to which we would like to define |
|
177 |
///the \ref DistMap |
|
177 | 178 |
static DistMap *createDistMap(const GR &G) |
178 | 179 |
{ |
179 | 180 |
return new DistMap(G); |
180 | 181 |
} |
181 | 182 |
}; |
182 | 183 |
|
... | ... |
@@ -389,13 +390,14 @@ |
389 | 390 |
///\ref named-templ-param "Named parameter" |
390 | 391 |
///for setting the ProcessedMap type to be Digraph::NodeMap<bool>. |
391 | 392 |
///If you don't set it explicitely, it will be automatically allocated. |
392 | 393 |
template <class T> |
393 | 394 |
struct DefProcessedMapToBeDefaultMap |
394 | 395 |
: public Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> { |
395 |
typedef Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> |
|
396 |
typedef Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> |
|
397 |
Create; |
|
396 | 398 |
}; |
397 | 399 |
|
398 | 400 |
template <class H, class CR> |
399 | 401 |
struct DefHeapTraits : public Traits { |
400 | 402 |
typedef CR HeapCrossRef; |
401 | 403 |
typedef H Heap; |
... | ... |
@@ -973,13 +975,14 @@ |
973 | 975 |
///It must meet the \ref concepts::WriteMap "WriteMap" concept. |
974 | 976 |
/// |
975 | 977 |
typedef NullMap<typename Digraph::Node,typename LM::Value> DistMap; |
976 | 978 |
///Instantiates a DistMap. |
977 | 979 |
|
978 | 980 |
///This function instantiates a \ref DistMap. |
979 |
///\param g is the digraph, to which we would like to define |
|
981 |
///\param g is the digraph, to which we would like to define |
|
982 |
///the \ref DistMap |
|
980 | 983 |
#ifdef DOXYGEN |
981 | 984 |
static DistMap *createDistMap(const GR &g) |
982 | 985 |
#else |
983 | 986 |
static DistMap *createDistMap(const GR &) |
984 | 987 |
#endif |
985 | 988 |
{ |
... | ... |
@@ -139,13 +139,14 @@ |
139 | 139 |
bool _preScale; |
140 | 140 |
///Constructor |
141 | 141 |
|
142 | 142 |
///Constructor |
143 | 143 |
///\param _g Reference to the graph to be printed. |
144 | 144 |
///\param _os Reference to the output stream. |
145 |
///\param _os Reference to the output stream. |
|
145 |
///\param _os Reference to the output stream. |
|
146 |
///By default it is <tt>std::cout</tt>. |
|
146 | 147 |
///\param _pros If it is \c true, then the \c ostream referenced by \c _os |
147 | 148 |
///will be explicitly deallocated by the destructor. |
148 | 149 |
DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout, |
149 | 150 |
bool _pros=false) : |
150 | 151 |
g(_g), os(_os), |
151 | 152 |
_coords(dim2::Point<double>(1,1)), _nodeSizes(1), _nodeShapes(0), |
... | ... |
@@ -778,15 +779,17 @@ |
778 | 779 |
|
779 | 780 |
os << "%%EndComments\n"; |
780 | 781 |
|
781 | 782 |
//x1 y1 x2 y2 x3 y3 cr cg cb w |
782 | 783 |
os << "/lb { setlinewidth setrgbcolor newpath moveto\n" |
783 | 784 |
<< " 4 2 roll 1 index 1 index curveto stroke } bind def\n"; |
784 |
os << "/l { setlinewidth setrgbcolor newpath moveto lineto stroke } |
|
785 |
os << "/l { setlinewidth setrgbcolor newpath moveto lineto stroke }" |
|
786 |
<< " bind def\n"; |
|
785 | 787 |
//x y r |
786 |
os << "/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } |
|
788 |
os << "/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath }" |
|
789 |
<< " bind def\n"; |
|
787 | 790 |
//x y r |
788 | 791 |
os << "/sq { newpath 2 index 1 index add 2 index 2 index add moveto\n" |
789 | 792 |
<< " 2 index 1 index sub 2 index 2 index add lineto\n" |
790 | 793 |
<< " 2 index 1 index sub 2 index 2 index sub lineto\n" |
791 | 794 |
<< " 2 index 1 index add 2 index 2 index sub lineto\n" |
792 | 795 |
<< " closepath pop pop pop} bind def\n"; |
... | ... |
@@ -808,14 +811,16 @@ |
808 | 811 |
<< " } bind def\n"; |
809 | 812 |
os << "/nfemale { 0 0 0 setrgbcolor 3 index " |
810 | 813 |
<< _nodeBorderQuotient/(1+_nodeBorderQuotient) |
811 | 814 |
<< " 1.5 mul mul setlinewidth\n" |
812 | 815 |
<< " newpath 5 index 5 index moveto " |
813 | 816 |
<< "5 index 5 index 5 index 3.01 mul sub\n" |
814 |
<< " lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub moveto\n" |
|
815 |
<< " 5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto stroke\n" |
|
817 |
<< " lineto 5 index 4 index .7 mul sub 5 index 5 index 2.2 mul sub" |
|
818 |
<< " moveto\n" |
|
819 |
<< " 5 index 4 index .7 mul add 5 index 5 index 2.2 mul sub lineto " |
|
820 |
<< "stroke\n" |
|
816 | 821 |
<< " 5 index 5 index 5 index c fill\n" |
817 | 822 |
<< " setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n" |
818 | 823 |
<< " } bind def\n"; |
819 | 824 |
os << "/nmale {\n" |
820 | 825 |
<< " 0 0 0 setrgbcolor 3 index " |
821 | 826 |
<< _nodeBorderQuotient/(1+_nodeBorderQuotient) |
... | ... |
@@ -823,25 +828,27 @@ |
823 | 828 |
<< " newpath 5 index 5 index moveto\n" |
824 | 829 |
<< " 5 index 4 index 1 mul 1.5 mul add\n" |
825 | 830 |
<< " 5 index 5 index 3 sqrt 1.5 mul mul add\n" |
826 | 831 |
<< " 1 index 1 index lineto\n" |
827 | 832 |
<< " 1 index 1 index 7 index sub moveto\n" |
828 | 833 |
<< " 1 index 1 index lineto\n" |
829 |
<< " exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub |
|
834 |
<< " exch 5 index 3 sqrt .5 mul mul sub exch 5 index .5 mul sub" |
|
835 |
<< " lineto\n" |
|
830 | 836 |
<< " stroke\n" |
831 | 837 |
<< " 5 index 5 index 5 index c fill\n" |
832 | 838 |
<< " setrgbcolor " << 1+_nodeBorderQuotient << " div c fill\n" |
833 | 839 |
<< " } bind def\n"; |
834 | 840 |
|
835 | 841 |
|
836 | 842 |
os << "/arrl " << _arrowLength << " def\n"; |
837 | 843 |
os << "/arrw " << _arrowWidth << " def\n"; |
838 | 844 |
// l dx_norm dy_norm |
839 | 845 |
os << "/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def\n"; |
840 | 846 |
//len w dx_norm dy_norm x1 y1 cr cg cb |
841 |
os << "/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx |
|
847 |
os << "/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx " |
|
848 |
<< "exch def\n" |
|
842 | 849 |
<< " /w exch def /len exch def\n" |
843 | 850 |
// << " 0.1 setlinewidth x1 y1 moveto dx len mul dy len mul rlineto stroke" |
844 | 851 |
<< " newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto\n" |
845 | 852 |
<< " len w sub arrl sub dx dy lrl\n" |
846 | 853 |
<< " arrw dy dx neg lrl\n" |
847 | 854 |
<< " dx arrl w add mul dy w 2 div arrw add mul sub\n" |
... | ... |
@@ -899,13 +906,14 @@ |
899 | 906 |
dim2::Point<double> |
900 | 907 |
dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]); |
901 | 908 |
double l=std::sqrt(dvec.normSquare()); |
902 | 909 |
//\todo better 'epsilon' would be nice here. |
903 | 910 |
dim2::Point<double> d(dvec/std::max(l,EPSILON)); |
904 | 911 |
dim2::Point<double> m; |
905 |
// m=dim2::Point<double>(mycoords[g.target(*i)]+ |
|
912 |
// m=dim2::Point<double>(mycoords[g.target(*i)]+ |
|
913 |
// mycoords[g.source(*i)])/2.0; |
|
906 | 914 |
|
907 | 915 |
// m=dim2::Point<double>(mycoords[g.source(*i)])+ |
908 | 916 |
// dvec*(double(_nodeSizes[g.source(*i)])/ |
909 | 917 |
// (_nodeSizes[g.source(*i)]+_nodeSizes[g.target(*i)])); |
910 | 918 |
|
911 | 919 |
m=dim2::Point<double>(mycoords[g.source(*i)])+ |
... | ... |
@@ -935,13 +943,14 @@ |
935 | 943 |
dim2::Point<double> linend=bez((t1+t2)/2); |
936 | 944 |
bez=bez.before((t1+t2)/2); |
937 | 945 |
// rn=_nodeSizes[g.source(*e)]*_nodeScale; |
938 | 946 |
// node_shape=_nodeShapes[g.source(*e)]; |
939 | 947 |
// t1=0;t2=1; |
940 | 948 |
// for(int i=0;i<INTERPOL_PREC;++i) |
941 |
// if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) |
|
949 |
// if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) |
|
950 |
// t1=(t1+t2)/2; |
|
942 | 951 |
// else t2=(t1+t2)/2; |
943 | 952 |
// bez=bez.after((t1+t2)/2); |
944 | 953 |
os << _arcWidths[*e]*_arcWidthScale << " setlinewidth " |
945 | 954 |
<< _arcColors[*e].red() << ' ' |
946 | 955 |
<< _arcColors[*e].green() << ' ' |
947 | 956 |
<< _arcColors[*e].blue() << " setrgbcolor newpath\n" |
... | ... |
@@ -441,13 +441,14 @@ |
441 | 441 |
/// important if two \c \@arcs sections must be read from the |
442 | 442 |
/// file. In this case the first phase would read the node set and one |
443 | 443 |
/// of the arc sets, while the second phase would read the second arc |
444 | 444 |
/// set into an \e ArcSet class (\c SmartArcSet or \c ListArcSet). |
445 | 445 |
/// The previously read label node map should be passed to the \c |
446 | 446 |
/// useNodes() functions. Another application of multipass reading when |
447 |
/// paths are given as a node map or an arc map. |
|
447 |
/// paths are given as a node map or an arc map. |
|
448 |
/// It is impossible to read this in |
|
448 | 449 |
/// a single pass, because the arcs are not constructed when the node |
449 | 450 |
/// maps are read. |
450 | 451 |
template <typename _Digraph> |
451 | 452 |
class DigraphReader { |
452 | 453 |
public: |
453 | 454 |
... | ... |
@@ -311,13 +311,14 @@ |
311 | 311 |
|
312 | 312 |
///\name Control the state of the timer |
313 | 313 |
///Basically a Timer can be either running or stopped, |
314 | 314 |
///but it provides a bit finer control on the execution. |
315 | 315 |
///The \ref Timer also counts the number of \ref start() |
316 | 316 |
///executions, and is stops only after the same amount (or more) |
317 |
///\ref stop() "stop()"s. This can be useful e.g. to compute |
|
317 |
///\ref stop() "stop()"s. This can be useful e.g. to compute |
|
318 |
///the running time |
|
318 | 319 |
///of recursive functions. |
319 | 320 |
/// |
320 | 321 |
|
321 | 322 |
///@{ |
322 | 323 |
|
323 | 324 |
///Reset and stop the time counters |
... | ... |
@@ -107,24 +107,27 @@ |
107 | 107 |
check(pathSource(G, p) == s,"path() found a wrong path."); |
108 | 108 |
check(pathTarget(G, p) == t,"path() found a wrong path."); |
109 | 109 |
|
110 | 110 |
for(ArcIt e(G); e!=INVALID; ++e) { |
111 | 111 |
Node u=G.source(e); |
112 | 112 |
Node v=G.target(e); |
113 |
check( !dijkstra_test.reached(u) || (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]), |
|
114 |
"dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]); |
|
113 |
check( !dijkstra_test.reached(u) || |
|
114 |
(dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]), |
|
115 |
"dist(target)-dist(source)-arc_length= " << |
|
116 |
dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]); |
|
115 | 117 |
} |
116 | 118 |
|
117 | 119 |
for(NodeIt v(G); v!=INVALID; ++v){ |
118 | 120 |
check(dijkstra_test.reached(v),"Each node should be reached."); |
119 | 121 |
if ( dijkstra_test.predArc(v)!=INVALID ) { |
120 | 122 |
Arc e=dijkstra_test.predArc(v); |
121 | 123 |
Node u=G.source(e); |
122 | 124 |
check(u==dijkstra_test.predNode(v),"Wrong tree."); |
123 | 125 |
check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == length[e], |
124 |
"Wrong distance! Difference: " << |
|
126 |
"Wrong distance! Difference: " << |
|
127 |
std::abs(dijkstra_test.dist(v)-dijkstra_test.dist(u)-length[e])); |
|
125 | 128 |
} |
126 | 129 |
} |
127 | 130 |
|
128 | 131 |
{ |
129 | 132 |
NullMap<Node,Arc> myPredMap; |
130 | 133 |
dijkstra(G,length).predMap(myPredMap).run(s); |
... | ... |
@@ -89,18 +89,21 @@ |
89 | 89 |
for (NodeIt src(fg); src != INVALID; ++src) { |
90 | 90 |
for (NodeIt trg(fg); trg != INVALID; ++trg) { |
91 | 91 |
Arc con1 = al1(src, trg); |
92 | 92 |
Arc con2 = al2(src, trg); |
93 | 93 |
Arc con3 = al3(src, trg); |
94 | 94 |
Arc con4 = findArc(fg, src, trg); |
95 |
check(con1 == con2 && con2 == con3 && con3 == con4, |
|
95 |
check(con1 == con2 && con2 == con3 && con3 == con4, |
|
96 |
"Different results.") |
|
96 | 97 |
check(con1 != INVALID, "There is no connecting arc."); |
97 | 98 |
check(fg.source(con1) == src, "Wrong source."); |
98 | 99 |
check(fg.target(con1) == trg, "Wrong target."); |
99 |
check(al3(src, trg, con3) == INVALID, "There is more connecting arc."); |
|
100 |
check(findArc(fg, src, trg, con4) == INVALID, "There is more connecting arc."); |
|
100 |
check(al3(src, trg, con3) == INVALID, |
|
101 |
"There is more connecting arc."); |
|
102 |
check(findArc(fg, src, trg, con4) == INVALID, |
|
103 |
"There is more connecting arc."); |
|
101 | 104 |
} |
102 | 105 |
} |
103 | 106 |
} |
104 | 107 |
} |
105 | 108 |
|
106 | 109 |
template <typename Graph> |
... | ... |
@@ -120,13 +123,14 @@ |
120 | 123 |
typename Graph::template EdgeMap<int> found(graph, 0); |
121 | 124 |
DescriptorMap<Graph, Edge> edges(graph); |
122 | 125 |
for (NodeIt src(graph); src != INVALID; ++src) { |
123 | 126 |
for (NodeIt trg(graph); trg != INVALID; ++trg) { |
124 | 127 |
for (ConEdgeIt<Graph> con(graph, src, trg); con != INVALID; ++con) { |
125 | 128 |
check( (graph.u(con) == src && graph.v(con) == trg) || |
126 |
(graph.v(con) == src && graph.u(con) == trg), |
|
129 |
(graph.v(con) == src && graph.u(con) == trg), |
|
130 |
"Wrong end nodes."); |
|
127 | 131 |
++found[con]; |
128 | 132 |
check(found[con] <= 2, "The edge found more than twice."); |
129 | 133 |
} |
130 | 134 |
} |
131 | 135 |
} |
132 | 136 |
for (EdgeIt it(graph); it != INVALID; ++it) { |
... | ... |
@@ -100,24 +100,26 @@ |
100 | 100 |
|
101 | 101 |
checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >(); |
102 | 102 |
ConstMap<A,Const<int,10> > map6; |
103 | 103 |
ConstMap<A,Const<int,10> > map7 = map6; |
104 | 104 |
map6 = constMap<A,int,10>(); |
105 | 105 |
map7 = constMap<A,Const<int,10> >(); |
106 |
check(map6[A()] == 10 && map7[A()] == 10, |
|
106 |
check(map6[A()] == 10 && map7[A()] == 10, |
|
107 |
"Something is wrong with ConstMap"); |
|
107 | 108 |
} |
108 | 109 |
|
109 | 110 |
// IdentityMap |
110 | 111 |
{ |
111 | 112 |
checkConcept<ReadMap<A,A>, IdentityMap<A> >(); |
112 | 113 |
IdentityMap<A> map1; |
113 | 114 |
IdentityMap<A> map2 = map1; |
114 | 115 |
map1 = identityMap<A>(); |
115 | 116 |
|
116 | 117 |
checkConcept<ReadMap<double,double>, IdentityMap<double> >(); |
117 |
check(identityMap<double>()[1.0] == 1.0 && |
|
118 |
check(identityMap<double>()[1.0] == 1.0 && |
|
119 |
identityMap<double>()[3.14] == 3.14, |
|
118 | 120 |
"Something is wrong with IdentityMap"); |
119 | 121 |
} |
120 | 122 |
|
121 | 123 |
// RangeMap |
122 | 124 |
{ |
123 | 125 |
checkConcept<ReferenceMap<int,B,B&,const B&>, RangeMap<B> >(); |
... | ... |
@@ -152,29 +154,32 @@ |
152 | 154 |
std::map<double, int> m; |
153 | 155 |
SparseMap<double, int> map5(m); |
154 | 156 |
SparseMap<double, int> map6(m,10); |
155 | 157 |
SparseMap<double, int> map7 = sparseMap(m); |
156 | 158 |
SparseMap<double, int> map8 = sparseMap(m,10); |
157 | 159 |
|
158 |
check(map5[1.0] == 0 && map5[3.14] == 0 && |
|
160 |
check(map5[1.0] == 0 && map5[3.14] == 0 && |
|
161 |
map6[1.0] == 10 && map6[3.14] == 10, |
|
159 | 162 |
"Something is wrong with SparseMap"); |
160 | 163 |
map5[1.0] = map6[3.14] = 100; |
161 |
check(map5[1.0] == 100 && map5[3.14] == 0 && |
|
164 |
check(map5[1.0] == 100 && map5[3.14] == 0 && |
|
165 |
map6[1.0] == 10 && map6[3.14] == 100, |
|
162 | 166 |
"Something is wrong with SparseMap"); |
163 | 167 |
} |
164 | 168 |
|
165 | 169 |
// ComposeMap |
166 | 170 |
{ |
167 | 171 |
typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap; |
168 | 172 |
checkConcept<ReadMap<B,double>, CompMap>(); |
169 | 173 |
CompMap map1(DoubleMap(),ReadMap<B,A>()); |
170 | 174 |
CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>()); |
171 | 175 |
|
172 | 176 |
SparseMap<double, bool> m1(false); m1[3.14] = true; |
173 | 177 |
RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14; |
174 |
check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], |
|
178 |
check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], |
|
179 |
"Something is wrong with ComposeMap") |
|
175 | 180 |
} |
176 | 181 |
|
177 | 182 |
// CombineMap |
178 | 183 |
{ |
179 | 184 |
typedef CombineMap<DoubleMap, DoubleMap, std::plus<double> > CombMap; |
180 | 185 |
checkConcept<ReadMap<A,double>, CombMap>(); |
... | ... |
@@ -193,23 +198,27 @@ |
193 | 198 |
FunctorToMap<F> map2(F()); |
194 | 199 |
B b = functorToMap(F())[A()]; |
195 | 200 |
|
196 | 201 |
checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
197 | 202 |
MapToFunctor<ReadMap<A,B> > map(ReadMap<A,B>()); |
198 | 203 |
|
199 |
check(functorToMap(&func)[A()] == 3, "Something is wrong with FunctorToMap"); |
|
200 |
check(mapToFunctor(constMap<A,int>(2))(A()) == 2, "Something is wrong with MapToFunctor"); |
|
201 |
check( |
|
204 |
check(functorToMap(&func)[A()] == 3, |
|
205 |
"Something is wrong with FunctorToMap"); |
|
206 |
check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
|
207 |
"Something is wrong with MapToFunctor"); |
|
208 |
check(mapToFunctor(functorToMap(&func))(A()) == 3 && |
|
209 |
mapToFunctor(functorToMap(&func))[A()] == 3, |
|
202 | 210 |
"Something is wrong with FunctorToMap or MapToFunctor"); |
203 | 211 |
check(functorToMap(mapToFunctor(constMap<A,int>(2)))[A()] == 2, |
204 | 212 |
"Something is wrong with FunctorToMap or MapToFunctor"); |
205 | 213 |
} |
206 | 214 |
|
207 | 215 |
// ConvertMap |
208 | 216 |
{ |
209 |
checkConcept<ReadMap<double,double>, |
|
217 |
checkConcept<ReadMap<double,double>, |
|
218 |
ConvertMap<ReadMap<double, int>, double> >(); |
|
210 | 219 |
ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true)); |
211 | 220 |
ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false)); |
212 | 221 |
} |
213 | 222 |
|
214 | 223 |
// ForkMap |
215 | 224 |
{ |
... | ... |
@@ -221,13 +230,14 @@ |
221 | 230 |
SM m2(-1); |
222 | 231 |
checkConcept<ReadWriteMap<int, double>, ForkMap<RM, SM> >(); |
223 | 232 |
checkConcept<ReadWriteMap<int, double>, ForkMap<SM, RM> >(); |
224 | 233 |
ForkMap<RM, SM> map1(m1,m2); |
225 | 234 |
ForkMap<SM, RM> map2 = forkMap(m2,m1); |
226 | 235 |
map2.set(5, 10); |
227 |
check(m1[1] == -1 && m1[5] == 10 && m2[1] == -1 && |
|
236 |
check(m1[1] == -1 && m1[5] == 10 && m2[1] == -1 && |
|
237 |
m2[5] == 10 && map2[1] == -1 && map2[5] == 10, |
|
228 | 238 |
"Something is wrong with ForkMap"); |
229 | 239 |
} |
230 | 240 |
|
231 | 241 |
// Arithmetic maps: |
232 | 242 |
// - AddMap, SubMap, MulMap, DivMap |
233 | 243 |
// - ShiftMap, ShiftWriteMap, ScaleMap, ScaleWriteMap |
... | ... |
@@ -238,32 +248,38 @@ |
238 | 248 |
checkConcept<DoubleMap, MulMap<DoubleMap,DoubleMap> >(); |
239 | 249 |
checkConcept<DoubleMap, DivMap<DoubleMap,DoubleMap> >(); |
240 | 250 |
|
241 | 251 |
ConstMap<int, double> c1(1.0), c2(3.14); |
242 | 252 |
IdentityMap<int> im; |
243 | 253 |
ConvertMap<IdentityMap<int>, double> id(im); |
244 |
check(addMap(c1,id)[0] == 1.0 && addMap(c1,id)[10] == 11.0, "Something is wrong with AddMap"); |
|
245 |
check(subMap(id,c1)[0] == -1.0 && subMap(id,c1)[10] == 9.0, "Something is wrong with SubMap"); |
|
246 |
check(mulMap(id,c2)[0] == 0 && mulMap(id,c2)[2] == 6.28, "Something is wrong with MulMap"); |
|
247 |
check(divMap(c2,id)[1] == 3.14 && divMap(c2,id)[2] == 1.57, "Something is wrong with DivMap"); |
|
254 |
check(addMap(c1,id)[0] == 1.0 && addMap(c1,id)[10] == 11.0, |
|
255 |
"Something is wrong with AddMap"); |
|
256 |
check(subMap(id,c1)[0] == -1.0 && subMap(id,c1)[10] == 9.0, |
|
257 |
"Something is wrong with SubMap"); |
|
258 |
check(mulMap(id,c2)[0] == 0 && mulMap(id,c2)[2] == 6.28, |
|
259 |
"Something is wrong with MulMap"); |
|
260 |
check(divMap(c2,id)[1] == 3.14 && divMap(c2,id)[2] == 1.57, |
|
261 |
"Something is wrong with DivMap"); |
|
248 | 262 |
|
249 | 263 |
checkConcept<DoubleMap, ShiftMap<DoubleMap> >(); |
250 | 264 |
checkConcept<DoubleWriteMap, ShiftWriteMap<DoubleWriteMap> >(); |
251 | 265 |
checkConcept<DoubleMap, ScaleMap<DoubleMap> >(); |
252 | 266 |
checkConcept<DoubleWriteMap, ScaleWriteMap<DoubleWriteMap> >(); |
253 | 267 |
checkConcept<DoubleMap, NegMap<DoubleMap> >(); |
254 | 268 |
checkConcept<DoubleWriteMap, NegWriteMap<DoubleWriteMap> >(); |
255 | 269 |
checkConcept<DoubleMap, AbsMap<DoubleMap> >(); |
256 | 270 |
|
257 | 271 |
check(shiftMap(id, 2.0)[1] == 3.0 && shiftMap(id, 2.0)[10] == 12.0, |
258 | 272 |
"Something is wrong with ShiftMap"); |
259 |
check(shiftWriteMap(id, 2.0)[1] == 3.0 && |
|
273 |
check(shiftWriteMap(id, 2.0)[1] == 3.0 && |
|
274 |
shiftWriteMap(id, 2.0)[10] == 12.0, |
|
260 | 275 |
"Something is wrong with ShiftWriteMap"); |
261 | 276 |
check(scaleMap(id, 2.0)[1] == 2.0 && scaleMap(id, 2.0)[10] == 20.0, |
262 | 277 |
"Something is wrong with ScaleMap"); |
263 |
check(scaleWriteMap(id, 2.0)[1] == 2.0 && |
|
278 |
check(scaleWriteMap(id, 2.0)[1] == 2.0 && |
|
279 |
scaleWriteMap(id, 2.0)[10] == 20.0, |
|
264 | 280 |
"Something is wrong with ScaleWriteMap"); |
265 | 281 |
check(negMap(id)[1] == -1.0 && negMap(id)[-10] == 10.0, |
266 | 282 |
"Something is wrong with NegMap"); |
267 | 283 |
check(negWriteMap(id)[1] == -1.0 && negWriteMap(id)[-10] == 10.0, |
268 | 284 |
"Something is wrong with NegWriteMap"); |
269 | 285 |
check(absMap(id)[1] == 1.0 && absMap(id)[-10] == 10.0, |
... | ... |
@@ -286,18 +302,22 @@ |
286 | 302 |
checkConcept<BoolMap, LessMap<DoubleMap,DoubleMap> >(); |
287 | 303 |
|
288 | 304 |
TrueMap<int> tm; |
289 | 305 |
FalseMap<int> fm; |
290 | 306 |
RangeMap<bool> rm(2); |
291 | 307 |
rm[0] = true; rm[1] = false; |
292 |
check(andMap(tm,rm)[0] && !andMap(tm,rm)[1] && |
|
308 |
check(andMap(tm,rm)[0] && !andMap(tm,rm)[1] && |
|
309 |
!andMap(fm,rm)[0] && !andMap(fm,rm)[1], |
|
293 | 310 |
"Something is wrong with AndMap"); |
294 |
check(orMap(tm,rm)[0] && orMap(tm,rm)[1] && |
|
311 |
check(orMap(tm,rm)[0] && orMap(tm,rm)[1] && |
|
312 |
orMap(fm,rm)[0] && !orMap(fm,rm)[1], |
|
295 | 313 |
"Something is wrong with OrMap"); |
296 |
check(!notMap(rm)[0] && notMap(rm)[1], "Something is wrong with NotMap"); |
|
297 |
check(!notWriteMap(rm)[0] && notWriteMap(rm)[1], "Something is wrong with NotWriteMap"); |
|
314 |
check(!notMap(rm)[0] && notMap(rm)[1], |
|
315 |
"Something is wrong with NotMap"); |
|
316 |
check(!notWriteMap(rm)[0] && notWriteMap(rm)[1], |
|
317 |
"Something is wrong with NotWriteMap"); |
|
298 | 318 |
|
299 | 319 |
ConstMap<int, double> cm(2.0); |
300 | 320 |
IdentityMap<int> im; |
301 | 321 |
ConvertMap<IdentityMap<int>, double> id(im); |
302 | 322 |
check(lessMap(id,cm)[1] && !lessMap(id,cm)[2] && !lessMap(id,cm)[3], |
303 | 323 |
"Something is wrong with LessMap"); |
... | ... |
@@ -307,21 +327,23 @@ |
307 | 327 |
|
308 | 328 |
// LoggerBoolMap |
309 | 329 |
{ |
310 | 330 |
typedef std::vector<int> vec; |
311 | 331 |
vec v1; |
312 | 332 |
vec v2(10); |
313 |
LoggerBoolMap<std::back_insert_iterator<vec> > |
|
333 |
LoggerBoolMap<std::back_insert_iterator<vec> > |
|
334 |
map1(std::back_inserter(v1)); |
|
314 | 335 |
LoggerBoolMap<vec::iterator> map2(v2.begin()); |
315 | 336 |
map1.set(10, false); |
316 | 337 |
map1.set(20, true); map2.set(20, true); |
317 | 338 |
map1.set(30, false); map2.set(40, false); |
318 | 339 |
map1.set(50, true); map2.set(50, true); |
319 | 340 |
map1.set(60, true); map2.set(60, true); |
320 | 341 |
check(v1.size() == 3 && v2.size() == 10 && |
321 |
v1[0]==20 && v1[1]==50 && v1[2]==60 && |
|
342 |
v1[0]==20 && v1[1]==50 && v1[2]==60 && |
|
343 |
v2[0]==20 && v2[1]==50 && v2[2]==60, |
|
322 | 344 |
"Something is wrong with LoggerBoolMap"); |
323 | 345 |
|
324 | 346 |
int i = 0; |
325 | 347 |
for ( LoggerBoolMap<vec::iterator>::Iterator it = map2.begin(); |
326 | 348 |
it != map2.end(); ++it ) |
327 | 349 |
check(v1[i++] == *it, "Something is wrong with LoggerBoolMap"); |
0 comments (0 inline)