gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Apply unify-sources.sh to the source tree
0 80 0
default
80 files changed with 5935 insertions and 5936 deletions:
229
229
251
251
↑ Collapse diff ↑
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -66,3 +66,3 @@
66 66
    .other("...");
67
  
67

	
68 68
  // Perform the parsing process
... ...
@@ -86,3 +86,3 @@
86 86
  if(ap.given("grc")) std::cout << "  -grc is given\n";
87
  
87

	
88 88
  switch(ap.files().size()) {
... ...
@@ -96,3 +96,3 @@
96 96
    std::cout << "  "
97
	      << ap.files().size() << " file arguments were given. They are:\n";
97
              << ap.files().size() << " file arguments were given. They are:\n";
98 98
  }
... ...
@@ -100,3 +100,3 @@
100 100
    std::cout << "    '" << ap.files()[i] << "'\n";
101
  
101

	
102 102
  return 0;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -51,3 +51,3 @@
51 51
  typedef dim2::Point<int> Point;
52
  
52

	
53 53
  Node n1=g.addNode();
... ...
@@ -64,3 +64,3 @@
64 64
  ListDigraph::ArcMap<int> widths(g);
65
  
65

	
66 66
  coords[n1]=Point(50,50);  sizes[n1]=1; colors[n1]=1; shapes[n1]=0;
... ...
@@ -70,3 +70,3 @@
70 70
  coords[n5]=Point(85,60);  sizes[n5]=3; colors[n5]=5; shapes[n5]=2;
71
  
71

	
72 72
  Arc a;
... ...
@@ -80,3 +80,3 @@
80 80
  a=g.addArc(n3,n4); acolors[a]=2; widths[a]=1;
81
  
81

	
82 82
  IdMap<ListDigraph,Node> id(g);
... ...
@@ -184,3 +184,3 @@
184 184
  ListDigraph::NodeMap<Point> hcoords(h);
185
  
185

	
186 186
  int cols=int(sqrt(double(palette.size())));
... ...
@@ -191,3 +191,3 @@
191 191
  }
192
  
192

	
193 193
  cout << "Create 'graph_to_eps_demo_out_6_colors.eps'" << endl;
... ...
@@ -204,3 +204,3 @@
204 204
    run();
205
    
205

	
206 206
  return 0;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -23,3 +23,3 @@
23 23
/// This program gives an example of how to read and write a digraph
24
/// and additional maps from/to a stream or a file using the 
24
/// and additional maps from/to a stream or a file using the
25 25
/// \ref lgf-format "LGF" format.
... ...
@@ -44,3 +44,3 @@
44 44
  SmartDigraph::Node s, t;
45
  
45

	
46 46
  try {
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -20,3 +20,3 @@
20 20

	
21
\page coding_style LEMON Coding Style 
21
\page coding_style LEMON Coding Style
22 22

	
... ...
@@ -70,3 +70,3 @@
70 70
\code
71
AllWordsCapitalizedWithoutUnderscores 
71
AllWordsCapitalizedWithoutUnderscores
72 72
\endcode
... ...
@@ -78,3 +78,3 @@
78 78
\code
79
firstWordLowerCaseRestCapitalizedWithoutUnderscores 
79
firstWordLowerCaseRestCapitalizedWithoutUnderscores
80 80
\endcode
... ...
@@ -86,6 +86,6 @@
86 86
\code
87
ALL_UPPER_CASE_WITH_UNDERSCORES 
87
ALL_UPPER_CASE_WITH_UNDERSCORES
88 88
\endcode
89 89

	
90
\subsection cs-loc-var Class and instance member variables, auto variables 
90
\subsection cs-loc-var Class and instance member variables, auto variables
91 91

	
... ...
@@ -94,3 +94,3 @@
94 94
\code
95
all_lower_case_with_underscores 
95
all_lower_case_with_underscores
96 96
\endcode
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -76,3 +76,3 @@
76 76
This directory contains some helper classes to implement graphs, maps and
77
some other classes. As a user you typically don't have to deal with these 
77
some other classes. As a user you typically don't have to deal with these
78 78
files.
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -28,6 +28,6 @@
28 28

	
29
The implementation of combinatorial algorithms heavily relies on 
30
efficient graph implementations. LEMON offers data structures which are 
31
planned to be easily used in an experimental phase of implementation studies, 
32
and thereafter the program code can be made efficient by small modifications. 
29
The implementation of combinatorial algorithms heavily relies on
30
efficient graph implementations. LEMON offers data structures which are
31
planned to be easily used in an experimental phase of implementation studies,
32
and thereafter the program code can be made efficient by small modifications.
33 33

	
... ...
@@ -42,13 +42,13 @@
42 42

	
43
Alteration of standard containers need a very limited number of 
44
operations, these together satisfy the everyday requirements. 
45
In the case of graph structures, different operations are needed which do 
46
not alter the physical graph, but gives another view. If some nodes or 
43
Alteration of standard containers need a very limited number of
44
operations, these together satisfy the everyday requirements.
45
In the case of graph structures, different operations are needed which do
46
not alter the physical graph, but gives another view. If some nodes or
47 47
arcs have to be hidden or the reverse oriented graph have to be used, then
48
this is the case. It also may happen that in a flow implementation 
49
the residual graph can be accessed by another algorithm, or a node-set 
50
is to be shrunk for another algorithm. 
51
LEMON also provides a variety of graphs for these requirements called 
52
\ref graph_adaptors "graph adaptors". Adaptors cannot be used alone but only 
53
in conjunction with other graph representations. 
48
this is the case. It also may happen that in a flow implementation
49
the residual graph can be accessed by another algorithm, or a node-set
50
is to be shrunk for another algorithm.
51
LEMON also provides a variety of graphs for these requirements called
52
\ref graph_adaptors "graph adaptors". Adaptors cannot be used alone but only
53
in conjunction with other graph representations.
54 54

	
... ...
@@ -56,3 +56,3 @@
56 56
the best, most graph algorithms and auxiliary data structures can be used
57
with any graph structures. 
57
with any graph structures.
58 58
*/
... ...
@@ -65,3 +65,3 @@
65 65
This group describes some graph types between real graphs and graph adaptors.
66
These classes wrap graphs to give new functionality as the adaptors do it. 
66
These classes wrap graphs to give new functionality as the adaptors do it.
67 67
On the other hand they are not light-weight structures as the adaptors.
... ...
@@ -70,3 +70,3 @@
70 70
/**
71
@defgroup maps Maps 
71
@defgroup maps Maps
72 72
@ingroup datas
... ...
@@ -81,3 +81,3 @@
81 81
/**
82
@defgroup graph_maps Graph Maps 
82
@defgroup graph_maps Graph Maps
83 83
@ingroup maps
... ...
@@ -117,5 +117,5 @@
117 117
  }
118
  
118

	
119 119
  Digraph::NodeMap<int> degree_map(graph);
120
  
120

	
121 121
  digraphToEps(graph, "graph.eps")
... ...
@@ -124,3 +124,3 @@
124 124
    .run();
125
\endcode 
125
\endcode
126 126
The \c functorToMap() function makes an \c int to \c Color map from the
... ...
@@ -142,3 +142,3 @@
142 142
  TimeMap time(length, speed);
143
  
143

	
144 144
  Dijkstra<Digraph, TimeMap> dijkstra(graph, time);
... ...
@@ -154,3 +154,3 @@
154 154
/**
155
@defgroup matrices Matrices 
155
@defgroup matrices Matrices
156 156
@ingroup datas
... ...
@@ -202,3 +202,3 @@
202 202

	
203
This group describes the common graph search algorithms like 
203
This group describes the common graph search algorithms like
204 204
Breadth-first search (Bfs) and Depth-first search (Dfs).
... ...
@@ -214,5 +214,5 @@
214 214

	
215
/** 
216
@defgroup max_flow Maximum Flow algorithms 
217
@ingroup algs 
215
/**
216
@defgroup max_flow Maximum Flow algorithms
217
@ingroup algs
218 218
\brief Algorithms for finding maximum flows.
... ...
@@ -233,3 +233,3 @@
233 233
LEMON contains several algorithms for solving maximum flow problems:
234
- \ref lemon::EdmondsKarp "Edmonds-Karp" 
234
- \ref lemon::EdmondsKarp "Edmonds-Karp"
235 235
- \ref lemon::Preflow "Goldberg's Preflow algorithm"
... ...
@@ -252,3 +252,3 @@
252 252
This group describes the algorithms for finding minimum cost flows and
253
circulations.  
253
circulations.
254 254
*/
... ...
@@ -256,4 +256,4 @@
256 256
/**
257
@defgroup min_cut Minimum Cut algorithms 
258
@ingroup algs 
257
@defgroup min_cut Minimum Cut algorithms
258
@ingroup algs
259 259

	
... ...
@@ -274,3 +274,3 @@
274 274
- \ref lemon::HaoOrlin "Hao-Orlin algorithm" to calculate minimum cut
275
  in directed graphs  
275
  in directed graphs
276 276
- \ref lemon::NagamochiIbaraki "Nagamochi-Ibaraki algorithm" to
... ...
@@ -309,3 +309,3 @@
309 309
/**
310
@defgroup matching Matching algorithms 
310
@defgroup matching Matching algorithms
311 311
@ingroup algs
... ...
@@ -316,3 +316,3 @@
316 316
finding a subset of the arcs which does not shares common endpoints.
317
 
317

	
318 318
There are several different algorithms for calculate matchings in
... ...
@@ -325,12 +325,12 @@
325 325
Lemon contains the next algorithms:
326
- \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp 
327
  augmenting path algorithm for calculate maximum cardinality matching in 
326
- \ref lemon::MaxBipartiteMatching "MaxBipartiteMatching" Hopcroft-Karp
327
  augmenting path algorithm for calculate maximum cardinality matching in
328 328
  bipartite graphs
329
- \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel 
330
  algorithm for calculate maximum cardinality matching in bipartite graphs 
331
- \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching" 
332
  Successive shortest path algorithm for calculate maximum weighted matching 
329
- \ref lemon::PrBipartiteMatching "PrBipartiteMatching" Push-Relabel
330
  algorithm for calculate maximum cardinality matching in bipartite graphs
331
- \ref lemon::MaxWeightedBipartiteMatching "MaxWeightedBipartiteMatching"
332
  Successive shortest path algorithm for calculate maximum weighted matching
333 333
  and maximum weighted bipartite matching in bipartite graph
334
- \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching" 
335
  Successive shortest path algorithm for calculate minimum cost maximum 
334
- \ref lemon::MinCostMaxBipartiteMatching "MinCostMaxBipartiteMatching"
335
  Successive shortest path algorithm for calculate minimum cost maximum
336 336
  matching in bipartite graph
... ...
@@ -398,4 +398,4 @@
398 398

	
399
/** 
400
@defgroup lp_utils Tools for Lp and Mip solvers 
399
/**
400
@defgroup lp_utils Tools for Lp and Mip solvers
401 401
@ingroup lp_group
... ...
@@ -416,3 +416,3 @@
416 416
/**
417
@defgroup utils Tools and Utilities 
417
@defgroup utils Tools and Utilities
418 418
\brief Tools and utilities for programming in LEMON
... ...
@@ -469,3 +469,3 @@
469 469

	
470
This group describes the tools for importing and exporting graphs 
470
This group describes the tools for importing and exporting graphs
471 471
and graph related data. Now it supports the LEMON format, the
... ...
@@ -488,3 +488,3 @@
488 488
This group describes general \c EPS drawing methods and special
489
graph exporting tools. 
489
graph exporting tools.
490 490
*/
... ...
@@ -500,3 +500,3 @@
500 500
The purpose of the classes in this group is fourfold.
501
 
501

	
502 502
- These classes contain the documentations of the concepts. In order
... ...
@@ -553,6 +553,6 @@
553 553

	
554
Some utility applications are listed here. 
554
Some utility applications are listed here.
555 555

	
556 556
The standard compilation procedure (<tt>./configure;make</tt>) will compile
557
them, as well. 
557
them, as well.
558 558
*/
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -45,3 +45,3 @@
45 45
character sequence surrounded by double quotes, and it can also
46
contain whitespaces and escape sequences. 
46
contain whitespaces and escape sequences.
47 47

	
... ...
@@ -74,3 +74,3 @@
74 74
 @arcs
75
 	      capacity
75
               capacity
76 76
 1   2   16
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -43,3 +43,3 @@
43 43

	
44
If you want to get a quick start and see the most important features then 
44
If you want to get a quick start and see the most important features then
45 45
take a look at our \ref quicktour
... ...
@@ -47,7 +47,7 @@
47 47

	
48
If you already feel like using our library, see the page that tells you 
48
If you already feel like using our library, see the page that tells you
49 49
\ref getstart "How to start using LEMON".
50 50

	
51
If you 
52
want to see how LEMON works, see 
51
If you
52
want to see how LEMON works, see
53 53
some \ref demoprograms "demo programs"!
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -40,26 +40,26 @@
40 40
      if(i->second.self_delete)
41
	switch(i->second.type) {
42
	case BOOL:
43
	  delete i->second.bool_p;
44
	  break;
45
	case STRING:
46
	  delete i->second.string_p;
47
	  break;
48
	case DOUBLE:
49
	  delete i->second.double_p;
50
	  break;
51
	case INTEGER:
52
	  delete i->second.int_p;
53
	  break;
54
	case UNKNOWN:
55
	  break;
56
	case FUNC:
57
	  break;
58
	}
41
        switch(i->second.type) {
42
        case BOOL:
43
          delete i->second.bool_p;
44
          break;
45
        case STRING:
46
          delete i->second.string_p;
47
          break;
48
        case DOUBLE:
49
          delete i->second.double_p;
50
          break;
51
        case INTEGER:
52
          delete i->second.int_p;
53
          break;
54
        case UNKNOWN:
55
          break;
56
        case FUNC:
57
          break;
58
        }
59 59
  }
60
  
60

	
61 61

	
62 62
  ArgParser &ArgParser::intOption(const std::string &name,
63
			       const std::string &help,
64
			       int value, bool obl)
63
                               const std::string &help,
64
                               int value, bool obl)
65 65
  {
... ...
@@ -76,4 +76,4 @@
76 76
  ArgParser &ArgParser::doubleOption(const std::string &name,
77
			       const std::string &help,
78
			       double value, bool obl)
77
                               const std::string &help,
78
                               double value, bool obl)
79 79
  {
... ...
@@ -90,4 +90,4 @@
90 90
  ArgParser &ArgParser::boolOption(const std::string &name,
91
			       const std::string &help,
92
			       bool value, bool obl)
91
                               const std::string &help,
92
                               bool value, bool obl)
93 93
  {
... ...
@@ -104,4 +104,4 @@
104 104
  ArgParser &ArgParser::stringOption(const std::string &name,
105
			       const std::string &help,
106
			       std::string value, bool obl)
105
                               const std::string &help,
106
                               std::string value, bool obl)
107 107
  {
... ...
@@ -118,4 +118,4 @@
118 118
  ArgParser &ArgParser::refOption(const std::string &name,
119
			       const std::string &help,
120
			       int &ref, bool obl)
119
                               const std::string &help,
120
                               int &ref, bool obl)
121 121
  {
... ...
@@ -163,4 +163,4 @@
163 163
  ArgParser &ArgParser::refOption(const std::string &name,
164
			       const std::string &help,
165
			       std::string &ref, bool obl)
164
                               const std::string &help,
165
                               std::string &ref, bool obl)
166 166
  {
... ...
@@ -177,4 +177,4 @@
177 177
  ArgParser &ArgParser::funcOption(const std::string &name,
178
			       const std::string &help,
179
			       void (*func)(void *),void *data)
178
                               const std::string &help,
179
                               void (*func)(void *),void *data)
180 180
  {
... ...
@@ -192,3 +192,3 @@
192 192
  ArgParser &ArgParser::optionGroup(const std::string &group,
193
				    const std::string &opt)
193
                                    const std::string &opt)
194 194
  {
... ...
@@ -196,3 +196,3 @@
196 196
    LEMON_ASSERT(i!=_opts.end(), "Unknown option: '"+opt+"'");
197
    LEMON_ASSERT(!(i->second.ingroup), 
197
    LEMON_ASSERT(!(i->second.ingroup),
198 198
                 "Option already in option group: '"+opt+"'");
... ...
@@ -212,3 +212,3 @@
212 212
  ArgParser &ArgParser::synonym(const std::string &syn,
213
				const std::string &opt)
213
                                const std::string &opt)
214 214
  {
... ...
@@ -235,3 +235,3 @@
235 235
  ArgParser &ArgParser::other(const std::string &name,
236
			      const std::string &help)
236
                              const std::string &help)
237 237
  {
... ...
@@ -246,4 +246,4 @@
246 246
      for(Opts::iterator j=_opts.begin();j!=_opts.end();++j)
247
	if(j->second.syn&&j->second.help==i->first)
248
	  os << "|-" << j->first;
247
        if(j->second.syn&&j->second.help==i->first)
248
          os << "|-" << j->first;
249 249
    switch(i->second.type) {
... ...
@@ -272,3 +272,3 @@
272 272
  }
273
    
273

	
274 274
  void ArgParser::showHelp(Opts::iterator i)
... ...
@@ -285,5 +285,5 @@
285 285
    std::cerr << "  " << i->name << std::endl
286
	      << "     " << i->help << std::endl;
286
              << "     " << i->help << std::endl;
287 287
  }
288
    
288

	
289 289
  void ArgParser::shortHelp()
... ...
@@ -301,4 +301,4 @@
301 301
      if(pos+cstr.str().size()>LINE_LEN) {
302
	std::cerr << std::endl << indent;
303
	pos=indent.size();
302
        std::cerr << std::endl << indent;
303
        pos=indent.size();
304 304
      }
... ...
@@ -309,26 +309,26 @@
309 309
      if(!i->second.ingroup&&!i->second.syn) {
310
	std::ostringstream cstr;
311
	cstr << ' ';
312
	if(!i->second.mandatory) cstr << '[';
313
	show(cstr,i);
314
	if(!i->second.mandatory) cstr << ']';
315
	if(pos+cstr.str().size()>LINE_LEN) {
316
	  std::cerr << std::endl << indent;
317
	  pos=indent.size();
318
	}
319
	std::cerr << cstr.str();
320
	pos+=cstr.str().size();
310
        std::ostringstream cstr;
311
        cstr << ' ';
312
        if(!i->second.mandatory) cstr << '[';
313
        show(cstr,i);
314
        if(!i->second.mandatory) cstr << ']';
315
        if(pos+cstr.str().size()>LINE_LEN) {
316
          std::cerr << std::endl << indent;
317
          pos=indent.size();
318
        }
319
        std::cerr << cstr.str();
320
        pos+=cstr.str().size();
321 321
      }
322 322
    for(std::vector<OtherArg>::iterator i=_others_help.begin();
323
	i!=_others_help.end();++i)
323
        i!=_others_help.end();++i)
324 324
      {
325
	std::ostringstream cstr;
326
	cstr << ' ' << i->name;
327
      
328
	if(pos+cstr.str().size()>LINE_LEN) {
329
	  std::cerr << std::endl << indent;
330
	  pos=indent.size();
331
	}
332
	std::cerr << cstr.str();
333
	pos+=cstr.str().size();
325
        std::ostringstream cstr;
326
        cstr << ' ' << i->name;
327

	
328
        if(pos+cstr.str().size()>LINE_LEN) {
329
          std::cerr << std::endl << indent;
330
          pos=indent.size();
331
        }
332
        std::cerr << cstr.str();
333
        pos+=cstr.str().size();
334 334
      }
... ...
@@ -336,3 +336,3 @@
336 336
  }
337
    
337

	
338 338
  void ArgParser::showHelp()
... ...
@@ -342,3 +342,3 @@
342 342
    for(std::vector<OtherArg>::iterator i=_others_help.begin();
343
	i!=_others_help.end();++i) showHelp(i);
343
        i!=_others_help.end();++i) showHelp(i);
344 344
    for(Opts::iterator i=_opts.begin();i!=_opts.end();++i) showHelp(i);
... ...
@@ -346,5 +346,5 @@
346 346
  }
347
    
348
      
349
  void ArgParser::unknownOpt(std::string arg) 
347

	
348

	
349
  void ArgParser::unknownOpt(std::string arg)
350 350
  {
... ...
@@ -355,4 +355,4 @@
355 355
  }
356
    
357
  void ArgParser::requiresValue(std::string arg, OptType t) 
356

	
357
  void ArgParser::requiresValue(std::string arg, OptType t)
358 358
  {
... ...
@@ -375,3 +375,3 @@
375 375
  }
376
    
376

	
377 377

	
... ...
@@ -381,37 +381,37 @@
381 381
    for(Opts::iterator i=_opts.begin();i!=_opts.end();++i)
382
      if(i->second.mandatory&&!i->second.set) 
383
	{
384
	  if(ok)
385
	    std::cerr << _command_name 
386
		      << ": The following mandatory arguments are missing.\n";
387
	  ok=false;
388
	  showHelp(i);
389
	}
382
      if(i->second.mandatory&&!i->second.set)
383
        {
384
          if(ok)
385
            std::cerr << _command_name
386
                      << ": The following mandatory arguments are missing.\n";
387
          ok=false;
388
          showHelp(i);
389
        }
390 390
    for(Groups::iterator i=_groups.begin();i!=_groups.end();++i)
391 391
      if(i->second.mandatory||i->second.only_one)
392
	{
393
	  int set=0;
394
	  for(GroupData::Opts::iterator o=i->second.opts.begin();
395
	      o!=i->second.opts.end();++o)
396
	    if(_opts.find(*o)->second.set) ++set;
397
	  if(i->second.mandatory&&!set) {
398
	    std::cerr << _command_name 
399
		      << ": At least one of the following arguments is mandatory.\n";
400
	    ok=false;
401
	    for(GroupData::Opts::iterator o=i->second.opts.begin();
402
		o!=i->second.opts.end();++o)
403
	      showHelp(_opts.find(*o));
404
	  }
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";
408
	    ok=false;
409
	    for(GroupData::Opts::iterator o=i->second.opts.begin();
410
		o!=i->second.opts.end();++o)
411
	      showHelp(_opts.find(*o));
412
	  }
413
	}
392
        {
393
          int set=0;
394
          for(GroupData::Opts::iterator o=i->second.opts.begin();
395
              o!=i->second.opts.end();++o)
396
            if(_opts.find(*o)->second.set) ++set;
397
          if(i->second.mandatory&&!set) {
398
            std::cerr << _command_name
399
                      << ": At least one of the following arguments is mandatory.\n";
400
            ok=false;
401
            for(GroupData::Opts::iterator o=i->second.opts.begin();
402
                o!=i->second.opts.end();++o)
403
              showHelp(_opts.find(*o));
404
          }
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";
408
            ok=false;
409
            for(GroupData::Opts::iterator o=i->second.opts.begin();
410
                o!=i->second.opts.end();++o)
411
              showHelp(_opts.find(*o));
412
          }
413
        }
414 414
    if(!ok) {
415 415
      std::cerr << "\nType '" << _command_name <<
416
	" --help' to obtain a short summary on the usage.\n\n";
416
        " --help' to obtain a short summary on the usage.\n\n";
417 417
      exit(1);
... ...
@@ -425,34 +425,34 @@
425 425
      if (arg[0] != '-' || arg.size() == 1) {
426
	_file_args.push_back(arg);
426
        _file_args.push_back(arg);
427 427
      }
428 428
      else {
429
	Opts::iterator i = _opts.find(arg.substr(1));
430
	if(i==_opts.end()) unknownOpt(arg);
431
	else {
432
	  if(i->second.syn) i=_opts.find(i->second.help);
433
	  ParData &p(i->second);
434
	  if (p.type==BOOL) *p.bool_p=true;
435
	  else if (p.type==FUNC) p.func_p.p(p.func_p.data);
436
	  else if(++ar==_argc) requiresValue(arg, p.type);
437
	  else {
438
	    std::string val(_argv[ar]);
439
	    std::istringstream vals(val);
440
	    switch(p.type) {
441
	    case STRING:
442
	      *p.string_p=val;
443
	      break;
444
	    case INTEGER:
445
	      vals >> *p.int_p;
446
	      break;
447
	    case DOUBLE:
448
	      vals >> *p.double_p;
449
	      break;
450
	    default:
451
	      break;
452
	    }
453
	    if(p.type!=STRING&&(!vals||!vals.eof()))
454
	      requiresValue(arg, p.type);
455
	  }
456
	  p.set = true;
457
	}
429
        Opts::iterator i = _opts.find(arg.substr(1));
430
        if(i==_opts.end()) unknownOpt(arg);
431
        else {
432
          if(i->second.syn) i=_opts.find(i->second.help);
433
          ParData &p(i->second);
434
          if (p.type==BOOL) *p.bool_p=true;
435
          else if (p.type==FUNC) p.func_p.p(p.func_p.data);
436
          else if(++ar==_argc) requiresValue(arg, p.type);
437
          else {
438
            std::string val(_argv[ar]);
439
            std::istringstream vals(val);
440
            switch(p.type) {
441
            case STRING:
442
              *p.string_p=val;
443
              break;
444
            case INTEGER:
445
              vals >> *p.int_p;
446
              break;
447
            case DOUBLE:
448
              vals >> *p.double_p;
449
              break;
450
            default:
451
              break;
452
            }
453
            if(p.type!=STRING&&(!vals||!vals.eof()))
454
              requiresValue(arg, p.type);
455
          }
456
          p.set = true;
457
        }
458 458
      }
... ...
@@ -462,3 +462,3 @@
462 462
    return *this;
463
  }  
463
  }
464 464

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -43,11 +43,11 @@
43 43
  class ArgParser {
44
    
44

	
45 45
    static void _showHelp(void *p);
46 46
  protected:
47
    
47

	
48 48
    int _argc;
49 49
    const char **_argv;
50
    
50

	
51 51
    enum OptType { UNKNOWN=0, BOOL=1, STRING=2, DOUBLE=3, INTEGER=4, FUNC=5 };
52
    
52

	
53 53
    class ParData {
... ...
@@ -55,11 +55,11 @@
55 55
      union {
56
	bool *bool_p;
57
	int *int_p;
58
	double *double_p;
59
	std::string *string_p;
60
	struct {
61
	  void (*p)(void *);
62
	  void *data;
63
	} func_p;
64
	  
56
        bool *bool_p;
57
        int *int_p;
58
        double *double_p;
59
        std::string *string_p;
60
        struct {
61
          void (*p)(void *);
62
          void *data;
63
        } func_p;
64

	
65 65
      };
... ...
@@ -74,3 +74,3 @@
74 74
      ParData() : mandatory(false), type(UNKNOWN), set(false), ingroup(false),
75
		  has_syn(false), syn(false), self_delete(false) {}
75
                  has_syn(false), syn(false), self_delete(false) {}
76 76
    };
... ...
@@ -80,3 +80,3 @@
80 80

	
81
    class GroupData 
81
    class GroupData
82 82
    {
... ...
@@ -89,3 +89,3 @@
89 89
    };
90
      
90

	
91 91
    typedef std::map<std::string,GroupData> Groups;
... ...
@@ -100,3 +100,3 @@
100 100
    };
101
      
101

	
102 102
    std::vector<OtherArg> _others_help;
... ...
@@ -105,3 +105,3 @@
105 105

	
106
    
106

	
107 107
  private:
... ...
@@ -115,5 +115,5 @@
115 115
    ArgParser &funcOption(const std::string &name,
116
		    const std::string &help,
117
		    void (*func)(void *),void *data);
118
    
116
                    const std::string &help,
117
                    void (*func)(void *),void *data);
118

	
119 119
  public:
... ...
@@ -138,4 +138,4 @@
138 138
    ArgParser &intOption(const std::string &name,
139
		    const std::string &help,
140
		    int value=0, bool obl=false);
139
                    const std::string &help,
140
                    int value=0, bool obl=false);
141 141

	
... ...
@@ -149,4 +149,4 @@
149 149
    ArgParser &doubleOption(const std::string &name,
150
		      const std::string &help,
151
		      double value=0, bool obl=false);
150
                      const std::string &help,
151
                      double value=0, bool obl=false);
152 152

	
... ...
@@ -161,4 +161,4 @@
161 161
    ArgParser &boolOption(const std::string &name,
162
		      const std::string &help,
163
		      bool value=false, bool obl=false);
162
                      const std::string &help,
163
                      bool value=false, bool obl=false);
164 164

	
... ...
@@ -172,4 +172,4 @@
172 172
    ArgParser &stringOption(const std::string &name,
173
		      const std::string &help,
174
		      std::string value="", bool obl=false);
173
                      const std::string &help,
174
                      std::string value="", bool obl=false);
175 175

	
... ...
@@ -181,4 +181,4 @@
181 181
    ArgParser &other(const std::string &name,
182
		     const std::string &help="");
183
    
182
                     const std::string &help="");
183

	
184 184
    ///@}
... ...
@@ -199,4 +199,4 @@
199 199
    ArgParser &refOption(const std::string &name,
200
		    const std::string &help,
201
		    int &ref, bool obl=false);
200
                    const std::string &help,
201
                    int &ref, bool obl=false);
202 202

	
... ...
@@ -210,4 +210,4 @@
210 210
    ArgParser &refOption(const std::string &name,
211
		      const std::string &help,
212
		      double &ref, bool obl=false);
211
                      const std::string &help,
212
                      double &ref, bool obl=false);
213 213

	
... ...
@@ -222,4 +222,4 @@
222 222
    ArgParser &refOption(const std::string &name,
223
		      const std::string &help,
224
		      bool &ref, bool obl=false);
223
                      const std::string &help,
224
                      bool &ref, bool obl=false);
225 225

	
... ...
@@ -233,5 +233,5 @@
233 233
    ArgParser &refOption(const std::string &name,
234
		      const std::string &help,
235
		      std::string &ref, bool obl=false);
236
    
234
                      const std::string &help,
235
                      std::string &ref, bool obl=false);
236

	
237 237
    ///@}
... ...
@@ -240,3 +240,3 @@
240 240
    ///
241
    
241

	
242 242
    ///@{
... ...
@@ -250,3 +250,3 @@
250 250
    ArgParser &optionGroup(const std::string &group,
251
			   const std::string &opt);
251
                           const std::string &opt);
252 252

	
... ...
@@ -257,3 +257,3 @@
257 257
    ArgParser &onlyOneGroup(const std::string &group);
258
  
258

	
259 259
    ///Make a group mandatory
... ...
@@ -263,3 +263,3 @@
263 263
    ArgParser &mandatoryGroup(const std::string &group);
264
    
264

	
265 265
    ///Create synonym to an option
... ...
@@ -269,4 +269,4 @@
269 269
    ArgParser &synonym(const std::string &syn,
270
			   const std::string &opt);
271
    
270
                           const std::string &opt);
271

	
272 272
    ///@}
... ...
@@ -284,3 +284,3 @@
284 284
    void checkMandatories();
285
    
285

	
286 286
    ///Start the parsing process
... ...
@@ -289,3 +289,3 @@
289 289
    /// Synonym for parse()
290
    ArgParser &run() 
290
    ArgParser &run()
291 291
    {
... ...
@@ -293,3 +293,3 @@
293 293
    }
294
    
294

	
295 295
    ///Give back the command name (the 0th argument)
... ...
@@ -298,3 +298,3 @@
298 298
    ///Check if an opion has been given to the command.
299
    bool given(std::string op) 
299
    bool given(std::string op)
300 300
    {
... ...
@@ -306,3 +306,3 @@
306 306
    ///Magic type for operator[]
307
    
307

	
308 308
    ///This is the type of the return value of ArgParser::operator[]().
... ...
@@ -311,3 +311,3 @@
311 311
    ///throws an exception (i.e. it performs runtime type checking).
312
    class RefType 
312
    class RefType
313 313
    {
... ...
@@ -319,10 +319,10 @@
319 319
      ///\e
320
      operator bool() 
320
      operator bool()
321 321
      {
322
	Opts::iterator i = _parser._opts.find(_name);
323
	LEMON_ASSERT(i!=_parser._opts.end(),
324
		     std::string()+"Unkown option: '"+_name+"'");
325
	LEMON_ASSERT(i->second.type==ArgParser::BOOL,
326
		     std::string()+"'"+_name+"' is a bool option");
327
	return *(i->second.bool_p);
322
        Opts::iterator i = _parser._opts.find(_name);
323
        LEMON_ASSERT(i!=_parser._opts.end(),
324
                     std::string()+"Unkown option: '"+_name+"'");
325
        LEMON_ASSERT(i->second.type==ArgParser::BOOL,
326
                     std::string()+"'"+_name+"' is a bool option");
327
        return *(i->second.bool_p);
328 328
      }
... ...
@@ -331,30 +331,30 @@
331 331
      {
332
	Opts::iterator i = _parser._opts.find(_name);
333
	LEMON_ASSERT(i!=_parser._opts.end(),
334
		     std::string()+"Unkown option: '"+_name+"'");
335
	LEMON_ASSERT(i->second.type==ArgParser::STRING,
336
		     std::string()+"'"+_name+"' is a string option");
337
	return *(i->second.string_p);
332
        Opts::iterator i = _parser._opts.find(_name);
333
        LEMON_ASSERT(i!=_parser._opts.end(),
334
                     std::string()+"Unkown option: '"+_name+"'");
335
        LEMON_ASSERT(i->second.type==ArgParser::STRING,
336
                     std::string()+"'"+_name+"' is a string option");
337
        return *(i->second.string_p);
338 338
      }
339 339
      ///\e
340
      operator double() 
340
      operator double()
341 341
      {
342
	Opts::iterator i = _parser._opts.find(_name);
343
	LEMON_ASSERT(i!=_parser._opts.end(),
344
		     std::string()+"Unkown option: '"+_name+"'");
345
	LEMON_ASSERT(i->second.type==ArgParser::DOUBLE ||
346
		     i->second.type==ArgParser::INTEGER,
347
		     std::string()+"'"+_name+"' is a floating point option");
348
	return i->second.type==ArgParser::DOUBLE ?
349
	  *(i->second.double_p) : *(i->second.int_p);
342
        Opts::iterator i = _parser._opts.find(_name);
343
        LEMON_ASSERT(i!=_parser._opts.end(),
344
                     std::string()+"Unkown option: '"+_name+"'");
345
        LEMON_ASSERT(i->second.type==ArgParser::DOUBLE ||
346
                     i->second.type==ArgParser::INTEGER,
347
                     std::string()+"'"+_name+"' is a floating point option");
348
        return i->second.type==ArgParser::DOUBLE ?
349
          *(i->second.double_p) : *(i->second.int_p);
350 350
      }
351 351
      ///\e
352
      operator int() 
352
      operator int()
353 353
      {
354
	Opts::iterator i = _parser._opts.find(_name);
355
	LEMON_ASSERT(i!=_parser._opts.end(),
356
		     std::string()+"Unkown option: '"+_name+"'");
357
	LEMON_ASSERT(i->second.type==ArgParser::INTEGER,
358
		     std::string()+"'"+_name+"' is an integer option");
359
	return *(i->second.int_p);
354
        Opts::iterator i = _parser._opts.find(_name);
355
        LEMON_ASSERT(i!=_parser._opts.end(),
356
                     std::string()+"Unkown option: '"+_name+"'");
357
        LEMON_ASSERT(i->second.type==ArgParser::INTEGER,
358
                     std::string()+"'"+_name+"' is an integer option");
359
        return *(i->second.int_p);
360 360
      }
... ...
@@ -364,3 +364,3 @@
364 364
    ///Give back the value of an option
365
    
365

	
366 366
    ///Give back the value of an option.
... ...
@@ -370,3 +370,3 @@
370 370
      return RefType(*this, n);
371
    }    
371
    }
372 372

	
... ...
@@ -377,3 +377,3 @@
377 377
    std::vector<std::string> &files() { return _file_args; }
378
 
378

	
379 379
  };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -30,3 +30,3 @@
30 30
  inline void assert_fail_log(const char *file, int line, const char *function,
31
			      const char *message, const char *assertion)
31
                              const char *message, const char *assertion)
32 32
  {
... ...
@@ -42,4 +42,4 @@
42 42
  inline void assert_fail_abort(const char *file, int line,
43
				const char *function, const char* message,
44
				const char *assertion)
43
                                const char *function, const char* message,
44
                                const char *assertion)
45 45
  {
... ...
@@ -50,4 +50,4 @@
50 50
  namespace _assert_bits {
51
    
52
    
51

	
52

	
53 53
    inline const char* cstringify(const std::string& str) {
... ...
@@ -58,3 +58,3 @@
58 58
      return str;
59
    }    
59
    }
60 60
  }
... ...
@@ -68,4 +68,4 @@
68 68

	
69
#if (defined(LEMON_ASSERT_LOG) ? 1 : 0) +		\
70
  (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +		\
69
#if (defined(LEMON_ASSERT_LOG) ? 1 : 0) +                \
70
  (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +                \
71 71
  (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) > 1
... ...
@@ -74,7 +74,7 @@
74 74

	
75
#if ((defined(LEMON_ASSERT_LOG) ? 1 : 0) +		\
76
     (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +		\
77
     (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) == 1 ||	\
78
     defined(LEMON_ENABLE_ASSERTS)) &&			\
79
  (defined(LEMON_DISABLE_ASSERTS) ||			\
75
#if ((defined(LEMON_ASSERT_LOG) ? 1 : 0) +                \
76
     (defined(LEMON_ASSERT_ABORT) ? 1 : 0) +                \
77
     (defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) == 1 ||        \
78
     defined(LEMON_ENABLE_ASSERTS)) &&                        \
79
  (defined(LEMON_DISABLE_ASSERTS) ||                        \
80 80
   defined(NDEBUG))
... ...
@@ -138,3 +138,3 @@
138 138
/// The checking is also disabled when the standard macro \c NDEBUG is defined.
139
/// 
139
///
140 140
/// The LEMON assertion system has a wide range of customization
... ...
@@ -143,3 +143,3 @@
143 143
///
144
/// The following modes can be used in the assertion system: 
144
/// The following modes can be used in the assertion system:
145 145
///
... ...
@@ -157,3 +157,3 @@
157 157
///   The name of the function should be defined as the \c
158
///   LEMON_CUSTOM_ASSERT_HANDLER macro name. 
158
///   LEMON_CUSTOM_ASSERT_HANDLER macro name.
159 159
///   \code
... ...
@@ -168,7 +168,7 @@
168 168
/// behaviour is changed appropiately to the new settings.
169
#  define LEMON_ASSERT(exp, msg)					\
170
  (static_cast<void> (!!(exp) ? 0 : (					\
171
    LEMON_ASSERT_HANDLER(__FILE__, __LINE__,				\
172
			 LEMON_FUNCTION_NAME,				\
173
			 ::lemon::_assert_bits::cstringify(msg), #exp), 0)))
169
#  define LEMON_ASSERT(exp, msg)                                        \
170
  (static_cast<void> (!!(exp) ? 0 : (                                        \
171
    LEMON_ASSERT_HANDLER(__FILE__, __LINE__,                                \
172
                         LEMON_FUNCTION_NAME,                                \
173
                         ::lemon::_assert_bits::cstringify(msg), #exp), 0)))
174 174

	
... ...
@@ -184,7 +184,7 @@
184 184
///
185
/// \see LEMON_ASSERT 
186
#  define LEMON_FIXME(msg)						\
187
  (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,	\
188
			::lemon::_assert_bits::cstringify(msg),		\
189
			static_cast<const char*>(0)))
185
/// \see LEMON_ASSERT
186
#  define LEMON_FIXME(msg)                                                \
187
  (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,        \
188
                        ::lemon::_assert_bits::cstringify(msg),                \
189
                        static_cast<const char*>(0)))
190 190

	
... ...
@@ -212,8 +212,8 @@
212 212
///
213
/// \see LEMON_ASSERT 
214
#  define LEMON_DEBUG(exp, msg)						\
215
  (static_cast<void> (!!(exp) ? 0 : (					\
213
/// \see LEMON_ASSERT
214
#  define LEMON_DEBUG(exp, msg)                                                \
215
  (static_cast<void> (!!(exp) ? 0 : (                                        \
216 216
    LEMON_ASSERT_HANDLER(__FILE__, __LINE__,                            \
217
			 LEMON_FUNCTION_NAME,				\
218
			 ::lemon::_assert_bits::cstringify(msg), #exp), 0)))
217
                         LEMON_FUNCTION_NAME,                                \
218
                         ::lemon::_assert_bits::cstringify(msg), #exp), 0)))
219 219

	
... ...
@@ -226,12 +226,12 @@
226 226
#  else
227
#    define LEMON_ASSERT(exp, msg)					\
228
       (static_cast<void> (!!(exp) ? 0 : (				\
227
#    define LEMON_ASSERT(exp, msg)                                        \
228
       (static_cast<void> (!!(exp) ? 0 : (                                \
229 229
        LEMON_ASSERT_HANDLER(__FILE__, __LINE__,                        \
230
			     LEMON_FUNCTION_NAME,			\
231
			     ::lemon::_assert_bits::cstringify(msg),	\
232
			     #exp), 0)))
233
#    define LEMON_FIXME(msg)						\
234
       (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,	\
235
			     ::lemon::_assert_bits::cstringify(msg),	\
236
			     static_cast<const char*>(0)))
230
                             LEMON_FUNCTION_NAME,                        \
231
                             ::lemon::_assert_bits::cstringify(msg),        \
232
                             #exp), 0)))
233
#    define LEMON_FIXME(msg)                                                \
234
       (LEMON_ASSERT_HANDLER(__FILE__, __LINE__, LEMON_FUNCTION_NAME,        \
235
                             ::lemon::_assert_bits::cstringify(msg),        \
236
                             static_cast<const char*>(0)))
237 237

	
... ...
@@ -242,4 +242,4 @@
242 242
                                LEMON_FUNCTION_NAME, \
243
				::lemon::_assert_bits::cstringify(msg),	\
244
				#exp), 0)))
243
                                ::lemon::_assert_bits::cstringify(msg),        \
244
                                #exp), 0)))
245 245
#    else
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -35,3 +35,3 @@
35 35

	
36
  
36

	
37 37
  ///Default traits class of Bfs class.
... ...
@@ -43,3 +43,3 @@
43 43
  {
44
    ///The digraph type the algorithm runs on. 
44
    ///The digraph type the algorithm runs on.
45 45
    typedef GR Digraph;
... ...
@@ -47,3 +47,3 @@
47 47
    ///arcs of the shortest paths.
48
    /// 
48
    ///
49 49
    ///The type of the map that stores the last
... ...
@@ -54,7 +54,7 @@
54 54
    ///Instantiates a PredMap.
55
 
56
    ///This function instantiates a \ref PredMap. 
55

	
56
    ///This function instantiates a \ref PredMap.
57 57
    ///\param G is the digraph, to which we would like to define the PredMap.
58 58
    ///\todo The digraph alone may be insufficient to initialize
59
    static PredMap *createPredMap(const GR &G) 
59
    static PredMap *createPredMap(const GR &G)
60 60
    {
... ...
@@ -63,3 +63,3 @@
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.
... ...
@@ -69,4 +69,4 @@
69 69
    ///Instantiates a ProcessedMap.
70
 
71
    ///This function instantiates a \ref ProcessedMap. 
70

	
71
    ///This function instantiates a \ref ProcessedMap.
72 72
    ///\param g is the digraph, to which
... ...
@@ -82,3 +82,3 @@
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.
... ...
@@ -88,4 +88,4 @@
88 88
    ///Instantiates a ReachedMap.
89
 
90
    ///This function instantiates a \ref ReachedMap. 
89

	
90
    ///This function instantiates a \ref ReachedMap.
91 91
    ///\param G is the digraph, to which
... ...
@@ -97,3 +97,3 @@
97 97
    ///The type of the map that stores the dists of the nodes.
98
 
98

	
99 99
    ///The type of the map that stores the dists of the nodes.
... ...
@@ -103,4 +103,4 @@
103 103
    ///Instantiates a DistMap.
104
 
105
    ///This function instantiates a \ref DistMap. 
104

	
105
    ///This function instantiates a \ref DistMap.
106 106
    ///\param G is the digraph, to which we would like to define the \ref DistMap
... ...
@@ -111,5 +111,5 @@
111 111
  };
112
  
112

	
113 113
  ///%BFS algorithm class.
114
  
114

	
115 115
  ///\ingroup search
... ...
@@ -128,6 +128,6 @@
128 128
  template <typename GR,
129
	    typename TR>
129
            typename TR>
130 130
#else
131 131
  template <typename GR=ListDigraph,
132
	    typename TR=BfsDefaultTraits<GR> >
132
            typename TR=BfsDefaultTraits<GR> >
133 133
#endif
... ...
@@ -144,3 +144,3 @@
144 144
      virtual const char* what() const throw() {
145
	return "lemon::Bfs::UninitializedParameter";
145
        return "lemon::Bfs::UninitializedParameter";
146 146
      }
... ...
@@ -151,3 +151,3 @@
151 151
    typedef typename TR::Digraph Digraph;
152
    
152

	
153 153
    ///\brief The type of the map that stores the last
... ...
@@ -192,21 +192,21 @@
192 192
    ///Creates the maps if necessary.
193
    
193

	
194 194
    ///\todo Better memory allocation (instead of new).
195
    void create_maps() 
195
    void create_maps()
196 196
    {
197 197
      if(!_pred) {
198
	local_pred = true;
199
	_pred = Traits::createPredMap(*G);
198
        local_pred = true;
199
        _pred = Traits::createPredMap(*G);
200 200
      }
201 201
      if(!_dist) {
202
	local_dist = true;
203
	_dist = Traits::createDistMap(*G);
202
        local_dist = true;
203
        _dist = Traits::createDistMap(*G);
204 204
      }
205 205
      if(!_reached) {
206
	local_reached = true;
207
	_reached = Traits::createReachedMap(*G);
206
        local_reached = true;
207
        _reached = Traits::createReachedMap(*G);
208 208
      }
209 209
      if(!_processed) {
210
	local_processed = true;
211
	_processed = Traits::createProcessedMap(*G);
210
        local_processed = true;
211
        _processed = Traits::createProcessedMap(*G);
212 212
      }
... ...
@@ -215,7 +215,7 @@
215 215
  protected:
216
    
216

	
217 217
    Bfs() {}
218
    
218

	
219 219
  public:
220
 
220

	
221 221
    typedef Bfs Create;
... ...
@@ -229,5 +229,5 @@
229 229
      typedef T PredMap;
230
      static PredMap *createPredMap(const Digraph &) 
230
      static PredMap *createPredMap(const Digraph &)
231 231
      {
232
	throw UninitializedParameter();
232
        throw UninitializedParameter();
233 233
      }
... ...
@@ -240,6 +240,6 @@
240 240
    template <class T>
241
    struct DefPredMap : public Bfs< Digraph, DefPredMapTraits<T> > { 
241
    struct DefPredMap : public Bfs< Digraph, DefPredMapTraits<T> > {
242 242
      typedef Bfs< Digraph, DefPredMapTraits<T> > Create;
243 243
    };
244
    
244

	
245 245
    template <class T>
... ...
@@ -247,5 +247,5 @@
247 247
      typedef T DistMap;
248
      static DistMap *createDistMap(const Digraph &) 
248
      static DistMap *createDistMap(const Digraph &)
249 249
      {
250
	throw UninitializedParameter();
250
        throw UninitializedParameter();
251 251
      }
... ...
@@ -258,6 +258,6 @@
258 258
    template <class T>
259
    struct DefDistMap : public Bfs< Digraph, DefDistMapTraits<T> > { 
259
    struct DefDistMap : public Bfs< Digraph, DefDistMapTraits<T> > {
260 260
      typedef Bfs< Digraph, DefDistMapTraits<T> > Create;
261 261
    };
262
    
262

	
263 263
    template <class T>
... ...
@@ -265,5 +265,5 @@
265 265
      typedef T ReachedMap;
266
      static ReachedMap *createReachedMap(const Digraph &) 
266
      static ReachedMap *createReachedMap(const Digraph &)
267 267
      {
268
	throw UninitializedParameter();
268
        throw UninitializedParameter();
269 269
      }
... ...
@@ -276,6 +276,6 @@
276 276
    template <class T>
277
    struct DefReachedMap : public Bfs< Digraph, DefReachedMapTraits<T> > { 
277
    struct DefReachedMap : public Bfs< Digraph, DefReachedMapTraits<T> > {
278 278
      typedef Bfs< Digraph, DefReachedMapTraits<T> > Create;
279 279
    };
280
    
280

	
281 281
    template <class T>
... ...
@@ -283,5 +283,5 @@
283 283
      typedef T ProcessedMap;
284
      static ProcessedMap *createProcessedMap(const Digraph &) 
284
      static ProcessedMap *createProcessedMap(const Digraph &)
285 285
      {
286
	throw UninitializedParameter();
286
        throw UninitializedParameter();
287 287
      }
... ...
@@ -297,8 +297,8 @@
297 297
    };
298
    
298

	
299 299
    struct DefDigraphProcessedMapTraits : public Traits {
300 300
      typedef typename Digraph::template NodeMap<bool> ProcessedMap;
301
      static ProcessedMap *createProcessedMap(const Digraph &G) 
301
      static ProcessedMap *createProcessedMap(const Digraph &G)
302 302
      {
303
	return new ProcessedMap(G);
303
        return new ProcessedMap(G);
304 304
      }
... ...
@@ -313,12 +313,12 @@
313 313
    struct DefProcessedMapToBeDefaultMap :
314
      public Bfs< Digraph, DefDigraphProcessedMapTraits> { 
314
      public Bfs< Digraph, DefDigraphProcessedMapTraits> {
315 315
      typedef Bfs< Digraph, DefDigraphProcessedMapTraits> Create;
316 316
    };
317
    
317

	
318 318
    ///@}
319 319

	
320
  public:      
321
    
320
  public:
321

	
322 322
    ///Constructor.
323
    
323

	
324 324
    ///\param _G the digraph the algorithm will run on.
... ...
@@ -332,5 +332,5 @@
332 332
    { }
333
    
333

	
334 334
    ///Destructor.
335
    ~Bfs() 
335
    ~Bfs()
336 336
    {
... ...
@@ -349,7 +349,7 @@
349 349
    ///\return <tt> (*this) </tt>
350
    Bfs &predMap(PredMap &m) 
350
    Bfs &predMap(PredMap &m)
351 351
    {
352 352
      if(local_pred) {
353
	delete _pred;
354
	local_pred=false;
353
        delete _pred;
354
        local_pred=false;
355 355
      }
... ...
@@ -366,7 +366,7 @@
366 366
    ///\return <tt> (*this) </tt>
367
    Bfs &reachedMap(ReachedMap &m) 
367
    Bfs &reachedMap(ReachedMap &m)
368 368
    {
369 369
      if(local_reached) {
370
	delete _reached;
371
	local_reached=false;
370
        delete _reached;
371
        local_reached=false;
372 372
      }
... ...
@@ -383,7 +383,7 @@
383 383
    ///\return <tt> (*this) </tt>
384
    Bfs &processedMap(ProcessedMap &m) 
384
    Bfs &processedMap(ProcessedMap &m)
385 385
    {
386 386
      if(local_processed) {
387
	delete _processed;
388
	local_processed=false;
387
        delete _processed;
388
        local_processed=false;
389 389
      }
... ...
@@ -400,7 +400,7 @@
400 400
    ///\return <tt> (*this) </tt>
401
    Bfs &distMap(DistMap &m) 
401
    Bfs &distMap(DistMap &m)
402 402
    {
403 403
      if(local_dist) {
404
	delete _dist;
405
	local_dist=false;
404
        delete _dist;
405
        local_dist=false;
406 406
      }
... ...
@@ -434,8 +434,8 @@
434 434
      for ( NodeIt u(*G) ; u!=INVALID ; ++u ) {
435
	_pred->set(u,INVALID);
436
	_reached->set(u,false);
437
	_processed->set(u,false);
435
        _pred->set(u,INVALID);
436
        _reached->set(u,false);
437
        _processed->set(u,false);
438 438
      }
439 439
    }
440
    
440

	
441 441
    ///Adds a new source node.
... ...
@@ -447,11 +447,11 @@
447 447
      if(!(*_reached)[s])
448
	{
449
	  _reached->set(s,true);
450
	  _pred->set(s,INVALID);
451
	  _dist->set(s,0);
452
	  _queue[_queue_head++]=s;
453
	  _queue_next_dist=_queue_head;
454
	}
448
        {
449
          _reached->set(s,true);
450
          _pred->set(s,INVALID);
451
          _dist->set(s,0);
452
          _queue[_queue_head++]=s;
453
          _queue_next_dist=_queue_head;
454
        }
455 455
    }
456
    
456

	
457 457
    ///Processes the next node.
... ...
@@ -466,4 +466,4 @@
466 466
      if(_queue_tail==_queue_next_dist) {
467
	_curr_dist++;
468
	_queue_next_dist=_queue_head;
467
        _curr_dist++;
468
        _queue_next_dist=_queue_head;
469 469
      }
... ...
@@ -473,8 +473,8 @@
473 473
      for(OutArcIt e(*G,n);e!=INVALID;++e)
474
	if(!(*_reached)[m=G->target(e)]) {
475
	  _queue[_queue_head++]=m;
476
	  _reached->set(m,true);
477
	  _pred->set(m,e);
478
	  _dist->set(m,_curr_dist);
479
	}
474
        if(!(*_reached)[m=G->target(e)]) {
475
          _queue[_queue_head++]=m;
476
          _reached->set(m,true);
477
          _pred->set(m,e);
478
          _dist->set(m,_curr_dist);
479
        }
480 480
      return n;
... ...
@@ -497,4 +497,4 @@
497 497
      if(_queue_tail==_queue_next_dist) {
498
	_curr_dist++;
499
	_queue_next_dist=_queue_head;
498
        _curr_dist++;
499
        _queue_next_dist=_queue_head;
500 500
      }
... ...
@@ -504,9 +504,9 @@
504 504
      for(OutArcIt e(*G,n);e!=INVALID;++e)
505
	if(!(*_reached)[m=G->target(e)]) {
506
	  _queue[_queue_head++]=m;
507
	  _reached->set(m,true);
508
	  _pred->set(m,e);
509
	  _dist->set(m,_curr_dist);
505
        if(!(*_reached)[m=G->target(e)]) {
506
          _queue[_queue_head++]=m;
507
          _reached->set(m,true);
508
          _pred->set(m,e);
509
          _dist->set(m,_curr_dist);
510 510
          reach = reach || (target == m);
511
	}
511
        }
512 512
      return n;
... ...
@@ -530,4 +530,4 @@
530 530
      if(_queue_tail==_queue_next_dist) {
531
	_curr_dist++;
532
	_queue_next_dist=_queue_head;
531
        _curr_dist++;
532
        _queue_next_dist=_queue_head;
533 533
      }
... ...
@@ -537,12 +537,12 @@
537 537
      for(OutArcIt e(*G,n);e!=INVALID;++e)
538
	if(!(*_reached)[m=G->target(e)]) {
539
	  _queue[_queue_head++]=m;
540
	  _reached->set(m,true);
541
	  _pred->set(m,e);
542
	  _dist->set(m,_curr_dist);
543
	  if (nm[m] && rnode == INVALID) rnode = m;
544
	}
538
        if(!(*_reached)[m=G->target(e)]) {
539
          _queue[_queue_head++]=m;
540
          _reached->set(m,true);
541
          _pred->set(m,e);
542
          _dist->set(m,_curr_dist);
543
          if (nm[m] && rnode == INVALID) rnode = m;
544
        }
545 545
      return n;
546 546
    }
547
      
547

	
548 548
    ///Next node to be processed.
... ...
@@ -554,6 +554,6 @@
554 554
    Node nextNode()
555
    { 
555
    {
556 556
      return _queue_tail<_queue_head?_queue[_queue_tail]:INVALID;
557 557
    }
558
 
558

	
559 559
    ///\brief Returns \c false if there are nodes
... ...
@@ -565,6 +565,6 @@
565 565
    ///Returns the number of the nodes to be processed.
566
    
566

	
567 567
    ///Returns the number of the nodes to be processed in the queue.
568 568
    int queueSize() { return _queue_head-_queue_tail; }
569
    
569

	
570 570
    ///Executes the algorithm.
... ...
@@ -586,3 +586,3 @@
586 586
    }
587
    
587

	
588 588
    ///Executes the algorithm until \c dest is reached.
... ...
@@ -604,3 +604,3 @@
604 604
    }
605
    
605

	
606 606
    ///Executes the algorithm until a condition is met.
... ...
@@ -623,3 +623,3 @@
623 623
      while ( !emptyQueue() && rnode == INVALID ) {
624
	processNextNode(nm, rnode);
624
        processNextNode(nm, rnode);
625 625
      }
... ...
@@ -627,5 +627,5 @@
627 627
    }
628
    
628

	
629 629
    ///Runs %BFS algorithm from node \c s.
630
    
630

	
631 631
    ///This method runs the %BFS algorithm from a root node \c s
... ...
@@ -648,5 +648,5 @@
648 648
    }
649
    
649

	
650 650
    ///Finds the shortest path between \c s and \c t.
651
    
651

	
652 652
    ///Finds the shortest path between \c s and \c t.
... ...
@@ -668,3 +668,3 @@
668 668
    }
669
    
669

	
670 670
    ///@}
... ...
@@ -676,3 +676,3 @@
676 676
    ///either run() or start() must be calleb.
677
    
677

	
678 678
    ///@{
... ...
@@ -682,6 +682,6 @@
682 682
    ///Gives back the shortest path.
683
    
683

	
684 684
    ///Gives back the shortest path.
685 685
    ///\pre The \c t should be reachable from the source.
686
    Path path(Node t) 
686
    Path path(Node t)
687 687
    {
... ...
@@ -724,4 +724,4 @@
724 724
    Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
725
				  G->source((*_pred)[v]); }
726
    
725
                                  G->source((*_pred)[v]); }
726

	
727 727
    ///Returns a reference to the NodeMap of distances.
... ...
@@ -732,3 +732,3 @@
732 732
    const DistMap &distMap() const { return *_dist;}
733
 
733

	
734 734
    ///Returns a reference to the shortest path tree map.
... ...
@@ -740,3 +740,3 @@
740 740
    const PredMap &predMap() const { return *_pred;}
741
 
741

	
742 742
    ///Checks if a node is reachable from the root.
... ...
@@ -749,3 +749,3 @@
749 749
    bool reached(Node v) { return (*_reached)[v]; }
750
    
750

	
751 751
    ///@}
... ...
@@ -760,3 +760,3 @@
760 760
  {
761
    ///The digraph type the algorithm runs on. 
761
    ///The digraph type the algorithm runs on.
762 762
    typedef GR Digraph;
... ...
@@ -764,3 +764,3 @@
764 764
    ///arcs of the shortest paths.
765
    /// 
765
    ///
766 766
    ///The type of the map that stores the last
... ...
@@ -771,4 +771,4 @@
771 771
    ///Instantiates a PredMap.
772
 
773
    ///This function instantiates a \ref PredMap. 
772

	
773
    ///This function instantiates a \ref PredMap.
774 774
    ///\param g is the digraph, to which we would like to define the PredMap.
... ...
@@ -776,5 +776,5 @@
776 776
#ifdef DOXYGEN
777
    static PredMap *createPredMap(const GR &g) 
777
    static PredMap *createPredMap(const GR &g)
778 778
#else
779
    static PredMap *createPredMap(const GR &) 
779
    static PredMap *createPredMap(const GR &)
780 780
#endif
... ...
@@ -785,3 +785,3 @@
785 785
    ///The type of the map that indicates which nodes are processed.
786
 
786

	
787 787
    ///The type of the map that indicates which nodes are processed.
... ...
@@ -791,4 +791,4 @@
791 791
    ///Instantiates a ProcessedMap.
792
 
793
    ///This function instantiates a \ref ProcessedMap. 
792

	
793
    ///This function instantiates a \ref ProcessedMap.
794 794
    ///\param g is the digraph, to which
... ...
@@ -804,3 +804,3 @@
804 804
    ///The type of the map that indicates which nodes are reached.
805
 
805

	
806 806
    ///The type of the map that indicates which nodes are reached.
... ...
@@ -810,4 +810,4 @@
810 810
    ///Instantiates a ReachedMap.
811
 
812
    ///This function instantiates a \ref ReachedMap. 
811

	
812
    ///This function instantiates a \ref ReachedMap.
813 813
    ///\param G is the digraph, to which
... ...
@@ -819,3 +819,3 @@
819 819
    ///The type of the map that stores the dists of the nodes.
820
 
820

	
821 821
    ///The type of the map that stores the dists of the nodes.
... ...
@@ -825,4 +825,4 @@
825 825
    ///Instantiates a DistMap.
826
 
827
    ///This function instantiates a \ref DistMap. 
826

	
827
    ///This function instantiates a \ref DistMap.
828 828
    ///\param g is the digraph, to which we would like to define the \ref DistMap
... ...
@@ -837,3 +837,3 @@
837 837
  };
838
  
838

	
839 839
  /// Default traits used by \ref BfsWizard
... ...
@@ -867,6 +867,6 @@
867 867
    Node _source;
868
    
868

	
869 869
    public:
870 870
    /// Constructor.
871
    
871

	
872 872
    /// This constructor does not require parameters, therefore it initiates
... ...
@@ -874,6 +874,6 @@
874 874
    BfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
875
			   _dist(0), _source(INVALID) {}
875
                           _dist(0), _source(INVALID) {}
876 876

	
877 877
    /// Constructor.
878
    
878

	
879 879
    /// This constructor requires some parameters,
... ...
@@ -884,3 +884,3 @@
884 884
    BfsWizardBase(const GR &g, Node s=INVALID) :
885
      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))), 
885
      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
886 886
      _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
... ...
@@ -888,3 +888,3 @@
888 888
  };
889
  
889

	
890 890
  /// A class to make the usage of Bfs algorithm easier
... ...
@@ -923,3 +923,3 @@
923 923
    typedef typename Digraph::OutArcIt OutArcIt;
924
    
924

	
925 925
    ///\brief The type of the map that stores
... ...
@@ -953,3 +953,3 @@
953 953
    ///Runs Bfs algorithm from a given node.
954
    
954

	
955 955
    ///Runs Bfs algorithm from a given node.
... ...
@@ -961,8 +961,8 @@
961 961
      if(Base::_reached)
962
	alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
963
      if(Base::_processed) 
962
        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
963
      if(Base::_processed)
964 964
        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
965
      if(Base::_pred) 
965
      if(Base::_pred)
966 966
        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
967
      if(Base::_dist) 
967
      if(Base::_dist)
968 968
        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
... ...
@@ -987,3 +987,3 @@
987 987
    };
988
    
988

	
989 989
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -995,3 +995,3 @@
995 995
    template<class T>
996
    BfsWizard<DefPredMapBase<T> > predMap(const T &t) 
996
    BfsWizard<DefPredMapBase<T> > predMap(const T &t)
997 997
    {
... ...
@@ -1000,4 +1000,4 @@
1000 1000
    }
1001
    
1002
 
1001

	
1002

	
1003 1003
    template<class T>
... ...
@@ -1008,3 +1008,3 @@
1008 1008
    };
1009
    
1009

	
1010 1010
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1016,3 +1016,3 @@
1016 1016
    template<class T>
1017
    BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t) 
1017
    BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
1018 1018
    {
... ...
@@ -1021,3 +1021,3 @@
1021 1021
    }
1022
    
1022

	
1023 1023

	
... ...
@@ -1029,3 +1029,3 @@
1029 1029
    };
1030
    
1030

	
1031 1031
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1037,3 +1037,3 @@
1037 1037
    template<class T>
1038
    BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t) 
1038
    BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
1039 1039
    {
... ...
@@ -1042,4 +1042,4 @@
1042 1042
    }
1043
    
1044
   
1043

	
1044

	
1045 1045
    template<class T>
... ...
@@ -1050,3 +1050,3 @@
1050 1050
    };
1051
    
1051

	
1052 1052
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1058,3 +1058,3 @@
1058 1058
    template<class T>
1059
    BfsWizard<DefDistMapBase<T> > distMap(const T &t) 
1059
    BfsWizard<DefDistMapBase<T> > distMap(const T &t)
1060 1060
    {
... ...
@@ -1063,3 +1063,3 @@
1063 1063
    }
1064
    
1064

	
1065 1065
    /// Sets the source node, from which the Bfs algorithm runs.
... ...
@@ -1068,3 +1068,3 @@
1068 1068
    /// \param s is the source node.
1069
    BfsWizard<TR> &source(Node s) 
1069
    BfsWizard<TR> &source(Node s)
1070 1070
    {
... ...
@@ -1073,5 +1073,5 @@
1073 1073
    }
1074
    
1074

	
1075 1075
  };
1076
  
1076

	
1077 1077
  ///Function type interface for Bfs algorithm.
... ...
@@ -1102,3 +1102,3 @@
1102 1102
  /// \brief Visitor class for bfs.
1103
  ///  
1103
  ///
1104 1104
  /// This class defines the interface of the BfsVisit events, and
... ...
@@ -1111,3 +1111,3 @@
1111 1111
    /// \brief Called when the arc reach a node.
1112
    /// 
1112
    ///
1113 1113
    /// It is called when the bfs find an arc which target is not
... ...
@@ -1116,9 +1116,9 @@
1116 1116
    /// \brief Called when the node reached first time.
1117
    /// 
1117
    ///
1118 1118
    /// It is Called when the node reached first time.
1119 1119
    void reach(const Node& node) {}
1120
    /// \brief Called when the arc examined but target of the arc 
1120
    /// \brief Called when the arc examined but target of the arc
1121 1121
    /// already discovered.
1122
    /// 
1123
    /// It called when the arc examined but the target of the arc 
1122
    ///
1123
    /// It called when the arc examined but the target of the arc
1124 1124
    /// already discovered.
... ...
@@ -1126,3 +1126,3 @@
1126 1126
    /// \brief Called for the source node of the bfs.
1127
    /// 
1127
    ///
1128 1128
    /// It is called for the source node of the bfs.
... ...
@@ -1130,3 +1130,3 @@
1130 1130
    /// \brief Called when the node processed.
1131
    /// 
1131
    ///
1132 1132
    /// It is Called when the node processed.
... ...
@@ -1149,8 +1149,8 @@
1149 1149
      void constraints() {
1150
	Arc arc;
1151
	Node node;
1152
	visitor.discover(arc);
1153
	visitor.reach(node);
1154
	visitor.examine(arc);
1155
	visitor.start(node);
1150
        Arc arc;
1151
        Node node;
1152
        visitor.discover(arc);
1153
        visitor.reach(node);
1154
        visitor.examine(arc);
1155
        visitor.start(node);
1156 1156
        visitor.process(node);
... ...
@@ -1169,3 +1169,3 @@
1169 1169

	
1170
    /// \brief The digraph type the algorithm runs on. 
1170
    /// \brief The digraph type the algorithm runs on.
1171 1171
    typedef _Digraph Digraph;
... ...
@@ -1173,3 +1173,3 @@
1173 1173
    /// \brief The type of the map that indicates which nodes are reached.
1174
    /// 
1174
    ///
1175 1175
    /// The type of the map that indicates which nodes are reached.
... ...
@@ -1181,3 +1181,3 @@
1181 1181
    ///
1182
    /// This function instantiates a \ref ReachedMap. 
1182
    /// This function instantiates a \ref ReachedMap.
1183 1183
    /// \param digraph is the digraph, to which
... ...
@@ -1191,5 +1191,5 @@
1191 1191
  /// \ingroup search
1192
  ///  
1192
  ///
1193 1193
  /// \brief %BFS Visit algorithm class.
1194
  ///  
1194
  ///
1195 1195
  /// This class provides an efficient implementation of the %BFS algorithm
... ...
@@ -1199,3 +1199,3 @@
1199 1199
  /// class. It works with callback mechanism, the BfsVisit object calls
1200
  /// on every bfs event the \c Visitor class member functions. 
1200
  /// on every bfs event the \c Visitor class member functions.
1201 1201
  ///
... ...
@@ -1204,3 +1204,3 @@
1204 1204
  /// is only passed to \ref BfsDefaultTraits.
1205
  /// \tparam _Visitor The Visitor object for the algorithm. The 
1205
  /// \tparam _Visitor The Visitor object for the algorithm. The
1206 1206
  /// \ref BfsVisitor "BfsVisitor<_Digraph>" is an empty Visitor which
... ...
@@ -1208,3 +1208,3 @@
1208 1208
  /// events you should implement your own Visitor class.
1209
  /// \tparam _Traits Traits class to set various data types used by the 
1209
  /// \tparam _Traits Traits class to set various data types used by the
1210 1210
  /// algorithm. The default traits class is
... ...
@@ -1217,4 +1217,4 @@
1217 1217
  template <typename _Digraph = ListDigraph,
1218
	    typename _Visitor = BfsVisitor<_Digraph>,
1219
	    typename _Traits = BfsDefaultTraits<_Digraph> >
1218
            typename _Visitor = BfsVisitor<_Digraph>,
1219
            typename _Traits = BfsDefaultTraits<_Digraph> >
1220 1220
#endif
... ...
@@ -1222,3 +1222,3 @@
1222 1222
  public:
1223
    
1223

	
1224 1224
    /// \brief \ref Exception for uninitialized parameters.
... ...
@@ -1229,5 +1229,5 @@
1229 1229
    public:
1230
      virtual const char* what() const throw() 
1230
      virtual const char* what() const throw()
1231 1231
      {
1232
	return "lemon::BfsVisit::UninitializedParameter";
1232
        return "lemon::BfsVisit::UninitializedParameter";
1233 1233
      }
... ...
@@ -1268,4 +1268,4 @@
1268 1268
      if(!_reached) {
1269
	local_reached = true;
1270
	_reached = Traits::createReachedMap(*_digraph);
1269
        local_reached = true;
1270
        _reached = Traits::createReachedMap(*_digraph);
1271 1271
      }
... ...
@@ -1276,3 +1276,3 @@
1276 1276
    BfsVisit() {}
1277
    
1277

	
1278 1278
  public:
... ...
@@ -1288,6 +1288,6 @@
1288 1288
      static ReachedMap *createReachedMap(const Digraph &digraph) {
1289
	throw UninitializedParameter();
1289
        throw UninitializedParameter();
1290 1290
      }
1291 1291
    };
1292
    /// \brief \ref named-templ-param "Named parameter" for setting 
1292
    /// \brief \ref named-templ-param "Named parameter" for setting
1293 1293
    /// ReachedMap type
... ...
@@ -1297,3 +1297,3 @@
1297 1297
    struct DefReachedMap : public BfsVisit< Digraph, Visitor,
1298
					    DefReachedMapTraits<T> > {
1298
                                            DefReachedMapTraits<T> > {
1299 1299
      typedef BfsVisit< Digraph, Visitor, DefReachedMapTraits<T> > Create;
... ...
@@ -1302,4 +1302,4 @@
1302 1302

	
1303
  public:      
1304
    
1303
  public:
1304

	
1305 1305
    /// \brief Constructor.
... ...
@@ -1311,6 +1311,6 @@
1311 1311
    ///
1312
    BfsVisit(const Digraph& digraph, Visitor& visitor) 
1312
    BfsVisit(const Digraph& digraph, Visitor& visitor)
1313 1313
      : _digraph(&digraph), _visitor(&visitor),
1314
	_reached(0), local_reached(false) {}
1315
    
1314
        _reached(0), local_reached(false) {}
1315

	
1316 1316
    /// \brief Destructor.
... ...
@@ -1331,4 +1331,4 @@
1331 1331
      if(local_reached) {
1332
	delete _reached;
1333
	local_reached = false;
1332
        delete _reached;
1333
        local_reached = false;
1334 1334
      }
... ...
@@ -1359,6 +1359,6 @@
1359 1359
      for (NodeIt u(*_digraph) ; u != INVALID ; ++u) {
1360
	_reached->set(u, false);
1360
        _reached->set(u, false);
1361 1361
      }
1362 1362
    }
1363
    
1363

	
1364 1364
    /// \brief Adds a new source node.
... ...
@@ -1368,9 +1368,9 @@
1368 1368
      if(!(*_reached)[s]) {
1369
	  _reached->set(s,true);
1370
	  _visitor->start(s);
1371
	  _visitor->reach(s);
1369
          _reached->set(s,true);
1370
          _visitor->start(s);
1371
          _visitor->reach(s);
1372 1372
          _list[++_list_back] = s;
1373
	}
1373
        }
1374 1374
    }
1375
    
1375

	
1376 1376
    /// \brief Processes the next node.
... ...
@@ -1382,3 +1382,3 @@
1382 1382
    /// \pre The queue must not be empty!
1383
    Node processNextNode() { 
1383
    Node processNextNode() {
1384 1384
      Node n = _list[++_list_front];
... ...
@@ -1469,3 +1469,3 @@
1469 1469
    /// empty.
1470
    Node nextNode() { 
1470
    Node nextNode() {
1471 1471
      return _list_front != _list_back ? _list[_list_front + 1] : INVALID;
... ...
@@ -1484,3 +1484,3 @@
1484 1484
    int queueSize() { return _list_back - _list_front; }
1485
    
1485

	
1486 1486
    /// \brief Executes the algorithm.
... ...
@@ -1494,3 +1494,3 @@
1494 1494
    }
1495
    
1495

	
1496 1496
    /// \brief Executes the algorithm until \c dest is reached.
... ...
@@ -1505,3 +1505,3 @@
1505 1505
    }
1506
    
1506

	
1507 1507
    /// \brief Executes the algorithm until a condition is met.
... ...
@@ -1523,3 +1523,3 @@
1523 1523
      while ( !emptyQueue() && rnode == INVALID ) {
1524
	processNextNode(nm, rnode);
1524
        processNextNode(nm, rnode);
1525 1525
      }
... ...
@@ -1544,3 +1544,3 @@
1544 1544
    /// \brief Runs %BFSVisit algorithm to visit all nodes in the digraph.
1545
    ///    
1545
    ///
1546 1546
    /// This method runs the %BFS algorithm in order to
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -50,3 +50,3 @@
50 50
  template <typename _Prio, typename _ItemIntMap,
51
	    typename _Compare = std::less<_Prio> >
51
            typename _Compare = std::less<_Prio> >
52 52
  class BinHeap {
... ...
@@ -92,3 +92,3 @@
92 92
    explicit BinHeap(ItemIntMap &_iim) : iim(_iim) {}
93
    
93

	
94 94
    /// \brief The constructor.
... ...
@@ -101,3 +101,3 @@
101 101
    /// \param _comp The comparator function object.
102
    BinHeap(ItemIntMap &_iim, const Compare &_comp) 
102
    BinHeap(ItemIntMap &_iim, const Compare &_comp)
103 103
      : iim(_iim), comp(_comp) {}
... ...
@@ -109,3 +109,3 @@
109 109
    int size() const { return data.size(); }
110
    
110

	
111 111
    /// \brief Checks if the heap stores no items.
... ...
@@ -116,3 +116,3 @@
116 116
    /// \brief Make empty this heap.
117
    /// 
117
    ///
118 118
    /// Make empty this heap. It does not change the cross reference map.
... ...
@@ -121,4 +121,4 @@
121 121
    /// each item to \c PRE_HEAP.
122
    void clear() { 
123
      data.clear(); 
122
    void clear() {
123
      data.clear();
124 124
    }
... ...
@@ -136,5 +136,5 @@
136 136
      while( hole>0 && less(p,data[par]) ) {
137
	move(data[par],hole);
138
	hole = par;
139
	par = parent(hole);
137
        move(data[par],hole);
138
        hole = par;
139
        par = parent(hole);
140 140
      }
... ...
@@ -147,10 +147,10 @@
147 147
      while(child < length) {
148
	if( less(data[child-1], data[child]) ) {
149
	  --child;
150
	}
151
	if( !less(data[child], p) )
152
	  goto ok;
153
	move(data[child], hole);
154
	hole = child;
155
	child = second_child(hole);
148
        if( less(data[child-1], data[child]) ) {
149
          --child;
150
        }
151
        if( !less(data[child], p) )
152
          goto ok;
153
        move(data[child], hole);
154
        hole = child;
155
        child = second_child(hole);
156 156
      }
... ...
@@ -158,4 +158,4 @@
158 158
      if( child<length && less(data[child], p) ) {
159
	move(data[child], hole);
160
	hole=child;
159
        move(data[child], hole);
160
        hole=child;
161 161
      }
... ...
@@ -183,4 +183,4 @@
183 183
    /// \brief Insert an item into the heap with the given heap.
184
    ///    
185
    /// Adds \c i to the heap with priority \c p. 
184
    ///
185
    /// Adds \c i to the heap with priority \c p.
186 186
    /// \param i The item to insert.
... ...
@@ -192,4 +192,4 @@
192 192
    /// This method returns the item with minimum priority relative to \c
193
    /// Compare.  
194
    /// \pre The heap must be nonempty.  
193
    /// Compare.
194
    /// \pre The heap must be nonempty.
195 195
    Item top() const {
... ...
@@ -209,4 +209,4 @@
209 209
    /// This method deletes the item with minimum priority relative to \c
210
    /// Compare from the heap.  
211
    /// \pre The heap must be non-empty.  
210
    /// Compare from the heap.
211
    /// \pre The heap must be non-empty.
212 212
    void pop() {
... ...
@@ -215,3 +215,3 @@
215 215
      if (n > 0) {
216
	bubble_down(0, data[n], n);
216
        bubble_down(0, data[n], n);
217 217
      }
... ...
@@ -230,5 +230,5 @@
230 230
      if( h < n ) {
231
	if ( bubble_up(h, data[n]) == h) {
232
	  bubble_down(h, data[n], n);
233
	}
231
        if ( bubble_up(h, data[n]) == h) {
232
          bubble_down(h, data[n], n);
233
        }
234 234
      }
... ...
@@ -237,6 +237,6 @@
237 237

	
238
    
238

	
239 239
    /// \brief Returns the priority of \c i.
240 240
    ///
241
    /// This function returns the priority of item \c i.  
241
    /// This function returns the priority of item \c i.
242 242
    /// \pre \c i must be in the heap.
... ...
@@ -248,3 +248,3 @@
248 248

	
249
    /// \brief \c i gets to the heap with priority \c p independently 
249
    /// \brief \c i gets to the heap with priority \c p independently
250 250
    /// if \c i was already there.
... ...
@@ -258,9 +258,9 @@
258 258
      if( idx < 0 ) {
259
	push(i,p);
259
        push(i,p);
260 260
      }
261 261
      else if( comp(p, data[idx].second) ) {
262
	bubble_up(idx, Pair(i,p));
262
        bubble_up(idx, Pair(i,p));
263 263
      }
264 264
      else {
265
	bubble_down(idx, Pair(i,p), data.size());
265
        bubble_down(idx, Pair(i,p), data.size());
266 266
      }
... ...
@@ -279,6 +279,6 @@
279 279
    }
280
    
280

	
281 281
    /// \brief Increases the priority of \c i to \c p.
282 282
    ///
283
    /// This method sets the priority of item \c i to \c p. 
283
    /// This method sets the priority of item \c i to \c p.
284 284
    /// \pre \c i must be stored in the heap with priority at most \c
... ...
@@ -292,3 +292,3 @@
292 292

	
293
    /// \brief Returns if \c item is in, has already been in, or has 
293
    /// \brief Returns if \c item is in, has already been in, or has
294 294
    /// never been in the heap.
... ...
@@ -303,3 +303,3 @@
303 303
      if( s>=0 )
304
	s=0;
304
        s=0;
305 305
      return State(s);
... ...
@@ -313,3 +313,3 @@
313 313
    /// \param i The item.
314
    /// \param st The state. It should not be \c IN_HEAP. 
314
    /// \param st The state. It should not be \c IN_HEAP.
315 315
    void state(const Item& i, State st) {
... ...
@@ -342,3 +342,3 @@
342 342
  }; // class BinHeap
343
  
343

	
344 344
} // namespace lemon
Ignore white space 2 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -34,3 +34,3 @@
34 34
  ///
35
  /// \brief Notifier class to notify observes about alterations in 
35
  /// \brief Notifier class to notify observes about alterations in
36 36
  /// a container.
... ...
@@ -51,3 +51,3 @@
51 51
  ///
52
  /// This class provides an interface to the container. The \e first() and \e 
52
  /// This class provides an interface to the container. The \e first() and \e
53 53
  /// next() member functions make possible to iterate on the keys of the
... ...
@@ -62,3 +62,3 @@
62 62
  /// graph a new graph is builded then it can be signaled with the
63
  /// clear() and build() members. Important rule that if we erase items 
63
  /// clear() and build() members. Important rule that if we erase items
64 64
  /// from graph we should first signal the alteration and after that erase
... ...
@@ -70,3 +70,3 @@
70 70
  /// overriding the virtual functions defined in the base class.  The
71
  /// observer base can be attached to the notifier with the 
71
  /// observer base can be attached to the notifier with the
72 72
  /// \e attach() member and can be detached with detach() function. The
... ...
@@ -81,3 +81,3 @@
81 81
  /// functions. Thence the \e erase() and \e clear() should not throw
82
  /// exception. Actullay, it can be throw only 
82
  /// exception. Actullay, it can be throw only
83 83
  /// \ref AlterationObserver::ImmediateDetach ImmediateDetach
... ...
@@ -87,3 +87,3 @@
87 87
  /// reliable. If we want to carry out the node degree in the graph
88
  /// as in the \ref InDegMap and we use the reverseEdge that cause 
88
  /// as in the \ref InDegMap and we use the reverseEdge that cause
89 89
  /// unreliable functionality. Because the alteration observing signals
... ...
@@ -106,3 +106,3 @@
106 106

	
107
    /// \brief Exception which can be called from \e clear() and 
107
    /// \brief Exception which can be called from \e clear() and
108 108
    /// \e erase().
... ...
@@ -129,3 +129,3 @@
129 129
    /// about the container is built from an empty container or
130
    /// is cleared to an empty container. 
130
    /// is cleared to an empty container.
131 131

	
... ...
@@ -140,3 +140,3 @@
140 140
      /// Default constructor for ObserverBase.
141
      /// 
141
      ///
142 142
      ObserverBase() : _notifier(0) {}
... ...
@@ -153,9 +153,9 @@
153 153
      /// Constructor which attach the obserever to the same notifier as
154
      /// the other observer is attached to. 
154
      /// the other observer is attached to.
155 155
      ObserverBase(const ObserverBase& copy) {
156
	if (copy.attached()) {
156
        if (copy.attached()) {
157 157
          attach(*copy.notifier());
158
	}
158
        }
159 159
      }
160
	
160

	
161 161
      /// \brief Destructor
... ...
@@ -172,5 +172,5 @@
172 172
      void attach(AlterationNotifier& nf) {
173
	nf.attach(*this);
173
        nf.attach(*this);
174 174
      }
175
      
175

	
176 176
      /// \brief Detaches the observer into an AlterationNotifier.
... ...
@@ -182,4 +182,4 @@
182 182
      }
183
      
184
      /// \brief Gives back a pointer to the notifier which the map 
183

	
184
      /// \brief Gives back a pointer to the notifier which the map
185 185
      /// attached into.
... ...
@@ -190,3 +190,3 @@
190 190
      Notifier* notifier() const { return const_cast<Notifier*>(_notifier); }
191
      
191

	
192 192
      /// Gives back true when the observer is attached into a notifier.
... ...
@@ -199,3 +199,3 @@
199 199
    protected:
200
      
200

	
201 201
      Notifier* _notifier;
... ...
@@ -211,3 +211,3 @@
211 211

	
212
      /// \brief The member function to notificate the observer about 
212
      /// \brief The member function to notificate the observer about
213 213
      /// more item is added to the container.
... ...
@@ -224,6 +224,6 @@
224 224
      /// item is erased from the container. It have to be overrided in
225
      /// the subclasses.	
225
      /// the subclasses.
226 226
      virtual void erase(const Item&) = 0;
227 227

	
228
      /// \brief The member function to notificate the observer about 
228
      /// \brief The member function to notificate the observer about
229 229
      /// more item is erased from the container.
... ...
@@ -249,3 +249,3 @@
249 249
      /// items are erased from the container. It have to be overrided in
250
      /// the subclasses.      
250
      /// the subclasses.
251 251
      virtual void clear() = 0;
... ...
@@ -253,3 +253,3 @@
253 253
    };
254
	
254

	
255 255
  protected:
... ...
@@ -258,6 +258,6 @@
258 258

	
259
    typedef std::list<ObserverBase*> Observers; 
259
    typedef std::list<ObserverBase*> Observers;
260 260
    Observers _observers;
261 261

	
262
		
262

	
263 263
  public:
... ...
@@ -266,5 +266,5 @@
266 266
    ///
267
    /// The default constructor of the AlterationNotifier. 
267
    /// The default constructor of the AlterationNotifier.
268 268
    /// It creates an empty notifier.
269
    AlterationNotifier() 
269
    AlterationNotifier()
270 270
      : container(0) {}
... ...
@@ -274,11 +274,11 @@
274 274
    /// Constructor with the observed container parameter.
275
    AlterationNotifier(const Container& _container) 
275
    AlterationNotifier(const Container& _container)
276 276
      : container(&_container) {}
277 277

	
278
    /// \brief Copy Constructor of the AlterationNotifier. 
278
    /// \brief Copy Constructor of the AlterationNotifier.
279 279
    ///
280
    /// Copy constructor of the AlterationNotifier. 
280
    /// Copy constructor of the AlterationNotifier.
281 281
    /// It creates only an empty notifier because the copiable
282 282
    /// notifier's observers have to be registered still into that notifier.
283
    AlterationNotifier(const AlterationNotifier& _notifier) 
283
    AlterationNotifier(const AlterationNotifier& _notifier)
284 284
      : container(_notifier.container) {}
... ...
@@ -286,3 +286,3 @@
286 286
    /// \brief Destructor.
287
    ///		
287
    ///
288 288
    /// Destructor of the AlterationNotifier.
... ...
@@ -292,3 +292,3 @@
292 292
      for (it = _observers.begin(); it != _observers.end(); ++it) {
293
	(*it)->_notifier = 0;
293
        (*it)->_notifier = 0;
294 294
      }
... ...
@@ -340,3 +340,3 @@
340 340
    }
341
		
341

	
342 342
  protected:
... ...
@@ -346,3 +346,3 @@
346 346
      observer._notifier = this;
347
    } 
347
    }
348 348

	
... ...
@@ -355,9 +355,9 @@
355 355
  public:
356
	
357
    /// \brief Notifies all the registed observers about an item added to 
356

	
357
    /// \brief Notifies all the registed observers about an item added to
358 358
    /// the container.
359 359
    ///
360
    /// It notifies all the registed observers about an item added to 
360
    /// It notifies all the registed observers about an item added to
361 361
    /// the container.
362
    /// 
362
    ///
363 363
    void add(const Item& item) {
... ...
@@ -375,10 +375,10 @@
375 375
      }
376
    }	
376
    }
377 377

	
378
    /// \brief Notifies all the registed observers about more item added to 
378
    /// \brief Notifies all the registed observers about more item added to
379 379
    /// the container.
380 380
    ///
381
    /// It notifies all the registed observers about more item added to 
381
    /// It notifies all the registed observers about more item added to
382 382
    /// the container.
383
    /// 
383
    ///
384 384
    void add(const std::vector<Item>& items) {
... ...
@@ -396,10 +396,10 @@
396 396
      }
397
    }	
397
    }
398 398

	
399
    /// \brief Notifies all the registed observers about an item erased from 
399
    /// \brief Notifies all the registed observers about an item erased from
400 400
    /// the container.
401
    ///	
402
    /// It notifies all the registed observers about an item erased from 
401
    ///
402
    /// It notifies all the registed observers about an item erased from
403 403
    /// the container.
404
    /// 
404
    ///
405 405
    void erase(const Item& item) throw() {
... ...
@@ -418,8 +418,8 @@
418 418

	
419
    /// \brief Notifies all the registed observers about more item erased  
419
    /// \brief Notifies all the registed observers about more item erased
420 420
    /// from the container.
421
    ///	
422
    /// It notifies all the registed observers about more item erased from 
421
    ///
422
    /// It notifies all the registed observers about more item erased from
423 423
    /// the container.
424
    /// 
424
    ///
425 425
    void erase(const std::vector<Item>& items) {
... ...
@@ -438,5 +438,5 @@
438 438

	
439
    /// \brief Notifies all the registed observers about the container is 
439
    /// \brief Notifies all the registed observers about the container is
440 440
    /// built.
441
    ///		
441
    ///
442 442
    /// Notifies all the registed observers about the container is built
... ...
@@ -458,3 +458,3 @@
458 458

	
459
    /// \brief Notifies all the registed observers about all items are 
459
    /// \brief Notifies all the registed observers about all items are
460 460
    /// erased.
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -40,3 +40,3 @@
40 40
  /// automatically updates the map when a key is added to or erased from
41
  /// the map. This map uses the allocators to implement 
41
  /// the map. This map uses the allocators to implement
42 42
  /// the container functionality.
... ...
@@ -46,6 +46,6 @@
46 46
  template <typename _Graph, typename _Item, typename _Value>
47
  class ArrayMap 
47
  class ArrayMap
48 48
    : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
49 49
  public:
50
    /// The graph type of the maps. 
50
    /// The graph type of the maps.
51 51
    typedef _Graph Graph;
... ...
@@ -71,3 +71,3 @@
71 71
    typedef typename Notifier::ObserverBase Parent;
72
		
72

	
73 73
  private:
... ...
@@ -86,10 +86,10 @@
86 86
      for (nf->first(it); it != INVALID; nf->next(it)) {
87
	int id = nf->id(it);;
88
	allocator.construct(&(values[id]), Value());
89
      }								
87
        int id = nf->id(it);;
88
        allocator.construct(&(values[id]), Value());
89
      }
90 90
    }
91 91

	
92
    /// \brief Constructor to use default value to initialize the map. 
92
    /// \brief Constructor to use default value to initialize the map.
93 93
    ///
94
    /// It constructs a map and initialize all of the the map. 
94
    /// It constructs a map and initialize all of the the map.
95 95
    ArrayMap(const Graph& graph, const Value& value) {
... ...
@@ -100,5 +100,5 @@
100 100
      for (nf->first(it); it != INVALID; nf->next(it)) {
101
	int id = nf->id(it);;
102
	allocator.construct(&(values[id]), value);
103
      }								
101
        int id = nf->id(it);;
102
        allocator.construct(&(values[id]), value);
103
      }
104 104
    }
... ...
@@ -107,6 +107,6 @@
107 107
    ///
108
    /// Constructor to copy a map of the same map type.     
108
    /// Constructor to copy a map of the same map type.
109 109
    ArrayMap(const ArrayMap& copy) : Parent() {
110 110
      if (copy.attached()) {
111
	attach(*copy.notifier());
111
        attach(*copy.notifier());
112 112
      }
... ...
@@ -118,4 +118,4 @@
118 118
      for (nf->first(it); it != INVALID; nf->next(it)) {
119
	int id = nf->id(it);;
120
	allocator.construct(&(values[id]), copy.values[id]);
119
        int id = nf->id(it);;
120
        allocator.construct(&(values[id]), copy.values[id]);
121 121
      }
... ...
@@ -126,6 +126,6 @@
126 126
    /// This operator assigns for each item in the map the
127
    /// value mapped to the same item in the copied map.  
127
    /// value mapped to the same item in the copied map.
128 128
    /// The parameter map should be indiced with the same
129 129
    /// itemset because this assign operator does not change
130
    /// the container of the map. 
130
    /// the container of the map.
131 131
    ArrayMap& operator=(const ArrayMap& cmap) {
... ...
@@ -140,3 +140,3 @@
140 140
    /// the NodeMap. In this case the value for each item
141
    /// is assigned by the value of the given ReadMap. 
141
    /// is assigned by the value of the given ReadMap.
142 142
    template <typename CMap>
... ...
@@ -153,11 +153,11 @@
153 153
    /// \brief The destructor of the map.
154
    ///     
154
    ///
155 155
    /// The destructor of the map.
156
    virtual ~ArrayMap() {      
156
    virtual ~ArrayMap() {
157 157
      if (attached()) {
158
	clear();
159
	detach();
158
        clear();
159
        detach();
160 160
      }
161 161
    }
162
		
162

	
163 163
  protected:
... ...
@@ -170,6 +170,6 @@
170 170

	
171
    /// \brief The subscript operator. 
171
    /// \brief The subscript operator.
172 172
    ///
173 173
    /// The subscript operator. The map can be subscripted by the
174
    /// actual keys of the graph. 
174
    /// actual keys of the graph.
175 175
    Value& operator[](const Key& key) {
... ...
@@ -177,4 +177,4 @@
177 177
      return values[id];
178
    } 
179
		
178
    }
179

	
180 180
    /// \brief The const subscript operator.
... ...
@@ -182,3 +182,3 @@
182 182
    /// The const subscript operator. The map can be subscripted by the
183
    /// actual keys of the graph. 
183
    /// actual keys of the graph.
184 184
    const Value& operator[](const Key& key) const {
... ...
@@ -189,3 +189,3 @@
189 189
    /// \brief Setter function of the map.
190
    ///	
190
    ///
191 191
    /// Setter function of the map. Equivalent with map[key] = val.
... ...
@@ -199,5 +199,5 @@
199 199
    /// \brief Adds a new key to the map.
200
    ///		
200
    ///
201 201
    /// It adds a new key to the map. It called by the observer notifier
202
    /// and it overrides the add() member function of the observer base.     
202
    /// and it overrides the add() member function of the observer base.
203 203
    virtual void add(const Key& key) {
... ...
@@ -206,18 +206,18 @@
206 206
      if (id >= capacity) {
207
	int new_capacity = (capacity == 0 ? 1 : capacity);
208
	while (new_capacity <= id) {
209
	  new_capacity <<= 1;
210
	}
211
	Value* new_values = allocator.allocate(new_capacity);
212
	Item it;
213
	for (nf->first(it); it != INVALID; nf->next(it)) {
214
	  int jd = nf->id(it);;
215
	  if (id != jd) {
216
	    allocator.construct(&(new_values[jd]), values[jd]);
217
	    allocator.destroy(&(values[jd]));
218
	  }
219
	}
220
	if (capacity != 0) allocator.deallocate(values, capacity);
221
	values = new_values;
222
	capacity = new_capacity;
207
        int new_capacity = (capacity == 0 ? 1 : capacity);
208
        while (new_capacity <= id) {
209
          new_capacity <<= 1;
210
        }
211
        Value* new_values = allocator.allocate(new_capacity);
212
        Item it;
213
        for (nf->first(it); it != INVALID; nf->next(it)) {
214
          int jd = nf->id(it);;
215
          if (id != jd) {
216
            allocator.construct(&(new_values[jd]), values[jd]);
217
            allocator.destroy(&(values[jd]));
218
          }
219
        }
220
        if (capacity != 0) allocator.deallocate(values, capacity);
221
        values = new_values;
222
        capacity = new_capacity;
223 223
      }
... ...
@@ -227,5 +227,5 @@
227 227
    /// \brief Adds more new keys to the map.
228
    ///		
228
    ///
229 229
    /// It adds more new keys to the map. It called by the observer notifier
230
    /// and it overrides the add() member function of the observer base.     
230
    /// and it overrides the add() member function of the observer base.
231 231
    virtual void add(const std::vector<Key>& keys) {
... ...
@@ -234,38 +234,38 @@
234 234
      for (int i = 0; i < int(keys.size()); ++i) {
235
	int id = nf->id(keys[i]);
236
	if (id > max_id) {
237
	  max_id = id;
238
	}
235
        int id = nf->id(keys[i]);
236
        if (id > max_id) {
237
          max_id = id;
238
        }
239 239
      }
240 240
      if (max_id >= capacity) {
241
	int new_capacity = (capacity == 0 ? 1 : capacity);
242
	while (new_capacity <= max_id) {
243
	  new_capacity <<= 1;
244
	}
245
	Value* new_values = allocator.allocate(new_capacity);
246
	Item it;
247
	for (nf->first(it); it != INVALID; nf->next(it)) {
248
	  int id = nf->id(it);
249
	  bool found = false;
250
	  for (int i = 0; i < int(keys.size()); ++i) {
251
	    int jd = nf->id(keys[i]);
252
	    if (id == jd) {
253
	      found = true;
254
	      break;
255
	    }
256
	  }
257
	  if (found) continue;
258
	  allocator.construct(&(new_values[id]), values[id]);
259
	  allocator.destroy(&(values[id]));
260
	}
261
	if (capacity != 0) allocator.deallocate(values, capacity);
262
	values = new_values;
263
	capacity = new_capacity;
241
        int new_capacity = (capacity == 0 ? 1 : capacity);
242
        while (new_capacity <= max_id) {
243
          new_capacity <<= 1;
244
        }
245
        Value* new_values = allocator.allocate(new_capacity);
246
        Item it;
247
        for (nf->first(it); it != INVALID; nf->next(it)) {
248
          int id = nf->id(it);
249
          bool found = false;
250
          for (int i = 0; i < int(keys.size()); ++i) {
251
            int jd = nf->id(keys[i]);
252
            if (id == jd) {
253
              found = true;
254
              break;
255
            }
256
          }
257
          if (found) continue;
258
          allocator.construct(&(new_values[id]), values[id]);
259
          allocator.destroy(&(values[id]));
260
        }
261
        if (capacity != 0) allocator.deallocate(values, capacity);
262
        values = new_values;
263
        capacity = new_capacity;
264 264
      }
265 265
      for (int i = 0; i < int(keys.size()); ++i) {
266
	int id = nf->id(keys[i]);
267
	allocator.construct(&(values[id]), Value());
266
        int id = nf->id(keys[i]);
267
        allocator.construct(&(values[id]), Value());
268 268
      }
269 269
    }
270
		
270

	
271 271
    /// \brief Erase a key from the map.
... ...
@@ -273,3 +273,3 @@
273 273
    /// Erase a key from the map. It called by the observer notifier
274
    /// and it overrides the erase() member function of the observer base.     
274
    /// and it overrides the erase() member function of the observer base.
275 275
    virtual void erase(const Key& key) {
... ...
@@ -282,7 +282,7 @@
282 282
    /// Erase more keys from the map. It called by the observer notifier
283
    /// and it overrides the erase() member function of the observer base.     
283
    /// and it overrides the erase() member function of the observer base.
284 284
    virtual void erase(const std::vector<Key>& keys) {
285 285
      for (int i = 0; i < int(keys.size()); ++i) {
286
	int id = Parent::notifier()->id(keys[i]);
287
	allocator.destroy(&(values[id]));
286
        int id = Parent::notifier()->id(keys[i]);
287
        allocator.destroy(&(values[id]));
288 288
      }
... ...
@@ -291,5 +291,5 @@
291 291
    /// \brief Buildes the map.
292
    ///	
292
    ///
293 293
    /// It buildes the map. It called by the observer notifier
294
    /// and it overrides the build() member function of the observer base. 
294
    /// and it overrides the build() member function of the observer base.
295 295
    virtual void build() {
... ...
@@ -299,5 +299,5 @@
299 299
      for (nf->first(it); it != INVALID; nf->next(it)) {
300
	int id = nf->id(it);;
301
	allocator.construct(&(values[id]), Value());
302
      }								
300
        int id = nf->id(it);;
301
        allocator.construct(&(values[id]), Value());
302
      }
303 303
    }
... ...
@@ -307,13 +307,13 @@
307 307
    /// It erase all items from the map. It called by the observer notifier
308
    /// and it overrides the clear() member function of the observer base.     
309
    virtual void clear() {	
308
    /// and it overrides the clear() member function of the observer base.
309
    virtual void clear() {
310 310
      Notifier* nf = Parent::notifier();
311 311
      if (capacity != 0) {
312
	Item it;
313
	for (nf->first(it); it != INVALID; nf->next(it)) {
314
	  int id = nf->id(it);
315
	  allocator.destroy(&(values[id]));
316
	}								
317
	allocator.deallocate(values, capacity);
318
	capacity = 0;
312
        Item it;
313
        for (nf->first(it); it != INVALID; nf->next(it)) {
314
          int id = nf->id(it);
315
          allocator.destroy(&(values[id]));
316
        }
317
        allocator.deallocate(values, capacity);
318
        capacity = 0;
319 319
      }
... ...
@@ -322,3 +322,3 @@
322 322
  private:
323
      
323

	
324 324
    void allocate_memory() {
... ...
@@ -326,5 +326,5 @@
326 326
      if (max_id == -1) {
327
	capacity = 0;
328
	values = 0;
329
	return;
327
        capacity = 0;
328
        values = 0;
329
        return;
330 330
      }
... ...
@@ -332,6 +332,6 @@
332 332
      while (capacity <= max_id) {
333
	capacity <<= 1;
333
        capacity <<= 1;
334 334
      }
335
      values = allocator.allocate(capacity);	
336
    }      
335
      values = allocator.allocate(capacity);
336
    }
337 337

	
... ...
@@ -341,3 +341,3 @@
341 341

	
342
  };		
342
  };
343 343

	
... ...
@@ -345,2 +345,2 @@
345 345

	
346
#endif 
346
#endif
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -65,10 +65,10 @@
65 65
      bool operator==(const Arc &that) const {
66
	return forward==that.forward && Edge(*this)==Edge(that);
66
        return forward==that.forward && Edge(*this)==Edge(that);
67 67
      }
68 68
      bool operator!=(const Arc &that) const {
69
	return forward!=that.forward || Edge(*this)!=Edge(that);
69
        return forward!=that.forward || Edge(*this)!=Edge(that);
70 70
      }
71 71
      bool operator<(const Arc &that) const {
72
	return forward<that.forward ||
73
	  (!(that.forward<forward) && Edge(*this)<Edge(that));
72
        return forward<that.forward ||
73
          (!(that.forward<forward) && Edge(*this)<Edge(that));
74 74
      }
... ...
@@ -119,7 +119,7 @@
119 119
      if( e.forward ) {
120
	e.forward = false;
120
        e.forward = false;
121 121
      }
122 122
      else {
123
	Parent::next(e);
124
	e.forward = true;
123
        Parent::next(e);
124
        e.forward = true;
125 125
      }
... ...
@@ -130,7 +130,7 @@
130 130
      if( Edge(e) != INVALID ) {
131
	e.forward = false;
131
        e.forward = false;
132 132
      }
133 133
      else {
134
	Parent::firstOut(e,n);
135
	e.forward = true;
134
        Parent::firstOut(e,n);
135
        e.forward = true;
136 136
      }
... ...
@@ -139,11 +139,11 @@
139 139
      if( ! e.forward ) {
140
	Node n = Parent::target(e);
141
	Parent::nextIn(e);
142
	if( Edge(e) == INVALID ) {
143
	  Parent::firstOut(e, n);
144
	  e.forward = true;
145
	}
140
        Node n = Parent::target(e);
141
        Parent::nextIn(e);
142
        if( Edge(e) == INVALID ) {
143
          Parent::firstOut(e, n);
144
          e.forward = true;
145
        }
146 146
      }
147 147
      else {
148
	Parent::nextOut(e);
148
        Parent::nextOut(e);
149 149
      }
... ...
@@ -154,7 +154,7 @@
154 154
      if( Edge(e) != INVALID ) {
155
	e.forward = false;
155
        e.forward = false;
156 156
      }
157 157
      else {
158
	Parent::firstIn(e,n);
159
	e.forward = true;
158
        Parent::firstIn(e,n);
159
        e.forward = true;
160 160
      }
... ...
@@ -163,11 +163,11 @@
163 163
      if( ! e.forward ) {
164
	Node n = Parent::source(e);
165
	Parent::nextOut(e);
166
	if( Edge(e) == INVALID ) {
167
	  Parent::firstIn(e, n);
168
	  e.forward = true;
169
	}
164
        Node n = Parent::source(e);
165
        Parent::nextOut(e);
166
        if( Edge(e) == INVALID ) {
167
          Parent::firstIn(e, n);
168
          e.forward = true;
169
        }
170 170
      }
171 171
      else {
172
	Parent::nextIn(e);
172
        Parent::nextIn(e);
173 173
      }
... ...
@@ -185,9 +185,9 @@
185 185
      if (d) {
186
	Node s = Parent::source(e);
187
	Parent::nextOut(e);
188
	if (e != INVALID) return;
189
	d = false;
190
	Parent::firstIn(e, s);
186
        Node s = Parent::source(e);
187
        Parent::nextOut(e);
188
        if (e != INVALID) return;
189
        d = false;
190
        Parent::firstIn(e, s);
191 191
      } else {
192
	Parent::nextIn(e);
192
        Parent::nextIn(e);
193 193
      }
... ...
@@ -242,14 +242,14 @@
242 242
      if (p == INVALID) {
243
	Edge arc = Parent::findArc(s, t);
244
	if (arc != INVALID) return direct(arc, true);
245
	arc = Parent::findArc(t, s);
246
	if (arc != INVALID) return direct(arc, false);
243
        Edge arc = Parent::findArc(s, t);
244
        if (arc != INVALID) return direct(arc, true);
245
        arc = Parent::findArc(t, s);
246
        if (arc != INVALID) return direct(arc, false);
247 247
      } else if (direction(p)) {
248
	Edge arc = Parent::findArc(s, t, p);
249
	if (arc != INVALID) return direct(arc, true);
250
	arc = Parent::findArc(t, s);
251
	if (arc != INVALID) return direct(arc, false);	
248
        Edge arc = Parent::findArc(s, t, p);
249
        if (arc != INVALID) return direct(arc, true);
250
        arc = Parent::findArc(t, s);
251
        if (arc != INVALID) return direct(arc, false);
252 252
      } else {
253
	Edge arc = Parent::findArc(t, s, p);
254
	if (arc != INVALID) return direct(arc, false);	      
253
        Edge arc = Parent::findArc(t, s, p);
254
        if (arc != INVALID) return direct(arc, false);
255 255
      }
... ...
@@ -269,6 +269,6 @@
269 269
          arc = Parent::findArc(t, s);
270
          if (arc != INVALID) return arc;	
270
          if (arc != INVALID) return arc;
271 271
        } else {
272 272
          Edge arc = Parent::findArc(t, s, p);
273
          if (arc != INVALID) return arc;	      
273
          if (arc != INVALID) return arc;
274 274
        }
... ...
@@ -301,8 +301,8 @@
301 301
      Red(const Node& node) : Node(node) {
302
	LEMON_ASSERT(Parent::red(node) || node == INVALID, 
303
		     typename Parent::NodeSetError());
302
        LEMON_ASSERT(Parent::red(node) || node == INVALID,
303
                     typename Parent::NodeSetError());
304 304
      }
305 305
      Red& operator=(const Node& node) {
306
	LEMON_ASSERT(Parent::red(node) || node == INVALID, 
307
		     typename Parent::NodeSetError());
306
        LEMON_ASSERT(Parent::red(node) || node == INVALID,
307
                     typename Parent::NodeSetError());
308 308
        Node::operator=(node);
... ...
@@ -333,8 +333,8 @@
333 333
      Blue(const Node& node) : Node(node) {
334
	LEMON_ASSERT(Parent::blue(node) || node == INVALID,
335
		     typename Parent::NodeSetError());
334
        LEMON_ASSERT(Parent::blue(node) || node == INVALID,
335
                     typename Parent::NodeSetError());
336 336
      }
337 337
      Blue& operator=(const Node& node) {
338
	LEMON_ASSERT(Parent::blue(node) || node == INVALID, 
339
		     typename Parent::NodeSetError());
338
        LEMON_ASSERT(Parent::blue(node) || node == INVALID,
339
                     typename Parent::NodeSetError());
340 340
        Node::operator=(node);
... ...
@@ -355,3 +355,3 @@
355 355
    }
356
  
356

	
357 357
    int id(const Blue& node) const {
... ...
@@ -369,7 +369,7 @@
369 369
      if (Parent::red(node)) {
370
	Parent::firstFromRed(arc, node);
371
	dir = true;
370
        Parent::firstFromRed(arc, node);
371
        dir = true;
372 372
      } else {
373
	Parent::firstFromBlue(arc, node);
374
	dir = static_cast<Edge&>(arc) == INVALID;
373
        Parent::firstFromBlue(arc, node);
374
        dir = static_cast<Edge&>(arc) == INVALID;
375 375
      }
... ...
@@ -378,6 +378,6 @@
378 378
      if (dir) {
379
	Parent::nextFromRed(arc);
379
        Parent::nextFromRed(arc);
380 380
      } else {
381
	Parent::nextFromBlue(arc);
382
	if (arc == INVALID) dir = true;
381
        Parent::nextFromBlue(arc);
382
        if (arc == INVALID) dir = true;
383 383
      }
... ...
@@ -391,3 +391,3 @@
391 391
      Arc(const Edge& arc, bool _forward)
392
	: Edge(arc), forward(_forward) {}
392
        : Edge(arc), forward(_forward) {}
393 393

	
... ...
@@ -397,10 +397,10 @@
397 397
      bool operator==(const Arc& i) const {
398
	return Edge::operator==(i) && forward == i.forward;
398
        return Edge::operator==(i) && forward == i.forward;
399 399
      }
400 400
      bool operator!=(const Arc& i) const {
401
	return Edge::operator!=(i) || forward != i.forward;
401
        return Edge::operator!=(i) || forward != i.forward;
402 402
      }
403 403
      bool operator<(const Arc& i) const {
404
	return Edge::operator<(i) || 
405
	  (!(i.forward<forward) && Edge(*this)<Edge(i));
404
        return Edge::operator<(i) ||
405
          (!(i.forward<forward) && Edge(*this)<Edge(i));
406 406
      }
... ...
@@ -415,3 +415,3 @@
415 415
      if (!arc.forward) {
416
	Parent::next(static_cast<Edge&>(arc));
416
        Parent::next(static_cast<Edge&>(arc));
417 417
      }
... ...
@@ -422,7 +422,7 @@
422 422
      if (Parent::red(node)) {
423
	Parent::firstFromRed(arc, node);
424
	arc.forward = true;
423
        Parent::firstFromRed(arc, node);
424
        arc.forward = true;
425 425
      } else {
426
	Parent::firstFromBlue(arc, node);
427
	arc.forward = static_cast<Edge&>(arc) == INVALID;
426
        Parent::firstFromBlue(arc, node);
427
        arc.forward = static_cast<Edge&>(arc) == INVALID;
428 428
      }
... ...
@@ -431,5 +431,5 @@
431 431
      if (arc.forward) {
432
	Parent::nextFromRed(arc);
432
        Parent::nextFromRed(arc);
433 433
      } else {
434
	Parent::nextFromBlue(arc);
434
        Parent::nextFromBlue(arc);
435 435
        arc.forward = static_cast<Edge&>(arc) == INVALID;
... ...
@@ -440,7 +440,7 @@
440 440
      if (Parent::blue(node)) {
441
	Parent::firstFromBlue(arc, node);
442
	arc.forward = true;	
441
        Parent::firstFromBlue(arc, node);
442
        arc.forward = true;
443 443
      } else {
444
	Parent::firstFromRed(arc, node);
445
	arc.forward = static_cast<Edge&>(arc) == INVALID;
444
        Parent::firstFromRed(arc, node);
445
        arc.forward = static_cast<Edge&>(arc) == INVALID;
446 446
      }
... ...
@@ -449,6 +449,6 @@
449 449
      if (arc.forward) {
450
	Parent::nextFromBlue(arc);
450
        Parent::nextFromBlue(arc);
451 451
      } else {
452
	Parent::nextFromRed(arc);
453
	arc.forward = static_cast<Edge&>(arc) == INVALID;
452
        Parent::nextFromRed(arc);
453
        arc.forward = static_cast<Edge&>(arc) == INVALID;
454 454
      }
... ...
@@ -464,3 +464,3 @@
464 464
    int id(const Arc& arc) const {
465
      return (Parent::id(static_cast<const Edge&>(arc)) << 1) + 
465
      return (Parent::id(static_cast<const Edge&>(arc)) << 1) +
466 466
        (arc.forward ? 0 : 1);
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -46,3 +46,3 @@
46 46
  Bezier1(Point _p1, Point _p2) :p1(_p1), p2(_p2) {}
47
  
47

	
48 48
  Point operator()(double t) const
... ...
@@ -56,3 +56,3 @@
56 56
  }
57
  
57

	
58 58
  Bezier1 after(double t) const
... ...
@@ -89,3 +89,3 @@
89 89
  }
90
  
90

	
91 91
  Bezier2 after(double t) const
... ...
@@ -112,8 +112,8 @@
112 112
    : p1(_p1), p2(_p2), p3(_p3), p4(_p4) {}
113
  Bezier3(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,1.0/3.0)), 
114
			      p3(conv(b.p1,b.p2,2.0/3.0)), p4(b.p2) {}
113
  Bezier3(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,1.0/3.0)),
114
                              p3(conv(b.p1,b.p2,2.0/3.0)), p4(b.p2) {}
115 115
  Bezier3(const Bezier2 &b) : p1(b.p1), p2(conv(b.p1,b.p2,2.0/3.0)),
116
			      p3(conv(b.p2,b.p3,1.0/3.0)), p4(b.p3) {}
117
  
118
  Point operator()(double t) const 
116
                              p3(conv(b.p2,b.p3,1.0/3.0)), p4(b.p3) {}
117

	
118
  Point operator()(double t) const
119 119
    {
... ...
@@ -121,3 +121,3 @@
121 121
      return ((1-t)*(1-t)*(1-t))*p1+(3*t*(1-t)*(1-t))*p2+
122
	(3*t*t*(1-t))*p3+(t*t*t)*p4;
122
        (3*t*t*(1-t))*p3+(t*t*t)*p4;
123 123
    }
... ...
@@ -133,3 +133,3 @@
133 133
    }
134
  
134

	
135 135
  Bezier3 after(double t) const
... ...
@@ -148,4 +148,4 @@
148 148
  Bezier2 norm() const { return Bezier2(3.0*rot90(p2-p1),
149
				  3.0*rot90(p3-p2),
150
				  3.0*rot90(p4-p3)); }
149
                                  3.0*rot90(p3-p2),
150
                                  3.0*rot90(p4-p3)); }
151 151
  Point grad(double t) const { return grad()(t); }
... ...
@@ -154,3 +154,3 @@
154 154
  template<class R,class F,class S,class D>
155
  R recSplit(F &_f,const S &_s,D _d) const 
155
  R recSplit(F &_f,const S &_s,D _d) const
156 156
  {
... ...
@@ -166,3 +166,3 @@
166 166
  }
167
  
167

	
168 168
};
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -31,4 +31,4 @@
31 31
namespace lemon {
32
  
33
  
32

	
33

	
34 34
  //#ifndef LEMON_USE_DEBUG_MAP
... ...
@@ -142,3 +142,3 @@
142 142

	
143
// #else 
143
// #else
144 144

	
... ...
@@ -149,3 +149,3 @@
149 149

	
150
// #endif  
150
// #endif
151 151

	
... ...
@@ -153,3 +153,3 @@
153 153
  template <typename _Graph, typename _Item, typename _Value>
154
  class DefaultMap 
154
  class DefaultMap
155 155
    : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
... ...
@@ -158,3 +158,3 @@
158 158
    typedef DefaultMap<_Graph, _Item, _Value> Map;
159
    
159

	
160 160
    typedef typename Parent::Graph Graph;
... ...
@@ -163,3 +163,3 @@
163 163
    explicit DefaultMap(const Graph& graph) : Parent(graph) {}
164
    DefaultMap(const Graph& graph, const Value& value) 
164
    DefaultMap(const Graph& graph, const Value& value)
165 165
      : Parent(graph, value) {}
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -68,7 +68,7 @@
68 68
      if (node == Parent::source(arc))
69
	return Parent::target(arc);
69
        return Parent::target(arc);
70 70
      else if(node == Parent::target(arc))
71
	return Parent::source(arc);
71
        return Parent::source(arc);
72 72
      else
73
	return INVALID;
73
        return INVALID;
74 74
    }
... ...
@@ -91,3 +91,3 @@
91 91
    }
92
    
92

	
93 93
    ArcNotifier& notifier(Arc) const {
... ...
@@ -96,3 +96,3 @@
96 96

	
97
    class NodeIt : public Node { 
97
    class NodeIt : public Node {
98 98
      const Digraph* _digraph;
... ...
@@ -105,11 +105,11 @@
105 105
      explicit NodeIt(const Digraph& digraph) : _digraph(&digraph) {
106
	_digraph->first(static_cast<Node&>(*this));
106
        _digraph->first(static_cast<Node&>(*this));
107 107
      }
108 108

	
109
      NodeIt(const Digraph& digraph, const Node& node) 
110
	: Node(node), _digraph(&digraph) {}
109
      NodeIt(const Digraph& digraph, const Node& node)
110
        : Node(node), _digraph(&digraph) {}
111 111

	
112
      NodeIt& operator++() { 
113
	_digraph->next(*this);
114
	return *this; 
112
      NodeIt& operator++() {
113
        _digraph->next(*this);
114
        return *this;
115 115
      }
... ...
@@ -119,3 +119,3 @@
119 119

	
120
    class ArcIt : public Arc { 
120
    class ArcIt : public Arc {
121 121
      const Digraph* _digraph;
... ...
@@ -128,11 +128,11 @@
128 128
      explicit ArcIt(const Digraph& digraph) : _digraph(&digraph) {
129
	_digraph->first(static_cast<Arc&>(*this));
129
        _digraph->first(static_cast<Arc&>(*this));
130 130
      }
131 131

	
132
      ArcIt(const Digraph& digraph, const Arc& arc) : 
133
	Arc(arc), _digraph(&digraph) { }
132
      ArcIt(const Digraph& digraph, const Arc& arc) :
133
        Arc(arc), _digraph(&digraph) { }
134 134

	
135
      ArcIt& operator++() { 
136
	_digraph->next(*this);
137
	return *this; 
135
      ArcIt& operator++() {
136
        _digraph->next(*this);
137
        return *this;
138 138
      }
... ...
@@ -142,3 +142,3 @@
142 142

	
143
    class OutArcIt : public Arc { 
143
    class OutArcIt : public Arc {
144 144
      const Digraph* _digraph;
... ...
@@ -150,13 +150,13 @@
150 150

	
151
      OutArcIt(const Digraph& digraph, const Node& node) 
152
	: _digraph(&digraph) {
153
	_digraph->firstOut(*this, node);
151
      OutArcIt(const Digraph& digraph, const Node& node)
152
        : _digraph(&digraph) {
153
        _digraph->firstOut(*this, node);
154 154
      }
155 155

	
156
      OutArcIt(const Digraph& digraph, const Arc& arc) 
157
	: Arc(arc), _digraph(&digraph) {}
156
      OutArcIt(const Digraph& digraph, const Arc& arc)
157
        : Arc(arc), _digraph(&digraph) {}
158 158

	
159
      OutArcIt& operator++() { 
160
	_digraph->nextOut(*this);
161
	return *this; 
159
      OutArcIt& operator++() {
160
        _digraph->nextOut(*this);
161
        return *this;
162 162
      }
... ...
@@ -166,3 +166,3 @@
166 166

	
167
    class InArcIt : public Arc { 
167
    class InArcIt : public Arc {
168 168
      const Digraph* _digraph;
... ...
@@ -174,13 +174,13 @@
174 174

	
175
      InArcIt(const Digraph& digraph, const Node& node) 
176
	: _digraph(&digraph) {
177
	_digraph->firstIn(*this, node);
175
      InArcIt(const Digraph& digraph, const Node& node)
176
        : _digraph(&digraph) {
177
        _digraph->firstIn(*this, node);
178 178
      }
179 179

	
180
      InArcIt(const Digraph& digraph, const Arc& arc) : 
181
	Arc(arc), _digraph(&digraph) {}
180
      InArcIt(const Digraph& digraph, const Arc& arc) :
181
        Arc(arc), _digraph(&digraph) {}
182 182

	
183
      InArcIt& operator++() { 
184
	_digraph->nextIn(*this);
185
	return *this; 
183
      InArcIt& operator++() {
184
        _digraph->nextIn(*this);
185
        return *this;
186 186
      }
... ...
@@ -217,5 +217,5 @@
217 217

	
218
    
218

	
219 219
    template <typename _Value>
220
    class NodeMap 
220
    class NodeMap
221 221
      : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
... ...
@@ -225,9 +225,9 @@
225 225

	
226
      explicit NodeMap(const Digraph& digraph) 
227
	: Parent(digraph) {}
228
      NodeMap(const Digraph& digraph, const _Value& value) 
229
	: Parent(digraph, value) {}
226
      explicit NodeMap(const Digraph& digraph)
227
        : Parent(digraph) {}
228
      NodeMap(const Digraph& digraph, const _Value& value)
229
        : Parent(digraph, value) {}
230 230

	
231 231
      NodeMap& operator=(const NodeMap& cmap) {
232
	return operator=<NodeMap>(cmap);
232
        return operator=<NodeMap>(cmap);
233 233
      }
... ...
@@ -237,3 +237,3 @@
237 237
        Parent::operator=(cmap);
238
	return *this;
238
        return *this;
239 239
      }
... ...
@@ -243,3 +243,3 @@
243 243
    template <typename _Value>
244
    class ArcMap 
244
    class ArcMap
245 245
      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
... ...
@@ -249,9 +249,9 @@
249 249

	
250
      explicit ArcMap(const Digraph& digraph) 
251
	: Parent(digraph) {}
252
      ArcMap(const Digraph& digraph, const _Value& value) 
253
	: Parent(digraph, value) {}
250
      explicit ArcMap(const Digraph& digraph)
251
        : Parent(digraph) {}
252
      ArcMap(const Digraph& digraph, const _Value& value)
253
        : Parent(digraph, value) {}
254 254

	
255 255
      ArcMap& operator=(const ArcMap& cmap) {
256
	return operator=<ArcMap>(cmap);
256
        return operator=<ArcMap>(cmap);
257 257
      }
... ...
@@ -261,3 +261,3 @@
261 261
        Parent::operator=(cmap);
262
	return *this;
262
        return *this;
263 263
      }
... ...
@@ -271,3 +271,3 @@
271 271
    }
272
    
272

	
273 273
    Arc addArc(const Node& from, const Node& to) {
... ...
@@ -295,5 +295,5 @@
295 295
      while (arc != INVALID ) {
296
	erase(arc);
297
	Parent::firstOut(arc, node);
298
      } 
296
        erase(arc);
297
        Parent::firstOut(arc, node);
298
      }
299 299

	
... ...
@@ -301,4 +301,4 @@
301 301
      while (arc != INVALID ) {
302
	erase(arc);
303
	Parent::firstIn(arc, node);
302
        erase(arc);
303
        Parent::firstIn(arc, node);
304 304
      }
... ...
@@ -308,3 +308,3 @@
308 308
    }
309
    
309

	
310 310
    void erase(const Arc& arc) {
... ...
@@ -317,4 +317,4 @@
317 317
      arc_notifier.setContainer(*this);
318
    } 
319
    
318
    }
319

	
320 320

	
... ...
@@ -329,6 +329,6 @@
329 329
  /// \brief Extender for the Graphs
330
  template <typename Base> 
330
  template <typename Base>
331 331
  class GraphExtender : public Base {
332 332
  public:
333
    
333

	
334 334
    typedef Base Parent;
... ...
@@ -342,3 +342,3 @@
342 342

	
343
    // Graph extension    
343
    // Graph extension
344 344

	
... ...
@@ -370,7 +370,7 @@
370 370
      if( n == Parent::u(e))
371
	return Parent::v(e);
371
        return Parent::v(e);
372 372
      else if( n == Parent::v(e))
373
	return Parent::u(e);
373
        return Parent::u(e);
374 374
      else
375
	return INVALID;
375
        return INVALID;
376 376
    }
... ...
@@ -404,3 +404,3 @@
404 404
    }
405
    
405

	
406 406
    ArcNotifier& notifier(Arc) const {
... ...
@@ -415,3 +415,3 @@
415 415

	
416
    class NodeIt : public Node { 
416
    class NodeIt : public Node {
417 417
      const Graph* _graph;
... ...
@@ -424,11 +424,11 @@
424 424
      explicit NodeIt(const Graph& graph) : _graph(&graph) {
425
	_graph->first(static_cast<Node&>(*this));
425
        _graph->first(static_cast<Node&>(*this));
426 426
      }
427 427

	
428
      NodeIt(const Graph& graph, const Node& node) 
429
	: Node(node), _graph(&graph) {}
428
      NodeIt(const Graph& graph, const Node& node)
429
        : Node(node), _graph(&graph) {}
430 430

	
431
      NodeIt& operator++() { 
432
	_graph->next(*this);
433
	return *this; 
431
      NodeIt& operator++() {
432
        _graph->next(*this);
433
        return *this;
434 434
      }
... ...
@@ -438,3 +438,3 @@
438 438

	
439
    class ArcIt : public Arc { 
439
    class ArcIt : public Arc {
440 440
      const Graph* _graph;
... ...
@@ -447,11 +447,11 @@
447 447
      explicit ArcIt(const Graph& graph) : _graph(&graph) {
448
	_graph->first(static_cast<Arc&>(*this));
448
        _graph->first(static_cast<Arc&>(*this));
449 449
      }
450 450

	
451
      ArcIt(const Graph& graph, const Arc& arc) : 
452
	Arc(arc), _graph(&graph) { }
451
      ArcIt(const Graph& graph, const Arc& arc) :
452
        Arc(arc), _graph(&graph) { }
453 453

	
454
      ArcIt& operator++() { 
455
	_graph->next(*this);
456
	return *this; 
454
      ArcIt& operator++() {
455
        _graph->next(*this);
456
        return *this;
457 457
      }
... ...
@@ -461,3 +461,3 @@
461 461

	
462
    class OutArcIt : public Arc { 
462
    class OutArcIt : public Arc {
463 463
      const Graph* _graph;
... ...
@@ -469,13 +469,13 @@
469 469

	
470
      OutArcIt(const Graph& graph, const Node& node) 
471
	: _graph(&graph) {
472
	_graph->firstOut(*this, node);
470
      OutArcIt(const Graph& graph, const Node& node)
471
        : _graph(&graph) {
472
        _graph->firstOut(*this, node);
473 473
      }
474 474

	
475
      OutArcIt(const Graph& graph, const Arc& arc) 
476
	: Arc(arc), _graph(&graph) {}
475
      OutArcIt(const Graph& graph, const Arc& arc)
476
        : Arc(arc), _graph(&graph) {}
477 477

	
478
      OutArcIt& operator++() { 
479
	_graph->nextOut(*this);
480
	return *this; 
478
      OutArcIt& operator++() {
479
        _graph->nextOut(*this);
480
        return *this;
481 481
      }
... ...
@@ -485,3 +485,3 @@
485 485

	
486
    class InArcIt : public Arc { 
486
    class InArcIt : public Arc {
487 487
      const Graph* _graph;
... ...
@@ -493,13 +493,13 @@
493 493

	
494
      InArcIt(const Graph& graph, const Node& node) 
495
	: _graph(&graph) {
496
	_graph->firstIn(*this, node);
494
      InArcIt(const Graph& graph, const Node& node)
495
        : _graph(&graph) {
496
        _graph->firstIn(*this, node);
497 497
      }
498 498

	
499
      InArcIt(const Graph& graph, const Arc& arc) : 
500
	Arc(arc), _graph(&graph) {}
499
      InArcIt(const Graph& graph, const Arc& arc) :
500
        Arc(arc), _graph(&graph) {}
501 501

	
502
      InArcIt& operator++() { 
503
	_graph->nextIn(*this);
504
	return *this; 
502
      InArcIt& operator++() {
503
        _graph->nextIn(*this);
504
        return *this;
505 505
      }
... ...
@@ -509,3 +509,3 @@
509 509

	
510
    class EdgeIt : public Parent::Edge { 
510
    class EdgeIt : public Parent::Edge {
511 511
      const Graph* _graph;
... ...
@@ -518,11 +518,11 @@
518 518
      explicit EdgeIt(const Graph& graph) : _graph(&graph) {
519
	_graph->first(static_cast<Edge&>(*this));
519
        _graph->first(static_cast<Edge&>(*this));
520 520
      }
521 521

	
522
      EdgeIt(const Graph& graph, const Edge& edge) : 
523
	Edge(edge), _graph(&graph) { }
522
      EdgeIt(const Graph& graph, const Edge& edge) :
523
        Edge(edge), _graph(&graph) { }
524 524

	
525
      EdgeIt& operator++() { 
526
	_graph->next(*this);
527
	return *this; 
525
      EdgeIt& operator++() {
526
        _graph->next(*this);
527
        return *this;
528 528
      }
... ...
@@ -542,3 +542,3 @@
542 542
      IncEdgeIt(const Graph& graph, const Node &node) : _graph(&graph) {
543
	_graph->firstInc(*this, _direction, node);
543
        _graph->firstInc(*this, _direction, node);
544 544
      }
... ...
@@ -546,4 +546,4 @@
546 546
      IncEdgeIt(const Graph& graph, const Edge &edge, const Node &node)
547
	: _graph(&graph), Edge(edge) {
548
	_direction = (_graph->source(edge) == node);
547
        : _graph(&graph), Edge(edge) {
548
        _direction = (_graph->source(edge) == node);
549 549
      }
... ...
@@ -551,4 +551,4 @@
551 551
      IncEdgeIt& operator++() {
552
	_graph->nextInc(*this, _direction);
553
	return *this; 
552
        _graph->nextInc(*this, _direction);
553
        return *this;
554 554
      }
... ...
@@ -600,3 +600,3 @@
600 600
    template <typename _Value>
601
    class NodeMap 
601
    class NodeMap
602 602
      : public MapExtender<DefaultMap<Graph, Node, _Value> > {
... ...
@@ -606,9 +606,9 @@
606 606

	
607
      NodeMap(const Graph& graph) 
608
	: Parent(graph) {}
609
      NodeMap(const Graph& graph, const _Value& value) 
610
	: Parent(graph, value) {}
607
      NodeMap(const Graph& graph)
608
        : Parent(graph) {}
609
      NodeMap(const Graph& graph, const _Value& value)
610
        : Parent(graph, value) {}
611 611

	
612 612
      NodeMap& operator=(const NodeMap& cmap) {
613
	return operator=<NodeMap>(cmap);
613
        return operator=<NodeMap>(cmap);
614 614
      }
... ...
@@ -618,3 +618,3 @@
618 618
        Parent::operator=(cmap);
619
	return *this;
619
        return *this;
620 620
      }
... ...
@@ -624,3 +624,3 @@
624 624
    template <typename _Value>
625
    class ArcMap 
625
    class ArcMap
626 626
      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
... ...
@@ -630,9 +630,9 @@
630 630

	
631
      ArcMap(const Graph& graph) 
632
	: Parent(graph) {}
633
      ArcMap(const Graph& graph, const _Value& value) 
634
	: Parent(graph, value) {}
631
      ArcMap(const Graph& graph)
632
        : Parent(graph) {}
633
      ArcMap(const Graph& graph, const _Value& value)
634
        : Parent(graph, value) {}
635 635

	
636 636
      ArcMap& operator=(const ArcMap& cmap) {
637
	return operator=<ArcMap>(cmap);
637
        return operator=<ArcMap>(cmap);
638 638
      }
... ...
@@ -642,3 +642,3 @@
642 642
        Parent::operator=(cmap);
643
	return *this;
643
        return *this;
644 644
      }
... ...
@@ -648,3 +648,3 @@
648 648
    template <typename _Value>
649
    class EdgeMap 
649
    class EdgeMap
650 650
      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
... ...
@@ -654,10 +654,10 @@
654 654

	
655
      EdgeMap(const Graph& graph) 
656
	: Parent(graph) {}
655
      EdgeMap(const Graph& graph)
656
        : Parent(graph) {}
657 657

	
658
      EdgeMap(const Graph& graph, const _Value& value) 
659
	: Parent(graph, value) {}
658
      EdgeMap(const Graph& graph, const _Value& value)
659
        : Parent(graph, value) {}
660 660

	
661 661
      EdgeMap& operator=(const EdgeMap& cmap) {
662
	return operator=<EdgeMap>(cmap);
662
        return operator=<EdgeMap>(cmap);
663 663
      }
... ...
@@ -667,3 +667,3 @@
667 667
        Parent::operator=(cmap);
668
	return *this;
668
        return *this;
669 669
      }
... ...
@@ -685,3 +685,3 @@
685 685
      ev.push_back(Parent::direct(edge, true));
686
      ev.push_back(Parent::direct(edge, false));      
686
      ev.push_back(Parent::direct(edge, false));
687 687
      notifier(Arc()).add(ev);
... ...
@@ -689,3 +689,3 @@
689 689
    }
690
    
690

	
691 691
    void clear() {
... ...
@@ -698,3 +698,3 @@
698 698
    template <typename Graph, typename NodeRefMap, typename EdgeRefMap>
699
    void build(const Graph& graph, NodeRefMap& nodeRef, 
699
    void build(const Graph& graph, NodeRefMap& nodeRef,
700 700
               EdgeRefMap& edgeRef) {
... ...
@@ -710,5 +710,5 @@
710 710
      while (arc != INVALID ) {
711
	erase(arc);
712
	Parent::firstOut(arc, node);
713
      } 
711
        erase(arc);
712
        Parent::firstOut(arc, node);
713
      }
714 714

	
... ...
@@ -716,4 +716,4 @@
716 716
      while (arc != INVALID ) {
717
	erase(arc);
718
	Parent::firstIn(arc, node);
717
        erase(arc);
718
        Parent::firstIn(arc, node);
719 719
      }
... ...
@@ -727,3 +727,3 @@
727 727
      av.push_back(Parent::direct(edge, true));
728
      av.push_back(Parent::direct(edge, false));      
728
      av.push_back(Parent::direct(edge, false));
729 729
      notifier(Arc()).erase(av);
... ...
@@ -734,6 +734,6 @@
734 734
    GraphExtender() {
735
      node_notifier.setContainer(*this); 
735
      node_notifier.setContainer(*this);
736 736
      arc_notifier.setContainer(*this);
737 737
      edge_notifier.setContainer(*this);
738
    } 
738
    }
739 739

	
... ...
@@ -742,4 +742,4 @@
742 742
      arc_notifier.clear();
743
      node_notifier.clear(); 
744
    } 
743
      node_notifier.clear();
744
    }
745 745

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -36,3 +36,3 @@
36 36
  };
37
  
37

	
38 38
  /// \brief Invalid iterators.
... ...
@@ -54,2 +54,2 @@
54 54
#endif
55
  
55

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -34,3 +34,3 @@
34 34
  /// \ingroup graphbits
35
  /// 
35
  ///
36 36
  /// \brief Extender for maps
... ...
@@ -58,6 +58,6 @@
58 58

	
59
    MapExtender(const Graph& graph) 
59
    MapExtender(const Graph& graph)
60 60
      : Parent(graph) {}
61 61

	
62
    MapExtender(const Graph& graph, const Value& value) 
62
    MapExtender(const Graph& graph, const Value& value)
63 63
      : Parent(graph, value) {}
... ...
@@ -72,3 +72,3 @@
72 72
      return *this;
73
    } 
73
    }
74 74

	
... ...
@@ -76,6 +76,6 @@
76 76
    public:
77
      
77

	
78 78
      typedef Item Parent;
79 79
      typedef typename Map::Value Value;
80
      
80

	
81 81
      MapIt() {}
... ...
@@ -88,12 +88,12 @@
88 88

	
89
      MapIt(const Map& _map, const Item& item) 
90
	: Parent(item), map(_map) {}
89
      MapIt(const Map& _map, const Item& item)
90
        : Parent(item), map(_map) {}
91 91

	
92
      MapIt& operator++() { 
93
	map.notifier()->next(*this);
94
	return *this; 
92
      MapIt& operator++() {
93
        map.notifier()->next(*this);
94
        return *this;
95 95
      }
96
      
96

	
97 97
      typename MapTraits<Map>::ConstReturnValue operator*() const {
98
	return map[*this];
98
        return map[*this];
99 99
      }
... ...
@@ -101,12 +101,12 @@
101 101
      typename MapTraits<Map>::ReturnValue operator*() {
102
	return map[*this];
102
        return map[*this];
103 103
      }
104
      
104

	
105 105
      void set(const Value& value) {
106
	map.set(*this, value);
106
        map.set(*this, value);
107 107
      }
108
      
108

	
109 109
    protected:
110 110
      Map& map;
111
      
111

	
112 112
    };
... ...
@@ -119,3 +119,3 @@
119 119
      typedef typename Map::Value Value;
120
      
120

	
121 121
      ConstMapIt() {}
... ...
@@ -128,8 +128,8 @@
128 128

	
129
      ConstMapIt(const Map& _map, const Item& item) 
130
	: Parent(item), map(_map) {}
129
      ConstMapIt(const Map& _map, const Item& item)
130
        : Parent(item), map(_map) {}
131 131

	
132
      ConstMapIt& operator++() { 
133
	map.notifier()->next(*this);
134
	return *this; 
132
      ConstMapIt& operator++() {
133
        map.notifier()->next(*this);
134
        return *this;
135 135
      }
... ...
@@ -137,3 +137,3 @@
137 137
      typename MapTraits<Map>::ConstReturnValue operator*() const {
138
	return map[*this];
138
        return map[*this];
139 139
      }
... ...
@@ -146,5 +146,5 @@
146 146
    public:
147
      
147

	
148 148
      typedef Item Parent;
149
      
149

	
150 150
      ItemIt() {}
... ...
@@ -157,8 +157,8 @@
157 157

	
158
      ItemIt(const Map& _map, const Item& item) 
159
	: Parent(item), map(_map) {}
158
      ItemIt(const Map& _map, const Item& item)
159
        : Parent(item), map(_map) {}
160 160

	
161
      ItemIt& operator++() { 
162
	map.notifier()->next(*this);
163
	return *this; 
161
      ItemIt& operator++() {
162
        map.notifier()->next(*this);
163
        return *this;
164 164
      }
... ...
@@ -167,3 +167,3 @@
167 167
      const Map& map;
168
      
168

	
169 169
    };
... ...
@@ -172,3 +172,3 @@
172 172
  /// \ingroup graphbits
173
  /// 
173
  ///
174 174
  /// \brief Extender for maps which use a subset of the items.
... ...
@@ -196,6 +196,6 @@
196 196

	
197
    SubMapExtender(const Graph& _graph) 
197
    SubMapExtender(const Graph& _graph)
198 198
      : Parent(_graph), graph(_graph) {}
199 199

	
200
    SubMapExtender(const Graph& _graph, const Value& _value) 
200
    SubMapExtender(const Graph& _graph, const Value& _value)
201 201
      : Parent(_graph, _value), graph(_graph) {}
... ...
@@ -214,3 +214,3 @@
214 214
      return *this;
215
    } 
215
    }
216 216

	
... ...
@@ -218,6 +218,6 @@
218 218
    public:
219
      
219

	
220 220
      typedef Item Parent;
221 221
      typedef typename Map::Value Value;
222
      
222

	
223 223
      MapIt() {}
... ...
@@ -230,12 +230,12 @@
230 230

	
231
      MapIt(const Map& _map, const Item& item) 
232
	: Parent(item), map(_map) {}
231
      MapIt(const Map& _map, const Item& item)
232
        : Parent(item), map(_map) {}
233 233

	
234
      MapIt& operator++() { 
235
	map.graph.next(*this);
236
	return *this; 
234
      MapIt& operator++() {
235
        map.graph.next(*this);
236
        return *this;
237 237
      }
238
      
238

	
239 239
      typename MapTraits<Map>::ConstReturnValue operator*() const {
240
	return map[*this];
240
        return map[*this];
241 241
      }
... ...
@@ -243,12 +243,12 @@
243 243
      typename MapTraits<Map>::ReturnValue operator*() {
244
	return map[*this];
244
        return map[*this];
245 245
      }
246
      
246

	
247 247
      void set(const Value& value) {
248
	map.set(*this, value);
248
        map.set(*this, value);
249 249
      }
250
      
250

	
251 251
    protected:
252 252
      Map& map;
253
      
253

	
254 254
    };
... ...
@@ -261,3 +261,3 @@
261 261
      typedef typename Map::Value Value;
262
      
262

	
263 263
      ConstMapIt() {}
... ...
@@ -270,8 +270,8 @@
270 270

	
271
      ConstMapIt(const Map& _map, const Item& item) 
272
	: Parent(item), map(_map) {}
271
      ConstMapIt(const Map& _map, const Item& item)
272
        : Parent(item), map(_map) {}
273 273

	
274
      ConstMapIt& operator++() { 
275
	map.graph.next(*this);
276
	return *this; 
274
      ConstMapIt& operator++() {
275
        map.graph.next(*this);
276
        return *this;
277 277
      }
... ...
@@ -279,3 +279,3 @@
279 279
      typename MapTraits<Map>::ConstReturnValue operator*() const {
280
	return map[*this];
280
        return map[*this];
281 281
      }
... ...
@@ -288,5 +288,5 @@
288 288
    public:
289
      
289

	
290 290
      typedef Item Parent;
291
      
291

	
292 292
      ItemIt() {}
... ...
@@ -299,8 +299,8 @@
299 299

	
300
      ItemIt(const Map& _map, const Item& item) 
301
	: Parent(item), map(_map) {}
300
      ItemIt(const Map& _map, const Item& item)
301
        : Parent(item), map(_map) {}
302 302

	
303
      ItemIt& operator++() { 
304
	map.graph.next(*this);
305
	return *this; 
303
      ItemIt& operator++() {
304
        map.graph.next(*this);
305
        return *this;
306 306
      }
... ...
@@ -309,5 +309,5 @@
309 309
      const Map& map;
310
      
310

	
311 311
    };
312
    
312

	
313 313
  private:
... ...
@@ -315,3 +315,3 @@
315 315
    const Graph& graph;
316
    
316

	
317 317
  };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -55,3 +55,3 @@
55 55
      RevArcIt(Invalid) : path(0), current(INVALID) {}
56
      RevArcIt(const PredMapPath& _path) 
56
      RevArcIt(const PredMapPath& _path)
57 57
        : path(&_path), current(_path.target) {
... ...
@@ -70,4 +70,4 @@
70 70

	
71
      bool operator==(const RevArcIt& e) const { 
72
        return current == e.current; 
71
      bool operator==(const RevArcIt& e) const {
72
        return current == e.current;
73 73
      }
... ...
@@ -75,9 +75,9 @@
75 75
      bool operator!=(const RevArcIt& e) const {
76
        return current != e.current; 
76
        return current != e.current;
77 77
      }
78 78

	
79
      bool operator<(const RevArcIt& e) const { 
80
        return current < e.current; 
79
      bool operator<(const RevArcIt& e) const {
80
        return current < e.current;
81 81
      }
82
      
82

	
83 83
    private:
... ...
@@ -103,7 +103,7 @@
103 103

	
104
    PredMatrixMapPath(const Digraph& _digraph, 
104
    PredMatrixMapPath(const Digraph& _digraph,
105 105
                      const PredMatrixMap& _predMatrixMap,
106
                      typename Digraph::Node _source, 
106
                      typename Digraph::Node _source,
107 107
                      typename Digraph::Node _target)
108
      : digraph(_digraph), predMatrixMap(_predMatrixMap), 
108
      : digraph(_digraph), predMatrixMap(_predMatrixMap),
109 109
        source(_source), target(_target) {}
... ...
@@ -129,5 +129,5 @@
129 129
      RevArcIt(Invalid) : path(0), current(INVALID) {}
130
      RevArcIt(const PredMatrixMapPath& _path) 
130
      RevArcIt(const PredMatrixMapPath& _path)
131 131
        : path(&_path), current(_path.target) {
132
        if (path->predMatrixMap(path->source, current) == INVALID) 
132
        if (path->predMatrixMap(path->source, current) == INVALID)
133 133
          current = INVALID;
... ...
@@ -140,5 +140,5 @@
140 140
      RevArcIt& operator++() {
141
        current = 
141
        current =
142 142
          path->digraph.source(path->predMatrixMap(path->source, current));
143
        if (path->predMatrixMap(path->source, current) == INVALID) 
143
        if (path->predMatrixMap(path->source, current) == INVALID)
144 144
          current = INVALID;
... ...
@@ -147,4 +147,4 @@
147 147

	
148
      bool operator==(const RevArcIt& e) const { 
149
        return current == e.current; 
148
      bool operator==(const RevArcIt& e) const {
149
        return current == e.current;
150 150
      }
... ...
@@ -152,9 +152,9 @@
152 152
      bool operator!=(const RevArcIt& e) const {
153
        return current != e.current; 
153
        return current != e.current;
154 154
      }
155 155

	
156
      bool operator<(const RevArcIt& e) const { 
157
        return current < e.current; 
156
      bool operator<(const RevArcIt& e) const {
157
        return current < e.current;
158 158
      }
159
      
159

	
160 160
    private:
Ignore white space 6 line context
1

	
2
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
3 2
 *
4
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
5 4
 *
... ...
@@ -31,3 +30,3 @@
31 30
  class ItemSetTraits {};
32
  
31

	
33 32

	
... ...
@@ -39,5 +38,5 @@
39 38
  struct NodeNotifierIndicator<
40
    Graph, 
39
    Graph,
41 40
    typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
42
  > { 
41
  > {
43 42
    typedef typename Graph::NodeNotifier Type;
... ...
@@ -48,3 +47,3 @@
48 47
  public:
49
    
48

	
50 49
    typedef _Graph Graph;
... ...
@@ -59,4 +58,4 @@
59 58
    public:
60
      typedef typename Graph::template NodeMap<_Value> Parent; 
61
      typedef typename Graph::template NodeMap<_Value> Type; 
59
      typedef typename Graph::template NodeMap<_Value> Parent;
60
      typedef typename Graph::template NodeMap<_Value> Type;
62 61
      typedef typename Parent::Value Value;
... ...
@@ -64,4 +63,4 @@
64 63
      Map(const Graph& _digraph) : Parent(_digraph) {}
65
      Map(const Graph& _digraph, const Value& _value) 
66
	: Parent(_digraph, _value) {}
64
      Map(const Graph& _digraph, const Value& _value)
65
        : Parent(_digraph, _value) {}
67 66

	
... ...
@@ -77,5 +76,5 @@
77 76
  struct ArcNotifierIndicator<
78
    Graph, 
77
    Graph,
79 78
    typename enable_if<typename Graph::ArcNotifier::Notifier, void>::type
80
  > { 
79
  > {
81 80
    typedef typename Graph::ArcNotifier Type;
... ...
@@ -86,3 +85,3 @@
86 85
  public:
87
    
86

	
88 87
    typedef _Graph Graph;
... ...
@@ -97,4 +96,4 @@
97 96
    public:
98
      typedef typename Graph::template ArcMap<_Value> Parent; 
99
      typedef typename Graph::template ArcMap<_Value> Type; 
97
      typedef typename Graph::template ArcMap<_Value> Parent;
98
      typedef typename Graph::template ArcMap<_Value> Type;
100 99
      typedef typename Parent::Value Value;
... ...
@@ -102,4 +101,4 @@
102 101
      Map(const Graph& _digraph) : Parent(_digraph) {}
103
      Map(const Graph& _digraph, const Value& _value) 
104
	: Parent(_digraph, _value) {}
102
      Map(const Graph& _digraph, const Value& _value)
103
        : Parent(_digraph, _value) {}
105 104
    };
... ...
@@ -114,5 +113,5 @@
114 113
  struct EdgeNotifierIndicator<
115
    Graph, 
114
    Graph,
116 115
    typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
117
  > { 
116
  > {
118 117
    typedef typename Graph::EdgeNotifier Type;
... ...
@@ -123,3 +122,3 @@
123 122
  public:
124
    
123

	
125 124
    typedef _Graph Graph;
... ...
@@ -134,4 +133,4 @@
134 133
    public:
135
      typedef typename Graph::template EdgeMap<_Value> Parent; 
136
      typedef typename Graph::template EdgeMap<_Value> Type; 
134
      typedef typename Graph::template EdgeMap<_Value> Parent;
135
      typedef typename Graph::template EdgeMap<_Value> Type;
137 136
      typedef typename Parent::Value Value;
... ...
@@ -139,4 +138,4 @@
139 138
      Map(const Graph& _digraph) : Parent(_digraph) {}
140
      Map(const Graph& _digraph, const Value& _value) 
141
	: Parent(_digraph, _value) {}
139
      Map(const Graph& _digraph, const Value& _value)
140
        : Parent(_digraph, _value) {}
142 141
    };
... ...
@@ -158,6 +157,6 @@
158 157
  struct MapTraits<
159
    Map, typename enable_if<typename Map::ReferenceMapTag, void>::type > 
158
    Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
160 159
  {
161 160
    typedef True ReferenceMapTag;
162
    
161

	
163 162
    typedef typename Map::Key Key;
... ...
@@ -168,3 +167,3 @@
168 167

	
169
    typedef typename Map::ConstReference ConstReference; 
168
    typedef typename Map::ConstReference ConstReference;
170 169
    typedef typename Map::Reference Reference;
... ...
@@ -186,7 +185,7 @@
186 185
  struct MatrixMapTraits<
187
    MatrixMap, typename enable_if<typename MatrixMap::ReferenceMapTag, 
188
                                  void>::type > 
186
    MatrixMap, typename enable_if<typename MatrixMap::ReferenceMapTag,
187
                                  void>::type >
189 188
  {
190 189
    typedef True ReferenceMapTag;
191
    
190

	
192 191
    typedef typename MatrixMap::FirstKey FirstKey;
... ...
@@ -198,3 +197,3 @@
198 197

	
199
    typedef typename MatrixMap::ConstReference ConstReference; 
198
    typedef typename MatrixMap::ConstReference ConstReference;
200 199
    typedef typename MatrixMap::Reference Reference;
... ...
@@ -211,3 +210,3 @@
211 210
  struct NodeNumTagIndicator<
212
    Graph, 
211
    Graph,
213 212
    typename enable_if<typename Graph::NodeNumTag, void>::type
... ...
@@ -224,3 +223,3 @@
224 223
  struct EdgeNumTagIndicator<
225
    Graph, 
224
    Graph,
226 225
    typename enable_if<typename Graph::EdgeNumTag, void>::type
... ...
@@ -237,3 +236,3 @@
237 236
  struct FindEdgeTagIndicator<
238
    Graph, 
237
    Graph,
239 238
    typename enable_if<typename Graph::FindEdgeTag, void>::type
... ...
@@ -250,3 +249,3 @@
250 249
  struct UndirectedTagIndicator<
251
    Graph, 
250
    Graph,
252 251
    typename enable_if<typename Graph::UndirectedTag, void>::type
... ...
@@ -263,3 +262,3 @@
263 262
  struct BuildTagIndicator<
264
    Graph, 
263
    Graph,
265 264
    typename enable_if<typename Graph::BuildTag, void>::type
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -85,3 +85,3 @@
85 85
  /**************** enable_if from BOOST ****************/
86
  
86

	
87 87
  template <typename Type, typename T = void>
... ...
@@ -91,3 +91,3 @@
91 91

	
92
 
92

	
93 93
  template <bool B, class T = void>
... ...
@@ -100,3 +100,3 @@
100 100

	
101
  template <class Cond, class T = void> 
101
  template <class Cond, class T = void>
102 102
  struct enable_if : public enable_if_c<Cond::value, T> {};
... ...
@@ -111,3 +111,3 @@
111 111

	
112
  template <class Cond, class T> 
112
  template <class Cond, class T>
113 113
  struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
... ...
@@ -123,3 +123,3 @@
123 123

	
124
  template <class Cond, class T = void> 
124
  template <class Cond, class T = void>
125 125
  struct disable_if : public disable_if_c<Cond::value, T> {};
... ...
@@ -134,3 +134,3 @@
134 134

	
135
  template <class Cond, class T> 
135
  template <class Cond, class T>
136 136
  struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -51,8 +51,8 @@
51 51
  template <typename _Graph, typename _Item, typename _Value>
52
  class VectorMap 
52
  class VectorMap
53 53
    : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
54 54
  private:
55
		
55

	
56 56
    /// The container type of the map.
57
    typedef std::vector<_Value> Container;	
57
    typedef std::vector<_Value> Container;
58 58

	
... ...
@@ -60,3 +60,3 @@
60 60

	
61
    /// The graph type of the map. 
61
    /// The graph type of the map.
62 62
    typedef _Graph Graph;
... ...
@@ -95,5 +95,5 @@
95 95

	
96
    /// \brief Constructor uses given value to initialize the map. 
96
    /// \brief Constructor uses given value to initialize the map.
97 97
    ///
98
    /// It constructs a map uses a given value to initialize the map. 
98
    /// It constructs a map uses a given value to initialize the map.
99 99
    /// It adds all the items of the graph to the map.
... ...
@@ -109,4 +109,4 @@
109 109
      if (_copy.attached()) {
110
	Parent::attach(*_copy.notifier());
111
	container = _copy.container;
110
        Parent::attach(*_copy.notifier());
111
        container = _copy.container;
112 112
      }
... ...
@@ -117,6 +117,6 @@
117 117
    /// This operator assigns for each item in the map the
118
    /// value mapped to the same item in the copied map.  
118
    /// value mapped to the same item in the copied map.
119 119
    /// The parameter map should be indiced with the same
120 120
    /// itemset because this assign operator does not change
121
    /// the container of the map. 
121
    /// the container of the map.
122 122
    VectorMap& operator=(const VectorMap& cmap) {
... ...
@@ -131,3 +131,3 @@
131 131
    /// the NodeMap. In this case the value for each item
132
    /// is assigned by the value of the given ReadMap. 
132
    /// is assigned by the value of the given ReadMap.
133 133
    template <typename CMap>
... ...
@@ -142,3 +142,3 @@
142 142
    }
143
    
143

	
144 144
  public:
... ...
@@ -148,7 +148,7 @@
148 148
    /// The subscript operator. The map can be subscripted by the
149
    /// actual items of the graph.      
149
    /// actual items of the graph.
150 150
    Reference operator[](const Key& key) {
151 151
      return container[Parent::notifier()->id(key)];
152
    } 
153
		
152
    }
153

	
154 154
    /// \brief The const subcript operator.
... ...
@@ -156,3 +156,3 @@
156 156
    /// The const subscript operator. The map can be subscripted by the
157
    /// actual items of the graph. 
157
    /// actual items of the graph.
158 158
    ConstReference operator[](const Key& key) const {
... ...
@@ -172,5 +172,5 @@
172 172
    /// \brief Adds a new key to the map.
173
    ///		
173
    ///
174 174
    /// It adds a new key to the map. It called by the observer notifier
175
    /// and it overrides the add() member function of the observer base.     
175
    /// and it overrides the add() member function of the observer base.
176 176
    virtual void add(const Key& key) {
... ...
@@ -178,3 +178,3 @@
178 178
      if (id >= int(container.size())) {
179
	container.resize(id + 1);
179
        container.resize(id + 1);
180 180
      }
... ...
@@ -183,5 +183,5 @@
183 183
    /// \brief Adds more new keys to the map.
184
    ///		
184
    ///
185 185
    /// It adds more new keys to the map. It called by the observer notifier
186
    /// and it overrides the add() member function of the observer base.     
186
    /// and it overrides the add() member function of the observer base.
187 187
    virtual void add(const std::vector<Key>& keys) {
... ...
@@ -200,3 +200,3 @@
200 200
    /// Erase a key from the map. It called by the observer notifier
201
    /// and it overrides the erase() member function of the observer base.     
201
    /// and it overrides the erase() member function of the observer base.
202 202
    virtual void erase(const Key& key) {
... ...
@@ -208,14 +208,14 @@
208 208
    /// Erase more keys from the map. It called by the observer notifier
209
    /// and it overrides the erase() member function of the observer base.     
209
    /// and it overrides the erase() member function of the observer base.
210 210
    virtual void erase(const std::vector<Key>& keys) {
211 211
      for (int i = 0; i < int(keys.size()); ++i) {
212
	container[Parent::notifier()->id(keys[i])] = Value();
212
        container[Parent::notifier()->id(keys[i])] = Value();
213 213
      }
214 214
    }
215
    
215

	
216 216
    /// \brief Buildes the map.
217
    ///	
217
    ///
218 218
    /// It buildes the map. It called by the observer notifier
219 219
    /// and it overrides the build() member function of the observer base.
220
    virtual void build() { 
220
    virtual void build() {
221 221
      int size = Parent::notifier()->maxId() + 1;
... ...
@@ -228,9 +228,9 @@
228 228
    /// It erase all items from the map. It called by the observer notifier
229
    /// and it overrides the clear() member function of the observer base.     
230
    virtual void clear() { 
229
    /// and it overrides the clear() member function of the observer base.
230
    virtual void clear() {
231 231
      container.clear();
232 232
    }
233
    
233

	
234 234
  private:
235
		
235

	
236 236
    Container container;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -26,3 +26,3 @@
26 26
  const Color WHITE(1,1,1);
27
  
27

	
28 28
  const Color BLACK(0,0,0);
... ...
@@ -42,3 +42,3 @@
42 42
  const Color DARK_CYAN(0,.5,.5);
43
    
43

	
44 44
} //namespace lemon
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -64,3 +64,3 @@
64 64
  /// White color constant
65
  extern const Color WHITE;  
65
  extern const Color WHITE;
66 66
  /// Black color constant
... ...
@@ -132,3 +132,3 @@
132 132
        colors.push_back(Color(0,1,1));
133
      
133

	
134 134
        colors.push_back(Color(.5,0,0));
... ...
@@ -139,3 +139,3 @@
139 139
        colors.push_back(Color(0,.5,.5));
140
      
140

	
141 141
        colors.push_back(Color(.5,.5,.5));
... ...
@@ -147,3 +147,3 @@
147 147
        colors.push_back(Color(.5,1,1));
148
      
148

	
149 149
        colors.push_back(Color(1,.5,0));
... ...
@@ -173,3 +173,3 @@
173 173
    ///Adds a new color to the end of the color list.
174
    void add(const Color &c) 
174
    void add(const Color &c)
175 175
    {
... ...
@@ -188,3 +188,3 @@
188 188
  ///as it is possible.
189
  inline Color distantColor(const Color &c) 
189
  inline Color distantColor(const Color &c)
190 190
  {
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -38,3 +38,3 @@
38 38
///
39
///\todo Are we still using BOOST concept checking utility? 
39
///\todo Are we still using BOOST concept checking utility?
40 40
///Is the BOOST copyright notice necessary?
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -48,3 +48,3 @@
48 48
      ///Digraphs are \e not copy constructible. Use DigraphCopy() instead.
49
      
49

	
50 50
      ///Digraphs are \e not copy constructible. Use DigraphCopy() instead.
... ...
@@ -54,3 +54,3 @@
54 54
      ///\e not allowed. Use DigraphCopy() instead.
55
      
55

	
56 56
      ///Assignment of \ref Digraph "Digraph"s to another ones are
... ...
@@ -97,3 +97,3 @@
97 97
        /// Inequality operator
98
        
98

	
99 99
        /// \sa operator==(Node n)
... ...
@@ -102,14 +102,14 @@
102 102

	
103
	/// Artificial ordering operator.
104
	
105
	/// To allow the use of digraph descriptors as key type in std::map or
106
	/// similar associative container we require this.
107
	///
108
	/// \note This operator only have to define some strict ordering of
109
	/// the items; this order has nothing to do with the iteration
110
	/// ordering of the items.
111
	bool operator<(Node) const { return false; }
103
        /// Artificial ordering operator.
104

	
105
        /// To allow the use of digraph descriptors as key type in std::map or
106
        /// similar associative container we require this.
107
        ///
108
        /// \note This operator only have to define some strict ordering of
109
        /// the items; this order has nothing to do with the iteration
110
        /// ordering of the items.
111
        bool operator<(Node) const { return false; }
112 112

	
113 113
      };
114
    
114

	
115 115
      /// This iterator goes through each node.
... ...
@@ -131,3 +131,3 @@
131 131
        /// Copy constructor.
132
        
132

	
133 133
        /// Copy constructor.
... ...
@@ -147,5 +147,5 @@
147 147

	
148
        /// Sets the iterator to the node of \c the digraph pointed by 
149
	/// the trivial iterator.
150
        /// This feature necessitates that each time we 
148
        /// Sets the iterator to the node of \c the digraph pointed by
149
        /// the trivial iterator.
150
        /// This feature necessitates that each time we
151 151
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -158,4 +158,4 @@
158 158
      };
159
    
160
    
159

	
160

	
161 161
      /// Class for identifying an arc of the digraph
... ...
@@ -193,13 +193,13 @@
193 193

	
194
	/// Artificial ordering operator.
195
	
196
	/// To allow the use of digraph descriptors as key type in std::map or
197
	/// similar associative container we require this.
198
	///
199
	/// \note This operator only have to define some strict ordering of
200
	/// the items; this order has nothing to do with the iteration
201
	/// ordering of the items.
202
	bool operator<(Arc) const { return false; }
194
        /// Artificial ordering operator.
195

	
196
        /// To allow the use of digraph descriptors as key type in std::map or
197
        /// similar associative container we require this.
198
        ///
199
        /// \note This operator only have to define some strict ordering of
200
        /// the items; this order has nothing to do with the iteration
201
        /// ordering of the items.
202
        bool operator<(Arc) const { return false; }
203 203
      };
204
    
204

	
205 205
      /// This iterator goes trough the outgoing arcs of a node.
... ...
@@ -215,3 +215,3 @@
215 215
      ///\endcode
216
    
216

	
217 217
      class OutArcIt : public Arc {
... ...
@@ -234,3 +234,3 @@
234 234
        /// This constructor sets the iterator to the first outgoing arc.
235
    
235

	
236 236
        /// This constructor sets the iterator to the first outgoing arc of
... ...
@@ -241,3 +241,3 @@
241 241
        /// Sets the iterator to the value of the trivial iterator.
242
	/// This feature necessitates that each time we 
242
        /// This feature necessitates that each time we
243 243
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -245,4 +245,4 @@
245 245
        ///Next outgoing arc
246
        
247
        /// Assign the iterator to the next 
246

	
247
        /// Assign the iterator to the next
248 248
        /// outgoing arc of the corresponding node.
... ...
@@ -281,3 +281,3 @@
281 281
        /// This constructor sets the iterator to first incoming arc.
282
    
282

	
283 283
        /// This constructor set the iterator to the first incoming arc of
... ...
@@ -288,3 +288,3 @@
288 288
        /// Sets the iterator to the value of the trivial iterator \c e.
289
        /// This feature necessitates that each time we 
289
        /// This feature necessitates that each time we
290 290
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -324,3 +324,3 @@
324 324
        /// This constructor sets the iterator to the first arc.
325
    
325

	
326 326
        /// This constructor sets the iterator to the first arc of \c g.
... ...
@@ -331,7 +331,7 @@
331 331
        /// Sets the iterator to the value of the trivial iterator \c e.
332
        /// This feature necessitates that each time we 
332
        /// This feature necessitates that each time we
333 333
        /// iterate the arc-set, the iteration order is the same.
334
        ArcIt(const Digraph&, const Arc&) { } 
334
        ArcIt(const Digraph&, const Arc&) { }
335 335
        ///Next arc
336
        
336

	
337 337
        /// Assign the iterator to the next arc.
... ...
@@ -351,6 +351,6 @@
351 351
      /// \brief Returns the ID of the node.
352
      int id(Node) const { return -1; } 
352
      int id(Node) const { return -1; }
353 353

	
354 354
      /// \brief Returns the ID of the arc.
355
      int id(Arc) const { return -1; } 
355
      int id(Arc) const { return -1; }
356 356

	
... ...
@@ -359,3 +359,3 @@
359 359
      /// \pre The argument should be a valid node ID in the graph.
360
      Node nodeFromId(int) const { return INVALID; } 
360
      Node nodeFromId(int) const { return INVALID; }
361 361

	
... ...
@@ -364,9 +364,9 @@
364 364
      /// \pre The argument should be a valid arc ID in the graph.
365
      Arc arcFromId(int) const { return INVALID; } 
365
      Arc arcFromId(int) const { return INVALID; }
366 366

	
367 367
      /// \brief Returns an upper bound on the node IDs.
368
      int maxNodeId() const { return -1; } 
368
      int maxNodeId() const { return -1; }
369 369

	
370 370
      /// \brief Returns an upper bound on the arc IDs.
371
      int maxArcId() const { return -1; } 
371
      int maxArcId() const { return -1; }
372 372

	
... ...
@@ -391,5 +391,5 @@
391 391
      // Dummy parameter.
392
      int maxId(Node) const { return -1; } 
392
      int maxId(Node) const { return -1; }
393 393
      // Dummy parameter.
394
      int maxId(Arc) const { return -1; } 
394
      int maxId(Arc) const { return -1; }
395 395

	
... ...
@@ -425,6 +425,6 @@
425 425
      /// \brief Read write map of the nodes to type \c T.
426
      /// 
426
      ///
427 427
      /// ReadWrite map of the nodes to type \c T.
428 428
      /// \sa Reference
429
      template<class T> 
429
      template<class T>
430 430
      class NodeMap : public ReadWriteMap< Node, T > {
... ...
@@ -441,5 +441,5 @@
441 441
        template <typename CMap>
442
        NodeMap& operator=(const CMap&) { 
442
        NodeMap& operator=(const CMap&) {
443 443
          checkConcept<ReadMap<Node, T>, CMap>();
444
          return *this; 
444
          return *this;
445 445
        }
... ...
@@ -451,3 +451,3 @@
451 451
      /// \sa Reference
452
      template<class T> 
452
      template<class T>
453 453
      class ArcMap : public ReadWriteMap<Arc,T> {
... ...
@@ -463,5 +463,5 @@
463 463
        template <typename CMap>
464
        ArcMap& operator=(const CMap&) { 
464
        ArcMap& operator=(const CMap&) {
465 465
          checkConcept<ReadMap<Arc, T>, CMap>();
466
          return *this; 
466
          return *this;
467 467
        }
... ...
@@ -473,3 +473,3 @@
473 473
          checkConcept<IterableDigraphComponent<>, _Digraph>();
474
	  checkConcept<IDableDigraphComponent<>, _Digraph>();
474
          checkConcept<IDableDigraphComponent<>, _Digraph>();
475 475
          checkConcept<MappableDigraphComponent<>, _Digraph>();
... ...
@@ -479,4 +479,4 @@
479 479
    };
480
    
481
  } //namespace concepts  
480

	
481
  } //namespace concepts
482 482
} //namespace lemon
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -67,3 +67,3 @@
67 67
    /// as the OutArcIt and InArcIt but it is not convertible to Arc just
68
    /// to Edge.  
68
    /// to Edge.
69 69
    class Graph {
... ...
@@ -74,7 +74,7 @@
74 74
      /// The undirected graph should be tagged by the UndirectedTag. This
75
      /// tag helps the enable_if technics to make compile time 
76
      /// specializations for undirected graphs.  
75
      /// tag helps the enable_if technics to make compile time
76
      /// specializations for undirected graphs.
77 77
      typedef True UndirectedTag;
78 78

	
79
      /// \brief The base type of node iterators, 
79
      /// \brief The base type of node iterators,
80 80
      /// or in other words, the trivial node iterator.
... ...
@@ -83,3 +83,3 @@
83 83
      /// thus each kind of node iterator converts to this.
84
      /// More precisely each kind of node iterator should be inherited 
84
      /// More precisely each kind of node iterator should be inherited
85 85
      /// from the trivial node iterator.
... ...
@@ -110,3 +110,3 @@
110 110
        /// Inequality operator
111
        
111

	
112 112
        /// \sa operator==(Node n)
... ...
@@ -115,14 +115,14 @@
115 115

	
116
	/// Artificial ordering operator.
117
	
118
	/// To allow the use of graph descriptors as key type in std::map or
119
	/// similar associative container we require this.
120
	///
121
	/// \note This operator only have to define some strict ordering of
122
	/// the items; this order has nothing to do with the iteration
123
	/// ordering of the items.
124
	bool operator<(Node) const { return false; }
116
        /// Artificial ordering operator.
117

	
118
        /// To allow the use of graph descriptors as key type in std::map or
119
        /// similar associative container we require this.
120
        ///
121
        /// \note This operator only have to define some strict ordering of
122
        /// the items; this order has nothing to do with the iteration
123
        /// ordering of the items.
124
        bool operator<(Node) const { return false; }
125 125

	
126 126
      };
127
    
127

	
128 128
      /// This iterator goes through each node.
... ...
@@ -144,3 +144,3 @@
144 144
        /// Copy constructor.
145
        
145

	
146 146
        /// Copy constructor.
... ...
@@ -160,5 +160,5 @@
160 160

	
161
        /// Sets the iterator to the node of \c the graph pointed by 
162
	/// the trivial iterator.
163
        /// This feature necessitates that each time we 
161
        /// Sets the iterator to the node of \c the graph pointed by
162
        /// the trivial iterator.
163
        /// This feature necessitates that each time we
164 164
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -171,4 +171,4 @@
171 171
      };
172
    
173
    
172

	
173

	
174 174
      /// The base type of the edge iterators.
... ...
@@ -205,11 +205,11 @@
205 205

	
206
	/// Artificial ordering operator.
207
	
208
	/// To allow the use of graph descriptors as key type in std::map or
209
	/// similar associative container we require this.
210
	///
211
	/// \note This operator only have to define some strict ordering of
212
	/// the items; this order has nothing to do with the iteration
213
	/// ordering of the items.
214
	bool operator<(Edge) const { return false; }
206
        /// Artificial ordering operator.
207

	
208
        /// To allow the use of graph descriptors as key type in std::map or
209
        /// similar associative container we require this.
210
        ///
211
        /// \note This operator only have to define some strict ordering of
212
        /// the items; this order has nothing to do with the iteration
213
        /// ordering of the items.
214
        bool operator<(Edge) const { return false; }
215 215
      };
... ...
@@ -243,3 +243,3 @@
243 243
        /// This constructor sets the iterator to the first edge.
244
    
244

	
245 245
        /// This constructor sets the iterator to the first edge.
... ...
@@ -250,7 +250,7 @@
250 250
        /// This feature necessitates that each time we
251
        /// iterate the edge-set, the iteration order is the 
252
	/// same.
253
        EdgeIt(const Graph&, const Edge&) { } 
251
        /// iterate the edge-set, the iteration order is the
252
        /// same.
253
        EdgeIt(const Graph&, const Edge&) { }
254 254
        /// Next edge
255
        
255

	
256 256
        /// Assign the iterator to the next edge.
... ...
@@ -259,3 +259,3 @@
259 259

	
260
      /// \brief This iterator goes trough the incident undirected 
260
      /// \brief This iterator goes trough the incident undirected
261 261
      /// arcs of a node.
... ...
@@ -263,8 +263,8 @@
263 263
      /// This iterator goes trough the incident edges
264
      /// of a certain node of a graph. You should assume that the 
264
      /// of a certain node of a graph. You should assume that the
265 265
      /// loop arcs will be iterated twice.
266
      /// 
266
      ///
267 267
      /// Its usage is quite simple, for example you can compute the
268 268
      /// degree (i.e. count the number of incident arcs of a node \c n
269
      /// in graph \c g of type \c Graph as follows. 
269
      /// in graph \c g of type \c Graph as follows.
270 270
      ///
... ...
@@ -292,3 +292,3 @@
292 292
        /// This constructor sets the iterator to first incident arc.
293
    
293

	
294 294
        /// This constructor set the iterator to the first incident arc of
... ...
@@ -299,3 +299,3 @@
299 299
        /// Sets the iterator to the value of the trivial iterator \c e.
300
        /// This feature necessitates that each time we 
300
        /// This feature necessitates that each time we
301 301
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -305,3 +305,3 @@
305 305
        /// Assign the iterator to the next incident arc
306
	/// of the corresponding node.
306
        /// of the corresponding node.
307 307
        IncEdgeIt& operator++() { return *this; }
... ...
@@ -342,13 +342,13 @@
342 342

	
343
	/// Artificial ordering operator.
344
	
345
	/// To allow the use of graph descriptors as key type in std::map or
346
	/// similar associative container we require this.
347
	///
348
	/// \note This operator only have to define some strict ordering of
349
	/// the items; this order has nothing to do with the iteration
350
	/// ordering of the items.
351
	bool operator<(Arc) const { return false; }
352
	
353
      }; 
343
        /// Artificial ordering operator.
344

	
345
        /// To allow the use of graph descriptors as key type in std::map or
346
        /// similar associative container we require this.
347
        ///
348
        /// \note This operator only have to define some strict ordering of
349
        /// the items; this order has nothing to do with the iteration
350
        /// ordering of the items.
351
        bool operator<(Arc) const { return false; }
352

	
353
      };
354 354
      /// This iterator goes through each directed arc.
... ...
@@ -380,3 +380,3 @@
380 380
        /// This constructor sets the iterator to the first arc.
381
    
381

	
382 382
        /// This constructor sets the iterator to the first arc of \c g.
... ...
@@ -387,7 +387,7 @@
387 387
        /// Sets the iterator to the value of the trivial iterator \c e.
388
        /// This feature necessitates that each time we 
388
        /// This feature necessitates that each time we
389 389
        /// iterate the arc-set, the iteration order is the same.
390
        ArcIt(const Graph&, const Arc&) { } 
390
        ArcIt(const Graph&, const Arc&) { }
391 391
        ///Next arc
392
        
392

	
393 393
        /// Assign the iterator to the next arc.
... ...
@@ -395,3 +395,3 @@
395 395
      };
396
   
396

	
397 397
      /// This iterator goes trough the outgoing directed arcs of a node.
... ...
@@ -407,3 +407,3 @@
407 407
      ///\endcode
408
    
408

	
409 409
      class OutArcIt : public Arc {
... ...
@@ -426,3 +426,3 @@
426 426
        /// This constructor sets the iterator to the first outgoing arc.
427
    
427

	
428 428
        /// This constructor sets the iterator to the first outgoing arc of
... ...
@@ -432,5 +432,5 @@
432 432
        OutArcIt(const Graph& n, const Node& g) {
433
	  ignore_unused_variable_warning(n);
434
	  ignore_unused_variable_warning(g);
435
	}
433
          ignore_unused_variable_warning(n);
434
          ignore_unused_variable_warning(g);
435
        }
436 436
        /// Arc -> OutArcIt conversion
... ...
@@ -438,3 +438,3 @@
438 438
        /// Sets the iterator to the value of the trivial iterator.
439
	/// This feature necessitates that each time we 
439
        /// This feature necessitates that each time we
440 440
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -442,4 +442,4 @@
442 442
        ///Next outgoing arc
443
        
444
        /// Assign the iterator to the next 
443

	
444
        /// Assign the iterator to the next
445 445
        /// outgoing arc of the corresponding node.
... ...
@@ -478,3 +478,3 @@
478 478
        /// This constructor sets the iterator to first incoming arc.
479
    
479

	
480 480
        /// This constructor set the iterator to the first incoming arc of
... ...
@@ -483,6 +483,6 @@
483 483
        ///@param g the graph
484
        InArcIt(const Graph& g, const Node& n) { 
485
	  ignore_unused_variable_warning(n);
486
	  ignore_unused_variable_warning(g);
487
	}
484
        InArcIt(const Graph& g, const Node& n) {
485
          ignore_unused_variable_warning(n);
486
          ignore_unused_variable_warning(g);
487
        }
488 488
        /// Arc -> InArcIt conversion
... ...
@@ -490,3 +490,3 @@
490 490
        /// Sets the iterator to the value of the trivial iterator \c e.
491
        /// This feature necessitates that each time we 
491
        /// This feature necessitates that each time we
492 492
        /// iterate the arc-set, the iteration order is the same.
... ...
@@ -501,6 +501,6 @@
501 501
      /// \brief Read write map of the nodes to type \c T.
502
      /// 
502
      ///
503 503
      /// ReadWrite map of the nodes to type \c T.
504 504
      /// \sa Reference
505
      template<class T> 
505
      template<class T>
506 506
      class NodeMap : public ReadWriteMap< Node, T >
... ...
@@ -518,5 +518,5 @@
518 518
        template <typename CMap>
519
        NodeMap& operator=(const CMap&) { 
519
        NodeMap& operator=(const CMap&) {
520 520
          checkConcept<ReadMap<Node, T>, CMap>();
521
          return *this; 
521
          return *this;
522 522
        }
... ...
@@ -528,3 +528,3 @@
528 528
      /// \sa Reference
529
      template<class T> 
529
      template<class T>
530 530
      class ArcMap : public ReadWriteMap<Arc,T>
... ...
@@ -541,5 +541,5 @@
541 541
        template <typename CMap>
542
        ArcMap& operator=(const CMap&) { 
542
        ArcMap& operator=(const CMap&) {
543 543
          checkConcept<ReadMap<Arc, T>, CMap>();
544
          return *this; 
544
          return *this;
545 545
        }
... ...
@@ -551,3 +551,3 @@
551 551
      /// \sa Reference
552
      template<class T> 
552
      template<class T>
553 553
      class EdgeMap : public ReadWriteMap<Edge,T>
... ...
@@ -564,5 +564,5 @@
564 564
        template <typename CMap>
565
        EdgeMap& operator=(const CMap&) { 
565
        EdgeMap& operator=(const CMap&) {
566 566
          checkConcept<ReadMap<Edge, T>, CMap>();
567
          return *this; 
567
          return *this;
568 568
        }
... ...
@@ -575,3 +575,3 @@
575 575
      Arc direct(const Edge&, const Node&) const {
576
	return INVALID;
576
        return INVALID;
577 577
      }
... ...
@@ -585,3 +585,3 @@
585 585
      Arc direct(const Edge&, bool) const {
586
	return INVALID;
586
        return INVALID;
587 587
      }
... ...
@@ -627,9 +627,9 @@
627 627
      /// \brief Returns the id of the node.
628
      int id(Node) const { return -1; } 
628
      int id(Node) const { return -1; }
629 629

	
630 630
      /// \brief Returns the id of the edge.
631
      int id(Edge) const { return -1; } 
631
      int id(Edge) const { return -1; }
632 632

	
633 633
      /// \brief Returns the id of the arc.
634
      int id(Arc) const { return -1; } 
634
      int id(Arc) const { return -1; }
635 635

	
... ...
@@ -638,3 +638,3 @@
638 638
      /// \pre The argument should be a valid node id in the graph.
639
      Node nodeFromId(int) const { return INVALID; } 
639
      Node nodeFromId(int) const { return INVALID; }
640 640

	
... ...
@@ -643,3 +643,3 @@
643 643
      /// \pre The argument should be a valid edge id in the graph.
644
      Edge edgeFromId(int) const { return INVALID; } 
644
      Edge edgeFromId(int) const { return INVALID; }
645 645

	
... ...
@@ -648,12 +648,12 @@
648 648
      /// \pre The argument should be a valid arc id in the graph.
649
      Arc arcFromId(int) const { return INVALID; } 
649
      Arc arcFromId(int) const { return INVALID; }
650 650

	
651 651
      /// \brief Returns an upper bound on the node IDs.
652
      int maxNodeId() const { return -1; } 
652
      int maxNodeId() const { return -1; }
653 653

	
654 654
      /// \brief Returns an upper bound on the edge IDs.
655
      int maxEdgeId() const { return -1; } 
655
      int maxEdgeId() const { return -1; }
656 656

	
657 657
      /// \brief Returns an upper bound on the arc IDs.
658
      int maxArcId() const { return -1; } 
658
      int maxArcId() const { return -1; }
659 659

	
... ...
@@ -685,7 +685,7 @@
685 685
      // Dummy parameter.
686
      int maxId(Node) const { return -1; } 
686
      int maxId(Node) const { return -1; }
687 687
      // Dummy parameter.
688
      int maxId(Edge) const { return -1; } 
688
      int maxId(Edge) const { return -1; }
689 689
      // Dummy parameter.
690
      int maxId(Arc) const { return -1; } 
690
      int maxId(Arc) const { return -1; }
691 691

	
... ...
@@ -695,3 +695,3 @@
695 695
      Node baseNode(OutArcIt e) const {
696
	return source(e);
696
        return source(e);
697 697
      }
... ...
@@ -702,3 +702,3 @@
702 702
      Node runningNode(OutArcIt e) const {
703
	return target(e);
703
        return target(e);
704 704
      }
... ...
@@ -709,3 +709,3 @@
709 709
      Node baseNode(InArcIt e) const {
710
	return target(e);
710
        return target(e);
711 711
      }
... ...
@@ -716,3 +716,3 @@
716 716
      Node runningNode(InArcIt e) const {
717
	return source(e);
717
        return source(e);
718 718
      }
... ...
@@ -723,5 +723,5 @@
723 723
      Node baseNode(IncEdgeIt) const {
724
	return INVALID;
724
        return INVALID;
725 725
      }
726
      
726

	
727 727
      /// \brief Running node of the iterator
... ...
@@ -730,3 +730,3 @@
730 730
      Node runningNode(IncEdgeIt) const {
731
	return INVALID;
731
        return INVALID;
732 732
      }
... ...
@@ -735,7 +735,7 @@
735 735
      struct Constraints {
736
	void constraints() {
737
	  checkConcept<IterableGraphComponent<>, _Graph>();
738
	  checkConcept<IDableGraphComponent<>, _Graph>();
739
	  checkConcept<MappableGraphComponent<>, _Graph>();
740
	}
736
        void constraints() {
737
          checkConcept<IterableGraphComponent<>, _Graph>();
738
          checkConcept<IDableGraphComponent<>, _Graph>();
739
          checkConcept<MappableGraphComponent<>, _Graph>();
740
        }
741 741
      };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -51,3 +51,3 @@
51 51
      /// \brief Default constructor.
52
      ///      
52
      ///
53 53
      /// \warning The default constructor is not required to set
... ...
@@ -68,3 +68,3 @@
68 68
      ///
69
      /// The nodes are assignable. 
69
      /// The nodes are assignable.
70 70
      ///
... ...
@@ -94,18 +94,18 @@
94 94
      struct Constraints {
95
	void constraints() {
96
	  _GraphItem i1;
97
	  _GraphItem i2 = i1;
98
	  _GraphItem i3 = INVALID;
99
	  
100
	  i1 = i2 = i3;
95
        void constraints() {
96
          _GraphItem i1;
97
          _GraphItem i2 = i1;
98
          _GraphItem i3 = INVALID;
101 99

	
102
	  bool b;
103
	  //	  b = (ia == ib) && (ia != ib) && (ia < ib);
104
	  b = (ia == ib) && (ia != ib);
105
	  b = (ia == INVALID) && (ib != INVALID);
100
          i1 = i2 = i3;
101

	
102
          bool b;
103
          //          b = (ia == ib) && (ia != ib) && (ia < ib);
104
          b = (ia == ib) && (ia != ib);
105
          b = (ia == INVALID) && (ib != INVALID);
106 106
          b = (ia < ib);
107
	}
107
        }
108 108

	
109
	const _GraphItem &ia;
110
	const _GraphItem &ib;
109
        const _GraphItem &ia;
110
        const _GraphItem &ib;
111 111
      };
... ...
@@ -114,3 +114,3 @@
114 114
    /// \brief An empty base directed graph class.
115
    ///  
115
    ///
116 116
    /// This class provides the minimal set of features needed for a
... ...
@@ -124,6 +124,6 @@
124 124
      typedef BaseDigraphComponent Digraph;
125
      
125

	
126 126
      /// \brief Node class of the digraph.
127 127
      ///
128
      /// This class represents the Nodes of the digraph. 
128
      /// This class represents the Nodes of the digraph.
129 129
      ///
... ...
@@ -133,3 +133,3 @@
133 133
      ///
134
      /// This class represents the Arcs of the digraph. 
134
      /// This class represents the Arcs of the digraph.
135 135
      ///
... ...
@@ -158,18 +158,18 @@
158 158
      struct Constraints {
159
	typedef typename _Digraph::Node Node;
160
	typedef typename _Digraph::Arc Arc;
161
      
162
	void constraints() {
163
	  checkConcept<GraphItem<'n'>, Node>();
164
	  checkConcept<GraphItem<'a'>, Arc>();
165
	  {
166
	    Node n;
167
	    Arc e(INVALID);
168
	    n = digraph.source(e);
169
	    n = digraph.target(e);
159
        typedef typename _Digraph::Node Node;
160
        typedef typename _Digraph::Arc Arc;
161

	
162
        void constraints() {
163
          checkConcept<GraphItem<'n'>, Node>();
164
          checkConcept<GraphItem<'a'>, Arc>();
165
          {
166
            Node n;
167
            Arc e(INVALID);
168
            n = digraph.source(e);
169
            n = digraph.target(e);
170 170
            n = digraph.oppositeNode(n, e);
171
	  }      
172
	}
173
      
174
	const _Digraph& digraph;
171
          }
172
        }
173

	
174
        const _Digraph& digraph;
175 175
      };
... ...
@@ -178,3 +178,3 @@
178 178
    /// \brief An empty base undirected graph class.
179
    ///  
179
    ///
180 180
    /// This class provides the minimal set of features needed for an
... ...
@@ -201,3 +201,3 @@
201 201
        /// \brief Default constructor.
202
        ///      
202
        ///
203 203
        /// \warning The default constructor is not required to set
... ...
@@ -219,3 +219,3 @@
219 219
        /// Besides the core graph item functionality each arc should
220
        /// be convertible to the represented edge. 
220
        /// be convertible to the represented edge.
221 221
        Edge(const Arc&) {}
... ...
@@ -224,3 +224,3 @@
224 224
        /// Besides the core graph item functionality each arc should
225
        /// be convertible to the represented edge. 
225
        /// be convertible to the represented edge.
226 226
        Edge& operator=(const Arc&) { return *this; }
... ...
@@ -239,3 +239,3 @@
239 239
      /// represented edge.
240
      Arc direct(const Edge&, bool) const { return INVALID;} 
240
      Arc direct(const Edge&, bool) const { return INVALID;}
241 241

	
... ...
@@ -245,3 +245,3 @@
245 245
      /// represented edge.
246
      Arc direct(const Edge&, const Node&) const { return INVALID;} 
246
      Arc direct(const Edge&, const Node&) const { return INVALID;}
247 247

	
... ...
@@ -262,18 +262,18 @@
262 262
      Node v(const Edge&) const { return INVALID;}
263
      
263

	
264 264
      template <typename _Graph>
265 265
      struct Constraints {
266
	typedef typename _Graph::Node Node;
267
	typedef typename _Graph::Arc Arc;
268
	typedef typename _Graph::Edge Edge;
269
      
270
	void constraints() {
266
        typedef typename _Graph::Node Node;
267
        typedef typename _Graph::Arc Arc;
268
        typedef typename _Graph::Edge Edge;
269

	
270
        void constraints() {
271 271
          checkConcept<BaseDigraphComponent, _Graph>();
272
	  checkConcept<GraphItem<'u'>, Edge>();
273
	  {
274
	    Node n;
275
	    Edge ue(INVALID);
272
          checkConcept<GraphItem<'u'>, Edge>();
273
          {
274
            Node n;
275
            Edge ue(INVALID);
276 276
            Arc e;
277
	    n = graph.u(ue);
278
	    n = graph.v(ue);
277
            n = graph.u(ue);
278
            n = graph.v(ue);
279 279
            e = graph.direct(ue, true);
... ...
@@ -284,6 +284,6 @@
284 284
            ignore_unused_variable_warning(d);
285
	  }      
286
	}
287
      
288
	const _Graph& graph;
285
          }
286
        }
287

	
288
        const _Graph& graph;
289 289
      };
... ...
@@ -293,3 +293,3 @@
293 293
    /// \brief An empty idable base digraph class.
294
    ///  
294
    ///
295 295
    /// This class provides beside the core digraph features
... ...
@@ -306,5 +306,5 @@
306 306

	
307
      /// \brief Gives back an unique integer id for the Node. 
307
      /// \brief Gives back an unique integer id for the Node.
308 308
      ///
309
      /// Gives back an unique integer id for the Node. 
309
      /// Gives back an unique integer id for the Node.
310 310
      ///
... ...
@@ -316,8 +316,8 @@
316 316
      /// If the digraph does not contain node with the given id
317
      /// then the result of the function is undetermined. 
317
      /// then the result of the function is undetermined.
318 318
      Node nodeFromId(int) const { return INVALID;}
319 319

	
320
      /// \brief Gives back an unique integer id for the Arc. 
320
      /// \brief Gives back an unique integer id for the Arc.
321 321
      ///
322
      /// Gives back an unique integer id for the Arc. 
322
      /// Gives back an unique integer id for the Arc.
323 323
      ///
... ...
@@ -329,3 +329,3 @@
329 329
      /// If the digraph does not contain arc with the given id
330
      /// then the result of the function is undetermined. 
330
      /// then the result of the function is undetermined.
331 331
      Arc arcFromId(int) const { return INVALID;}
... ...
@@ -349,20 +349,20 @@
349 349

	
350
	void constraints() {
351
	  checkConcept<Base, _Digraph >();
352
	  typename _Digraph::Node node;
353
	  int nid = digraph.id(node);
354
	  nid = digraph.id(node);
355
	  node = digraph.nodeFromId(nid);
356
	  typename _Digraph::Arc arc;
357
	  int eid = digraph.id(arc);
358
	  eid = digraph.id(arc);
359
	  arc = digraph.arcFromId(eid);
350
        void constraints() {
351
          checkConcept<Base, _Digraph >();
352
          typename _Digraph::Node node;
353
          int nid = digraph.id(node);
354
          nid = digraph.id(node);
355
          node = digraph.nodeFromId(nid);
356
          typename _Digraph::Arc arc;
357
          int eid = digraph.id(arc);
358
          eid = digraph.id(arc);
359
          arc = digraph.arcFromId(eid);
360 360

	
361
	  nid = digraph.maxNodeId();
362
	  ignore_unused_variable_warning(nid);
363
	  eid = digraph.maxArcId();
364
	  ignore_unused_variable_warning(eid);
365
	}
361
          nid = digraph.maxNodeId();
362
          ignore_unused_variable_warning(nid);
363
          eid = digraph.maxArcId();
364
          ignore_unused_variable_warning(eid);
365
        }
366 366

	
367
	const _Digraph& digraph;
367
        const _Digraph& digraph;
368 368
      };
... ...
@@ -371,3 +371,3 @@
371 371
    /// \brief An empty idable base undirected graph class.
372
    ///  
372
    ///
373 373
    /// This class provides beside the core undirected graph features
... ...
@@ -385,5 +385,5 @@
385 385

	
386
      /// \brief Gives back an unique integer id for the Edge. 
386
      /// \brief Gives back an unique integer id for the Edge.
387 387
      ///
388
      /// Gives back an unique integer id for the Edge. 
388
      /// Gives back an unique integer id for the Edge.
389 389
      ///
... ...
@@ -408,14 +408,14 @@
408 408

	
409
	void constraints() {
410
	  checkConcept<Base, _Graph >();
411
	  checkConcept<IDableDigraphComponent<Base>, _Graph >();
412
	  typename _Graph::Edge edge;
413
	  int ueid = graph.id(edge);
414
	  ueid = graph.id(edge);
415
	  edge = graph.edgeFromId(ueid);
416
	  ueid = graph.maxEdgeId();
417
	  ignore_unused_variable_warning(ueid);
418
	}
409
        void constraints() {
410
          checkConcept<Base, _Graph >();
411
          checkConcept<IDableDigraphComponent<Base>, _Graph >();
412
          typename _Graph::Edge edge;
413
          int ueid = graph.id(edge);
414
          ueid = graph.id(edge);
415
          edge = graph.edgeFromId(ueid);
416
          ueid = graph.maxEdgeId();
417
          ignore_unused_variable_warning(ueid);
418
        }
419 419

	
420
	const _Graph& graph;
420
        const _Graph& graph;
421 421
      };
... ...
@@ -452,7 +452,7 @@
452 452
      ///
453
      /// The items are assignable. 
453
      /// The items are assignable.
454 454
      ///
455
      GraphItemIt& operator=(const GraphItemIt&) { return *this; }      
455
      GraphItemIt& operator=(const GraphItemIt&) { return *this; }
456 456
      /// \brief Next item.
457
      /// 
457
      ///
458 458
      /// Assign the iterator to the next item.
... ...
@@ -461,3 +461,3 @@
461 461
      /// \brief Equality operator
462
      /// 
462
      ///
463 463
      /// Two iterators are equal if and only if they point to the
... ...
@@ -466,3 +466,3 @@
466 466
      /// \brief Inequality operator
467
      ///	
467
      ///
468 468
      /// \sa operator==(Node n)
... ...
@@ -470,17 +470,17 @@
470 470
      bool operator!=(const GraphItemIt&) const { return true;}
471
      
471

	
472 472
      template<typename _GraphItemIt>
473 473
      struct Constraints {
474
	void constraints() {
475
	  _GraphItemIt it1(g);	
476
	  _GraphItemIt it2;
474
        void constraints() {
475
          _GraphItemIt it1(g);
476
          _GraphItemIt it2;
477 477

	
478
	  it2 = ++it1;
479
	  ++it2 = it1;
480
	  ++(++it1);
478
          it2 = ++it1;
479
          ++it2 = it1;
480
          ++(++it1);
481 481

	
482
	  _Item bi = it1;
483
	  bi = it2;
484
	}
485
	_Graph& g;
482
          _Item bi = it1;
483
          bi = it2;
484
        }
485
        _Graph& g;
486 486
      };
... ...
@@ -491,9 +491,9 @@
491 491
    /// \note Because InArcIt and OutArcIt may not inherit from the same
492
    /// base class, the _selector is a additional template parameter. For 
493
    /// InArcIt you should instantiate it with character 'i' and for 
492
    /// base class, the _selector is a additional template parameter. For
493
    /// InArcIt you should instantiate it with character 'i' and for
494 494
    /// OutArcIt with 'o'.
495 495
    template <typename _Graph,
496
	      typename _Item = typename _Graph::Arc,
497
              typename _Base = typename _Graph::Node, 
498
	      char _selector = '0'>
496
              typename _Item = typename _Graph::Arc,
497
              typename _Base = typename _Graph::Node,
498
              char _selector = '0'>
499 499
    class GraphIncIt : public _Item {
... ...
@@ -510,6 +510,6 @@
510 510
      GraphIncIt(GraphIncIt const& gi) : _Item(gi) {}
511
      /// \brief Sets the iterator to the first arc incoming into or outgoing 
511
      /// \brief Sets the iterator to the first arc incoming into or outgoing
512 512
      /// from the node.
513 513
      ///
514
      /// Sets the iterator to the first arc incoming into or outgoing 
514
      /// Sets the iterator to the first arc incoming into or outgoing
515 515
      /// from the node.
... ...
@@ -524,5 +524,5 @@
524 524
      ///
525
      /// The iterators are assignable. 
525
      /// The iterators are assignable.
526 526
      ///
527
      GraphIncIt& operator=(GraphIncIt const&) { return *this; }      
527
      GraphIncIt& operator=(GraphIncIt const&) { return *this; }
528 528
      /// \brief Next item.
... ...
@@ -547,19 +547,19 @@
547 547
      struct Constraints {
548
	void constraints() {
549
	  checkConcept<GraphItem<_selector>, _GraphIncIt>();
550
	  _GraphIncIt it1(graph, node);
551
	  _GraphIncIt it2;
548
        void constraints() {
549
          checkConcept<GraphItem<_selector>, _GraphIncIt>();
550
          _GraphIncIt it1(graph, node);
551
          _GraphIncIt it2;
552 552

	
553
	  it2 = ++it1;
554
	  ++it2 = it1;
555
	  ++(++it1);
556
	  _Item e = it1;
557
	  e = it2;
553
          it2 = ++it1;
554
          ++it2 = it1;
555
          ++(++it1);
556
          _Item e = it1;
557
          e = it2;
558 558

	
559
	}
559
        }
560 560

	
561
	_Item arc;
562
	_Base node;
563
	_Graph graph;
564
	_GraphIncIt it;
561
        _Item arc;
562
        _Base node;
563
        _Graph graph;
564
        _GraphIncIt it;
565 565
      };
... ...
@@ -577,3 +577,3 @@
577 577
    public:
578
    
578

	
579 579
      typedef _Base Base;
... ...
@@ -585,11 +585,11 @@
585 585
      /// \name Base iteration
586
      /// 
586
      ///
587 587
      /// This interface provides functions for iteration on digraph items
588 588
      ///
589
      /// @{  
589
      /// @{
590 590

	
591 591
      /// \brief Gives back the first node in the iterating order.
592
      ///      
592
      ///
593 593
      /// Gives back the first node in the iterating order.
594
      ///     
594
      ///
595 595
      void first(Node&) const {}
... ...
@@ -599,3 +599,3 @@
599 599
      /// Gives back the next node in the iterating order.
600
      ///     
600
      ///
601 601
      void next(Node&) const {}
... ...
@@ -605,3 +605,3 @@
605 605
      /// Gives back the first arc in the iterating order.
606
      ///     
606
      ///
607 607
      void first(Arc&) const {}
... ...
@@ -611,3 +611,3 @@
611 611
      /// Gives back the next arc in the iterating order.
612
      ///     
612
      ///
613 613
      void next(Arc&) const {}
... ...
@@ -619,3 +619,3 @@
619 619
      /// Gives back the first of the arcs point to the given node.
620
      ///     
620
      ///
621 621
      void firstIn(Arc&, const Node&) const {}
... ...
@@ -631,5 +631,5 @@
631 631
      /// given node.
632
      ///      
632
      ///
633 633
      /// Gives back the first of the arcs start from the given node.
634
      ///     
634
      ///
635 635
      void firstOut(Arc&, const Node&) const {}
... ...
@@ -640,3 +640,3 @@
640 640
      /// Gives back the next of the arcs start from the given node.
641
      ///     
641
      ///
642 642
      void nextOut(Arc&) const {}
... ...
@@ -646,3 +646,3 @@
646 646
      /// \name Class based iteration
647
      /// 
647
      ///
648 648
      /// This interface provides functions for iteration on digraph items
... ...
@@ -701,9 +701,9 @@
701 701

	
702
      template <typename _Digraph> 
702
      template <typename _Digraph>
703 703
      struct Constraints {
704
	void constraints() {
705
	  checkConcept<Base, _Digraph>();
704
        void constraints() {
705
          checkConcept<Base, _Digraph>();
706 706

	
707 707
          {
708
            typename _Digraph::Node node(INVALID);      
708
            typename _Digraph::Node node(INVALID);
709 709
            typename _Digraph::Arc arc(INVALID);
... ...
@@ -725,3 +725,3 @@
725 725
            }
726
          }           
726
          }
727 727

	
... ...
@@ -732,5 +732,5 @@
732 732
              typename _Digraph::NodeIt >();
733
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc, 
733
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc,
734 734
              typename _Digraph::Node, 'i'>, typename _Digraph::InArcIt>();
735
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc, 
735
            checkConcept<GraphIncIt<_Digraph, typename _Digraph::Arc,
736 736
              typename _Digraph::Node, 'o'>, typename _Digraph::OutArcIt>();
... ...
@@ -747,5 +747,5 @@
747 747
        }
748
	
749
	const _Digraph& digraph;
750
	
748

	
749
        const _Digraph& digraph;
750

	
751 751
      };
... ...
@@ -767,3 +767,3 @@
767 767

	
768
    
768

	
769 769
      typedef IterableGraphComponent Graph;
... ...
@@ -771,5 +771,5 @@
771 771
      /// \name Base iteration
772
      /// 
772
      ///
773 773
      /// This interface provides functions for iteration on graph items
774
      /// @{  
774
      /// @{
775 775

	
... ...
@@ -782,3 +782,3 @@
782 782
      /// Gives back the first edge in the iterating order.
783
      ///     
783
      ///
784 784
      void first(Edge&) const {}
... ...
@@ -789,3 +789,3 @@
789 789
      /// Gives back the next edge in the iterating order.
790
      ///     
790
      ///
791 791
      void next(Edge&) const {}
... ...
@@ -816,3 +816,3 @@
816 816
      /// \name Class based iteration
817
      /// 
817
      ///
818 818
      /// This interface provides functions for iteration on graph items
... ...
@@ -843,6 +843,6 @@
843 843

	
844
      template <typename _Graph> 
844
      template <typename _Graph>
845 845
      struct Constraints {
846
	void constraints() {
847
	  checkConcept<IterableDigraphComponent<Base>, _Graph>();
846
        void constraints() {
847
          checkConcept<IterableDigraphComponent<Base>, _Graph>();
848 848

	
... ...
@@ -860,5 +860,5 @@
860 860
            }
861
            
862
          }	
863
  
861

	
862
          }
863

	
864 864
          {
... ...
@@ -866,5 +866,5 @@
866 866
              typename _Graph::EdgeIt >();
867
            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge, 
867
            checkConcept<GraphIncIt<_Graph, typename _Graph::Edge,
868 868
              typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>();
869
            
869

	
870 870
            typename _Graph::Node n;
... ...
@@ -875,5 +875,5 @@
875 875
        }
876
	
877
	const _Graph& graph;
878
	
876

	
877
        const _Graph& graph;
878

	
879 879
      };
... ...
@@ -882,3 +882,3 @@
882 882
    /// \brief An empty alteration notifier digraph class.
883
    ///  
883
    ///
884 884
    /// This class provides beside the core digraph features alteration
... ...
@@ -899,8 +899,8 @@
899 899
      /// The node observer registry.
900
      typedef AlterationNotifier<AlterableDigraphComponent, Node> 
900
      typedef AlterationNotifier<AlterableDigraphComponent, Node>
901 901
      NodeNotifier;
902 902
      /// The arc observer registry.
903
      typedef AlterationNotifier<AlterableDigraphComponent, Arc> 
903
      typedef AlterationNotifier<AlterableDigraphComponent, Arc>
904 904
      ArcNotifier;
905
      
905

	
906 906
      /// \brief Gives back the node alteration notifier.
... ...
@@ -909,5 +909,5 @@
909 909
      NodeNotifier& notifier(Node) const {
910
	return NodeNotifier();
910
        return NodeNotifier();
911 911
      }
912
      
912

	
913 913
      /// \brief Gives back the arc alteration notifier.
... ...
@@ -916,23 +916,23 @@
916 916
      ArcNotifier& notifier(Arc) const {
917
	return ArcNotifier();
917
        return ArcNotifier();
918 918
      }
919 919

	
920
      template <typename _Digraph> 
920
      template <typename _Digraph>
921 921
      struct Constraints {
922
	void constraints() {
923
	  checkConcept<Base, _Digraph>();
924
          typename _Digraph::NodeNotifier& nn 
922
        void constraints() {
923
          checkConcept<Base, _Digraph>();
924
          typename _Digraph::NodeNotifier& nn
925 925
            = digraph.notifier(typename _Digraph::Node());
926 926

	
927
          typename _Digraph::ArcNotifier& en 
927
          typename _Digraph::ArcNotifier& en
928 928
            = digraph.notifier(typename _Digraph::Arc());
929
          
929

	
930 930
          ignore_unused_variable_warning(nn);
931 931
          ignore_unused_variable_warning(en);
932
	}
933
	
934
	const _Digraph& digraph;
935
	
932
        }
933

	
934
        const _Digraph& digraph;
935

	
936 936
      };
937
      
937

	
938 938
    };
... ...
@@ -940,3 +940,3 @@
940 940
    /// \brief An empty alteration notifier undirected graph class.
941
    ///  
941
    ///
942 942
    /// This class provides beside the core graph features alteration
... ...
@@ -956,5 +956,5 @@
956 956
      /// The arc observer registry.
957
      typedef AlterationNotifier<AlterableGraphComponent, Edge> 
957
      typedef AlterationNotifier<AlterableGraphComponent, Edge>
958 958
      EdgeNotifier;
959
      
959

	
960 960
      /// \brief Gives back the arc alteration notifier.
... ...
@@ -963,18 +963,18 @@
963 963
      EdgeNotifier& notifier(Edge) const {
964
	return EdgeNotifier();
964
        return EdgeNotifier();
965 965
      }
966 966

	
967
      template <typename _Graph> 
967
      template <typename _Graph>
968 968
      struct Constraints {
969
	void constraints() {
970
	  checkConcept<AlterableGraphComponent<Base>, _Graph>();
971
          typename _Graph::EdgeNotifier& uen 
969
        void constraints() {
970
          checkConcept<AlterableGraphComponent<Base>, _Graph>();
971
          typename _Graph::EdgeNotifier& uen
972 972
            = graph.notifier(typename _Graph::Edge());
973 973
          ignore_unused_variable_warning(uen);
974
	}
975
	
976
	const _Graph& graph;
977
	
974
        }
975

	
976
        const _Graph& graph;
977

	
978 978
      };
979
      
979

	
980 980
    };
... ...
@@ -982,3 +982,3 @@
982 982
    /// \brief Class describing the concept of graph maps
983
    /// 
983
    ///
984 984
    /// This class describes the common interface of the graph maps
... ...
@@ -1011,3 +1011,3 @@
1011 1011
      GraphMap(const GraphMap&) : Parent() {}
1012
      
1012

	
1013 1013
      /// \brief Assign operator.
... ...
@@ -1016,5 +1016,5 @@
1016 1016
      /// it just iterates on the current item set and set the  map
1017
      /// with the value returned by the assigned map. 
1017
      /// with the value returned by the assigned map.
1018 1018
      template <typename CMap>
1019
      GraphMap& operator=(const CMap&) { 
1019
      GraphMap& operator=(const CMap&) {
1020 1020
        checkConcept<ReadMap<Key, Value>, CMap>();
... ...
@@ -1025,11 +1025,11 @@
1025 1025
      struct Constraints {
1026
	void constraints() {
1027
	  checkConcept<ReadWriteMap<Key, Value>, _Map >();
1028
	  // Construction with a graph parameter
1029
	  _Map a(g);
1030
	  // Constructor with a graph and a default value parameter
1031
	  _Map a2(g,t);
1032
	  // Copy constructor.
1033
	  _Map b(c);
1034
          
1026
        void constraints() {
1027
          checkConcept<ReadWriteMap<Key, Value>, _Map >();
1028
          // Construction with a graph parameter
1029
          _Map a(g);
1030
          // Constructor with a graph and a default value parameter
1031
          _Map a2(g,t);
1032
          // Copy constructor.
1033
          _Map b(c);
1034

	
1035 1035
          ReadMap<Key, Value> cmap;
... ...
@@ -1037,9 +1037,9 @@
1037 1037

	
1038
	  ignore_unused_variable_warning(a2);
1039
	  ignore_unused_variable_warning(b);
1040
	}
1038
          ignore_unused_variable_warning(a2);
1039
          ignore_unused_variable_warning(b);
1040
        }
1041 1041

	
1042
	const _Map &c;
1043
	const Graph &g;
1044
	const typename GraphMap::Value &t;
1042
        const _Map &c;
1043
        const Graph &g;
1044
        const typename GraphMap::Value &t;
1045 1045
      };
... ...
@@ -1072,24 +1072,24 @@
1072 1072

	
1073
	/// \brief Construct a new map.
1074
	///
1075
	/// Construct a new map for the digraph.
1076
	explicit NodeMap(const MappableDigraphComponent& digraph) 
1073
        /// \brief Construct a new map.
1074
        ///
1075
        /// Construct a new map for the digraph.
1076
        explicit NodeMap(const MappableDigraphComponent& digraph)
1077 1077
          : Parent(digraph) {}
1078 1078

	
1079
	/// \brief Construct a new map with default value.
1080
	///
1081
	/// Construct a new map for the digraph and initalise the values.
1082
	NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
1079
        /// \brief Construct a new map with default value.
1080
        ///
1081
        /// Construct a new map for the digraph and initalise the values.
1082
        NodeMap(const MappableDigraphComponent& digraph, const _Value& value)
1083 1083
          : Parent(digraph, value) {}
1084 1084

	
1085
	/// \brief Copy constructor.
1086
	///
1087
	/// Copy Constructor.
1088
	NodeMap(const NodeMap& nm) : Parent(nm) {}
1085
        /// \brief Copy constructor.
1086
        ///
1087
        /// Copy Constructor.
1088
        NodeMap(const NodeMap& nm) : Parent(nm) {}
1089 1089

	
1090
	/// \brief Assign operator.
1091
	///
1092
	/// Assign operator.
1090
        /// \brief Assign operator.
1091
        ///
1092
        /// Assign operator.
1093 1093
        template <typename CMap>
1094
        NodeMap& operator=(const CMap&) { 
1094
        NodeMap& operator=(const CMap&) {
1095 1095
          checkConcept<ReadMap<Node, _Value>, CMap>();
... ...
@@ -1109,24 +1109,24 @@
1109 1109

	
1110
	/// \brief Construct a new map.
1111
	///
1112
	/// Construct a new map for the digraph.
1113
	explicit ArcMap(const MappableDigraphComponent& digraph) 
1110
        /// \brief Construct a new map.
1111
        ///
1112
        /// Construct a new map for the digraph.
1113
        explicit ArcMap(const MappableDigraphComponent& digraph)
1114 1114
          : Parent(digraph) {}
1115 1115

	
1116
	/// \brief Construct a new map with default value.
1117
	///
1118
	/// Construct a new map for the digraph and initalise the values.
1119
	ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
1116
        /// \brief Construct a new map with default value.
1117
        ///
1118
        /// Construct a new map for the digraph and initalise the values.
1119
        ArcMap(const MappableDigraphComponent& digraph, const _Value& value)
1120 1120
          : Parent(digraph, value) {}
1121 1121

	
1122
	/// \brief Copy constructor.
1123
	///
1124
	/// Copy Constructor.
1125
	ArcMap(const ArcMap& nm) : Parent(nm) {}
1122
        /// \brief Copy constructor.
1123
        ///
1124
        /// Copy Constructor.
1125
        ArcMap(const ArcMap& nm) : Parent(nm) {}
1126 1126

	
1127
	/// \brief Assign operator.
1128
	///
1129
	/// Assign operator.
1127
        /// \brief Assign operator.
1128
        ///
1129
        /// Assign operator.
1130 1130
        template <typename CMap>
1131
        ArcMap& operator=(const CMap&) { 
1131
        ArcMap& operator=(const CMap&) {
1132 1132
          checkConcept<ReadMap<Arc, _Value>, CMap>();
... ...
@@ -1141,40 +1141,40 @@
1141 1141

	
1142
	struct Dummy {
1143
	  int value;
1144
	  Dummy() : value(0) {}
1145
	  Dummy(int _v) : value(_v) {}
1146
	};
1142
        struct Dummy {
1143
          int value;
1144
          Dummy() : value(0) {}
1145
          Dummy(int _v) : value(_v) {}
1146
        };
1147 1147

	
1148
	void constraints() {
1149
	  checkConcept<Base, _Digraph>();
1150
	  { // int map test
1151
	    typedef typename _Digraph::template NodeMap<int> IntNodeMap;
1152
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Node, int>, 
1153
	      IntNodeMap >();
1154
	  } { // bool map test
1155
	    typedef typename _Digraph::template NodeMap<bool> BoolNodeMap;
1156
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Node, bool>,
1157
	      BoolNodeMap >();
1158
	  } { // Dummy map test
1159
	    typedef typename _Digraph::template NodeMap<Dummy> DummyNodeMap;
1160
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Node, Dummy>,
1161
	      DummyNodeMap >();
1162
	  } 
1148
        void constraints() {
1149
          checkConcept<Base, _Digraph>();
1150
          { // int map test
1151
            typedef typename _Digraph::template NodeMap<int> IntNodeMap;
1152
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, int>,
1153
              IntNodeMap >();
1154
          } { // bool map test
1155
            typedef typename _Digraph::template NodeMap<bool> BoolNodeMap;
1156
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, bool>,
1157
              BoolNodeMap >();
1158
          } { // Dummy map test
1159
            typedef typename _Digraph::template NodeMap<Dummy> DummyNodeMap;
1160
            checkConcept<GraphMap<_Digraph, typename _Digraph::Node, Dummy>,
1161
              DummyNodeMap >();
1162
          }
1163 1163

	
1164
	  { // int map test
1165
	    typedef typename _Digraph::template ArcMap<int> IntArcMap;
1166
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, int>,
1167
	      IntArcMap >();
1168
	  } { // bool map test
1169
	    typedef typename _Digraph::template ArcMap<bool> BoolArcMap;
1170
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, bool>,
1171
	      BoolArcMap >();
1172
	  } { // Dummy map test
1173
	    typedef typename _Digraph::template ArcMap<Dummy> DummyArcMap;
1174
	    checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, Dummy>, 
1175
	      DummyArcMap >();
1176
	  } 
1177
	}
1164
          { // int map test
1165
            typedef typename _Digraph::template ArcMap<int> IntArcMap;
1166
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, int>,
1167
              IntArcMap >();
1168
          } { // bool map test
1169
            typedef typename _Digraph::template ArcMap<bool> BoolArcMap;
1170
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, bool>,
1171
              BoolArcMap >();
1172
          } { // Dummy map test
1173
            typedef typename _Digraph::template ArcMap<Dummy> DummyArcMap;
1174
            checkConcept<GraphMap<_Digraph, typename _Digraph::Arc, Dummy>,
1175
              DummyArcMap >();
1176
          }
1177
        }
1178 1178

	
1179
	_Digraph& digraph;
1179
        _Digraph& digraph;
1180 1180
      };
... ...
@@ -1201,3 +1201,3 @@
1201 1201
      template <typename _Value>
1202
      class EdgeMap : public GraphMap<Graph, Edge, _Value> {  
1202
      class EdgeMap : public GraphMap<Graph, Edge, _Value> {
1203 1203
      public:
... ...
@@ -1205,24 +1205,24 @@
1205 1205

	
1206
	/// \brief Construct a new map.
1207
	///
1208
	/// Construct a new map for the graph.
1209
	explicit EdgeMap(const MappableGraphComponent& graph) 
1206
        /// \brief Construct a new map.
1207
        ///
1208
        /// Construct a new map for the graph.
1209
        explicit EdgeMap(const MappableGraphComponent& graph)
1210 1210
          : Parent(graph) {}
1211 1211

	
1212
	/// \brief Construct a new map with default value.
1213
	///
1214
	/// Construct a new map for the graph and initalise the values.
1215
	EdgeMap(const MappableGraphComponent& graph, const _Value& value)
1212
        /// \brief Construct a new map with default value.
1213
        ///
1214
        /// Construct a new map for the graph and initalise the values.
1215
        EdgeMap(const MappableGraphComponent& graph, const _Value& value)
1216 1216
          : Parent(graph, value) {}
1217 1217

	
1218
	/// \brief Copy constructor.
1219
	///
1220
	/// Copy Constructor.
1221
	EdgeMap(const EdgeMap& nm) : Parent(nm) {}
1218
        /// \brief Copy constructor.
1219
        ///
1220
        /// Copy Constructor.
1221
        EdgeMap(const EdgeMap& nm) : Parent(nm) {}
1222 1222

	
1223
	/// \brief Assign operator.
1224
	///
1225
	/// Assign operator.
1223
        /// \brief Assign operator.
1224
        ///
1225
        /// Assign operator.
1226 1226
        template <typename CMap>
1227
        EdgeMap& operator=(const CMap&) { 
1227
        EdgeMap& operator=(const CMap&) {
1228 1228
          checkConcept<ReadMap<Edge, _Value>, CMap>();
... ...
@@ -1237,27 +1237,27 @@
1237 1237

	
1238
	struct Dummy {
1239
	  int value;
1240
	  Dummy() : value(0) {}
1241
	  Dummy(int _v) : value(_v) {}
1242
	};
1238
        struct Dummy {
1239
          int value;
1240
          Dummy() : value(0) {}
1241
          Dummy(int _v) : value(_v) {}
1242
        };
1243 1243

	
1244
	void constraints() {
1245
	  checkConcept<MappableGraphComponent<Base>, _Graph>();
1244
        void constraints() {
1245
          checkConcept<MappableGraphComponent<Base>, _Graph>();
1246 1246

	
1247
	  { // int map test
1248
	    typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
1249
	    checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
1250
	      IntEdgeMap >();
1251
	  } { // bool map test
1252
	    typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
1253
	    checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
1254
	      BoolEdgeMap >();
1255
	  } { // Dummy map test
1256
	    typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
1257
	    checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>, 
1258
	      DummyEdgeMap >();
1259
	  } 
1260
	}
1247
          { // int map test
1248
            typedef typename _Graph::template EdgeMap<int> IntEdgeMap;
1249
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, int>,
1250
              IntEdgeMap >();
1251
          } { // bool map test
1252
            typedef typename _Graph::template EdgeMap<bool> BoolEdgeMap;
1253
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, bool>,
1254
              BoolEdgeMap >();
1255
          } { // Dummy map test
1256
            typedef typename _Graph::template EdgeMap<Dummy> DummyEdgeMap;
1257
            checkConcept<GraphMap<_Graph, typename _Graph::Edge, Dummy>,
1258
              DummyEdgeMap >();
1259
          }
1260
        }
1261 1261

	
1262
	_Graph& graph;
1262
        _Graph& graph;
1263 1263
      };
... ...
@@ -1284,5 +1284,5 @@
1284 1284
      Node addNode() {
1285
	return INVALID;
1285
        return INVALID;
1286 1286
      }
1287
    
1287

	
1288 1288
      /// \brief Adds a new arc connects the given two nodes.
... ...
@@ -1291,3 +1291,3 @@
1291 1291
      Arc addArc(const Node&, const Node&) {
1292
	return INVALID;
1292
        return INVALID;
1293 1293
      }
... ...
@@ -1296,12 +1296,12 @@
1296 1296
      struct Constraints {
1297
	void constraints() {
1297
        void constraints() {
1298 1298
          checkConcept<Base, _Digraph>();
1299
	  typename _Digraph::Node node_a, node_b;
1300
	  node_a = digraph.addNode();
1301
	  node_b = digraph.addNode();
1302
	  typename _Digraph::Arc arc;
1303
	  arc = digraph.addArc(node_a, node_b);
1304
	}
1299
          typename _Digraph::Node node_a, node_b;
1300
          node_a = digraph.addNode();
1301
          node_b = digraph.addNode();
1302
          typename _Digraph::Arc arc;
1303
          arc = digraph.addArc(node_a, node_b);
1304
        }
1305 1305

	
1306
	_Digraph& digraph;
1306
        _Digraph& digraph;
1307 1307
      };
... ...
@@ -1329,5 +1329,5 @@
1329 1329
      Node addNode() {
1330
	return INVALID;
1330
        return INVALID;
1331 1331
      }
1332
    
1332

	
1333 1333
      /// \brief Adds a new arc connects the given two nodes.
... ...
@@ -1336,3 +1336,3 @@
1336 1336
      Edge addArc(const Node&, const Node&) {
1337
	return INVALID;
1337
        return INVALID;
1338 1338
      }
... ...
@@ -1341,12 +1341,12 @@
1341 1341
      struct Constraints {
1342
	void constraints() {
1343
	  checkConcept<Base, _Graph>();
1344
	  typename _Graph::Node node_a, node_b;
1345
	  node_a = graph.addNode();
1346
	  node_b = graph.addNode();
1347
	  typename _Graph::Edge edge;
1348
	  edge = graph.addEdge(node_a, node_b);
1349
	}
1342
        void constraints() {
1343
          checkConcept<Base, _Graph>();
1344
          typename _Graph::Node node_a, node_b;
1345
          node_a = graph.addNode();
1346
          node_b = graph.addNode();
1347
          typename _Graph::Edge edge;
1348
          edge = graph.addEdge(node_a, node_b);
1349
        }
1350 1350

	
1351
	_Graph& graph;
1351
        _Graph& graph;
1352 1352
      };
... ...
@@ -1355,3 +1355,3 @@
1355 1355
    /// \brief An empty erasable digraph class.
1356
    ///  
1356
    ///
1357 1357
    /// This class provides beside the core digraph features core erase
... ...
@@ -1370,5 +1370,5 @@
1370 1370
      ///
1371
      /// Erase a node from the digraph. This function should 
1371
      /// Erase a node from the digraph. This function should
1372 1372
      /// erase all arcs connecting to the node.
1373
      void erase(const Node&) {}    
1373
      void erase(const Node&) {}
1374 1374

	
... ...
@@ -1382,11 +1382,11 @@
1382 1382
      struct Constraints {
1383
	void constraints() {
1383
        void constraints() {
1384 1384
          checkConcept<Base, _Digraph>();
1385
	  typename _Digraph::Node node;
1386
	  digraph.erase(node);
1387
	  typename _Digraph::Arc arc;
1388
	  digraph.erase(arc);
1389
	}
1385
          typename _Digraph::Node node;
1386
          digraph.erase(node);
1387
          typename _Digraph::Arc arc;
1388
          digraph.erase(arc);
1389
        }
1390 1390

	
1391
	_Digraph& digraph;
1391
        _Digraph& digraph;
1392 1392
      };
... ...
@@ -1395,3 +1395,3 @@
1395 1395
    /// \brief An empty erasable base undirected graph class.
1396
    ///  
1396
    ///
1397 1397
    /// This class provides beside the core undirected graph features
... ...
@@ -1412,3 +1412,3 @@
1412 1412
      /// arcs connecting to the node.
1413
      void erase(const Node&) {}    
1413
      void erase(const Node&) {}
1414 1414

	
... ...
@@ -1422,11 +1422,11 @@
1422 1422
      struct Constraints {
1423
	void constraints() {
1423
        void constraints() {
1424 1424
          checkConcept<Base, _Graph>();
1425
	  typename _Graph::Node node;
1426
	  graph.erase(node);
1427
	  typename _Graph::Edge edge;
1428
	  graph.erase(edge);
1429
	}
1425
          typename _Graph::Node node;
1426
          graph.erase(node);
1427
          typename _Graph::Edge edge;
1428
          graph.erase(edge);
1429
        }
1430 1430

	
1431
	_Graph& graph;
1431
        _Graph& graph;
1432 1432
      };
... ...
@@ -1450,3 +1450,3 @@
1450 1450
      ///
1451
      void clear() {}    
1451
      void clear() {}
1452 1452

	
... ...
@@ -1454,8 +1454,8 @@
1454 1454
      struct Constraints {
1455
	void constraints() {
1455
        void constraints() {
1456 1456
          checkConcept<Base, _Digraph>();
1457
	  digraph.clear();
1458
	}
1457
          digraph.clear();
1458
        }
1459 1459

	
1460
	_Digraph digraph;
1460
        _Digraph digraph;
1461 1461
      };
... ...
@@ -1477,7 +1477,7 @@
1477 1477
      struct Constraints {
1478
	void constraints() {
1478
        void constraints() {
1479 1479
          checkConcept<ClearableGraphComponent<Base>, _Graph>();
1480
	}
1480
        }
1481 1481

	
1482
	_Graph graph;
1482
        _Graph graph;
1483 1483
      };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -54,10 +54,10 @@
54 54
      ///
55
      /// The \c ItemIntMap must be initialized in such a way, that it 
55
      /// The \c ItemIntMap must be initialized in such a way, that it
56 56
      /// assigns \c PRE_HEAP (<tt>-1</tt>) to every item.
57 57
      enum State {
58
	IN_HEAP = 0,
59
	PRE_HEAP = -1,
60
	POST_HEAP = -2
58
        IN_HEAP = 0,
59
        PRE_HEAP = -1,
60
        POST_HEAP = -2
61 61
      };
62
      
62

	
63 63
      /// \brief The constructor.
... ...
@@ -87,4 +87,4 @@
87 87
      /// \brief Inserts an item into the heap with the given priority.
88
      ///    
89
      /// Inserts the given item into the heap with the given priority. 
88
      ///
89
      /// Inserts the given item into the heap with the given priority.
90 90
      /// \param i The item to insert.
... ...
@@ -114,3 +114,3 @@
114 114
      /// Removes the given item from the heap if it is already stored.
115
      /// \param i The item to delete. 
115
      /// \param i The item to delete.
116 116
      void erase(const Item &i) {}
... ...
@@ -119,3 +119,3 @@
119 119
      ///
120
      /// Returns the priority of the given item.  
120
      /// Returns the priority of the given item.
121 121
      /// \pre \c i must be in the heap.
... ...
@@ -135,3 +135,3 @@
135 135
      void set(const Item &i, const Prio &p) {}
136
      
136

	
137 137
      /// \brief Decreases the priority of an item to the given value.
... ...
@@ -176,65 +176,65 @@
176 176
      public:
177
	void constraints() {
178
	  typedef typename _Heap::Item OwnItem;
179
	  typedef typename _Heap::Prio OwnPrio;
180
	  typedef typename _Heap::State OwnState;
177
        void constraints() {
178
          typedef typename _Heap::Item OwnItem;
179
          typedef typename _Heap::Prio OwnPrio;
180
          typedef typename _Heap::State OwnState;
181 181

	
182
	  Item item;
183
	  Prio prio;
184
	  item=Item();
185
	  prio=Prio();
186
	  ignore_unused_variable_warning(item);
187
	  ignore_unused_variable_warning(prio);
182
          Item item;
183
          Prio prio;
184
          item=Item();
185
          prio=Prio();
186
          ignore_unused_variable_warning(item);
187
          ignore_unused_variable_warning(prio);
188 188

	
189
	  OwnItem own_item;
190
	  OwnPrio own_prio;
191
	  OwnState own_state;
192
	  own_item=Item();
193
	  own_prio=Prio();
194
	  ignore_unused_variable_warning(own_item);
195
	  ignore_unused_variable_warning(own_prio);
196
	  ignore_unused_variable_warning(own_state);
189
          OwnItem own_item;
190
          OwnPrio own_prio;
191
          OwnState own_state;
192
          own_item=Item();
193
          own_prio=Prio();
194
          ignore_unused_variable_warning(own_item);
195
          ignore_unused_variable_warning(own_prio);
196
          ignore_unused_variable_warning(own_state);
197 197

	
198
	  _Heap heap1(map);
199
	  _Heap heap2 = heap1;
200
	  ignore_unused_variable_warning(heap1);
201
	  ignore_unused_variable_warning(heap2);
202
	  
203
	  int s = heap.size();
204
	  ignore_unused_variable_warning(s);
205
	  bool e = heap.empty();
206
	  ignore_unused_variable_warning(e);
198
          _Heap heap1(map);
199
          _Heap heap2 = heap1;
200
          ignore_unused_variable_warning(heap1);
201
          ignore_unused_variable_warning(heap2);
207 202

	
208
	  prio = heap.prio();
209
	  item = heap.top();
210
	  prio = heap[item];
211
	  own_prio = heap.prio();
212
	  own_item = heap.top();
213
	  own_prio = heap[own_item];
203
          int s = heap.size();
204
          ignore_unused_variable_warning(s);
205
          bool e = heap.empty();
206
          ignore_unused_variable_warning(e);
214 207

	
215
	  heap.push(item, prio);
216
	  heap.push(own_item, own_prio);
217
	  heap.pop();
208
          prio = heap.prio();
209
          item = heap.top();
210
          prio = heap[item];
211
          own_prio = heap.prio();
212
          own_item = heap.top();
213
          own_prio = heap[own_item];
218 214

	
219
	  heap.set(item, prio);
220
	  heap.decrease(item, prio);
221
	  heap.increase(item, prio);
222
	  heap.set(own_item, own_prio);
223
	  heap.decrease(own_item, own_prio);
224
	  heap.increase(own_item, own_prio);
215
          heap.push(item, prio);
216
          heap.push(own_item, own_prio);
217
          heap.pop();
225 218

	
226
	  heap.erase(item);
227
	  heap.erase(own_item);
228
	  heap.clear();
219
          heap.set(item, prio);
220
          heap.decrease(item, prio);
221
          heap.increase(item, prio);
222
          heap.set(own_item, own_prio);
223
          heap.decrease(own_item, own_prio);
224
          heap.increase(own_item, own_prio);
229 225

	
230
	  own_state = heap.state(own_item);
231
	  heap.state(own_item, own_state);
226
          heap.erase(item);
227
          heap.erase(own_item);
228
          heap.clear();
232 229

	
233
	  own_state = _Heap::PRE_HEAP;
234
	  own_state = _Heap::IN_HEAP;
235
	  own_state = _Heap::POST_HEAP;
236
	}
230
          own_state = heap.state(own_item);
231
          heap.state(own_item, own_state);
237 232

	
238
	_Heap& heap;
239
	ItemIntMap& map;
233
          own_state = _Heap::PRE_HEAP;
234
          own_state = _Heap::IN_HEAP;
235
          own_state = _Heap::POST_HEAP;
236
        }
237

	
238
        _Heap& heap;
239
        ItemIntMap& map;
240 240
      };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -49,3 +49,3 @@
49 49
      /// Returns the value associated with the given key.
50
      Value operator[](const Key &) const { 
50
      Value operator[](const Key &) const {
51 51
        return *static_cast<Value *>(0);
... ...
@@ -55,16 +55,16 @@
55 55
      struct Constraints {
56
	void constraints() {
57
	  Value val = m[key];
58
	  val = m[key];
59
	  typename _ReadMap::Value own_val = m[own_key];
60
	  own_val = m[own_key];
56
        void constraints() {
57
          Value val = m[key];
58
          val = m[key];
59
          typename _ReadMap::Value own_val = m[own_key];
60
          own_val = m[own_key];
61 61

	
62
	  ignore_unused_variable_warning(key);
63
	  ignore_unused_variable_warning(val);
64
	  ignore_unused_variable_warning(own_key);
65
	  ignore_unused_variable_warning(own_val);
66
	}
67
	const Key& key;
68
	const typename _ReadMap::Key& own_key;
69
	const _ReadMap& m;
62
          ignore_unused_variable_warning(key);
63
          ignore_unused_variable_warning(val);
64
          ignore_unused_variable_warning(own_key);
65
          ignore_unused_variable_warning(own_val);
66
        }
67
        const Key& key;
68
        const typename _ReadMap::Key& own_key;
69
        const _ReadMap& m;
70 70
      };
... ...
@@ -95,16 +95,16 @@
95 95
      struct Constraints {
96
	void constraints() {
97
	  m.set(key, val);
98
	  m.set(own_key, own_val);
96
        void constraints() {
97
          m.set(key, val);
98
          m.set(own_key, own_val);
99 99

	
100
	  ignore_unused_variable_warning(key);
101
	  ignore_unused_variable_warning(val);
102
	  ignore_unused_variable_warning(own_key);
103
	  ignore_unused_variable_warning(own_val);
104
	}
105
	const Key& key;
106
	const Value& val;
107
	const typename _WriteMap::Key& own_key;
108
	const typename _WriteMap::Value& own_val;
109
	_WriteMap& m;
100
          ignore_unused_variable_warning(key);
101
          ignore_unused_variable_warning(val);
102
          ignore_unused_variable_warning(own_key);
103
          ignore_unused_variable_warning(own_val);
104
        }
105
        const Key& key;
106
        const Value& val;
107
        const typename _WriteMap::Key& own_key;
108
        const typename _WriteMap::Value& own_val;
109
        _WriteMap& m;
110 110
      };
... ...
@@ -118,3 +118,3 @@
118 118
    class ReadWriteMap : public ReadMap<K,T>,
119
			 public WriteMap<K,T>
119
                         public WriteMap<K,T>
120 120
    {
... ...
@@ -127,3 +127,3 @@
127 127
      /// Returns the value associated with the given key.
128
      Value operator[](const Key &) const { 
128
      Value operator[](const Key &) const {
129 129
        return *static_cast<Value *>(0);
... ...
@@ -136,6 +136,6 @@
136 136
      struct Constraints {
137
	void constraints() {
138
	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
139
	  checkConcept<WriteMap<K, T>, _ReadWriteMap >();
140
	}
137
        void constraints() {
138
          checkConcept<ReadMap<K, T>, _ReadWriteMap >();
139
          checkConcept<WriteMap<K, T>, _ReadWriteMap >();
140
        }
141 141
      };
... ...
@@ -166,3 +166,3 @@
166 166
      /// Returns a reference to the value associated with the given key.
167
      Reference operator[](const Key &) { 
167
      Reference operator[](const Key &) {
168 168
        return *static_cast<Value *>(0);
... ...
@@ -180,24 +180,24 @@
180 180
      struct Constraints {
181
	void constraints() {
182
	  checkConcept<ReadWriteMap<K, T>, _ReferenceMap >();
183
	  ref = m[key];
184
	  m[key] = val;
185
	  m[key] = ref;
186
	  m[key] = cref;
187
	  own_ref = m[own_key];
188
	  m[own_key] = own_val;
189
	  m[own_key] = own_ref;
190
	  m[own_key] = own_cref;
191
	  m[key] = m[own_key];
192
	  m[own_key] = m[key];
193
	}
194
	const Key& key;
195
	Value& val;
196
	Reference ref;
197
	ConstReference cref;
198
	const typename _ReferenceMap::Key& own_key;
199
	typename _ReferenceMap::Value& own_val;
200
	typename _ReferenceMap::Reference own_ref;
201
	typename _ReferenceMap::ConstReference own_cref;
202
	_ReferenceMap& m;
181
        void constraints() {
182
          checkConcept<ReadWriteMap<K, T>, _ReferenceMap >();
183
          ref = m[key];
184
          m[key] = val;
185
          m[key] = ref;
186
          m[key] = cref;
187
          own_ref = m[own_key];
188
          m[own_key] = own_val;
189
          m[own_key] = own_ref;
190
          m[own_key] = own_cref;
191
          m[key] = m[own_key];
192
          m[own_key] = m[key];
193
        }
194
        const Key& key;
195
        Value& val;
196
        Reference ref;
197
        ConstReference cref;
198
        const typename _ReferenceMap::Key& own_key;
199
        typename _ReferenceMap::Value& own_val;
200
        typename _ReferenceMap::Reference own_ref;
201
        typename _ReferenceMap::ConstReference own_cref;
202
        _ReferenceMap& m;
203 203
      };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -41,3 +41,3 @@
41 41
    /// A skeleton structure for representing directed paths in a
42
    /// digraph.  
42
    /// digraph.
43 43
    /// \tparam _Digraph The digraph type in which the path is.
... ...
@@ -85,21 +85,21 @@
85 85
      public:
86
	/// Default constructor
87
	ArcIt() {}
88
	/// Invalid constructor
89
	ArcIt(Invalid) {}
90
	/// Constructor for first arc
91
	ArcIt(const Path &) {}
86
        /// Default constructor
87
        ArcIt() {}
88
        /// Invalid constructor
89
        ArcIt(Invalid) {}
90
        /// Constructor for first arc
91
        ArcIt(const Path &) {}
92 92

	
93 93
        /// Conversion to Arc
94
	operator Arc() const { return INVALID; }
94
        operator Arc() const { return INVALID; }
95 95

	
96
	/// Next arc
97
	ArcIt& operator++() {return *this;}
96
        /// Next arc
97
        ArcIt& operator++() {return *this;}
98 98

	
99
	/// Comparison operator
100
	bool operator==(const ArcIt&) const {return true;}
101
	/// Comparison operator
102
	bool operator!=(const ArcIt&) const {return true;}
103
 	/// Comparison operator
104
 	bool operator<(const ArcIt&) const {return false;}
99
        /// Comparison operator
100
        bool operator==(const ArcIt&) const {return true;}
101
        /// Comparison operator
102
        bool operator!=(const ArcIt&) const {return true;}
103
         /// Comparison operator
104
         bool operator<(const ArcIt&) const {return false;}
105 105

	
... ...
@@ -139,3 +139,3 @@
139 139
    namespace _path_bits {
140
      
140

	
141 141
      template <typename _Digraph, typename _Path, typename RevPathTag = void>
... ...
@@ -164,3 +164,3 @@
164 164
      struct PathDumperConstraints<
165
        _Digraph, _Path, 
165
        _Digraph, _Path,
166 166
        typename enable_if<typename _Path::RevPathTag, void>::type
... ...
@@ -186,3 +186,3 @@
186 186
      };
187
    
187

	
188 188
    }
... ...
@@ -211,3 +211,3 @@
211 211
    /// template constructor or a template assignment operator.
212
    /// 
212
    ///
213 213
    template <typename _Digraph>
... ...
@@ -240,21 +240,21 @@
240 240
      public:
241
	/// Default constructor
242
	ArcIt() {}
243
	/// Invalid constructor
244
	ArcIt(Invalid) {}
245
	/// Constructor for first arc
246
	ArcIt(const PathDumper&) {}
241
        /// Default constructor
242
        ArcIt() {}
243
        /// Invalid constructor
244
        ArcIt(Invalid) {}
245
        /// Constructor for first arc
246
        ArcIt(const PathDumper&) {}
247 247

	
248 248
        /// Conversion to Arc
249
	operator Arc() const { return INVALID; }
249
        operator Arc() const { return INVALID; }
250 250

	
251
	/// Next arc
252
	ArcIt& operator++() {return *this;}
251
        /// Next arc
252
        ArcIt& operator++() {return *this;}
253 253

	
254
	/// Comparison operator
255
	bool operator==(const ArcIt&) const {return true;}
256
	/// Comparison operator
257
	bool operator!=(const ArcIt&) const {return true;}
258
 	/// Comparison operator
259
 	bool operator<(const ArcIt&) const {return false;}
254
        /// Comparison operator
255
        bool operator==(const ArcIt&) const {return true;}
256
        /// Comparison operator
257
        bool operator!=(const ArcIt&) const {return true;}
258
         /// Comparison operator
259
         bool operator<(const ArcIt&) const {return false;}
260 260

	
... ...
@@ -268,21 +268,21 @@
268 268
      public:
269
	/// Default constructor
270
	RevArcIt() {}
271
	/// Invalid constructor
272
	RevArcIt(Invalid) {}
273
	/// Constructor for first arc
274
	RevArcIt(const PathDumper &) {}
269
        /// Default constructor
270
        RevArcIt() {}
271
        /// Invalid constructor
272
        RevArcIt(Invalid) {}
273
        /// Constructor for first arc
274
        RevArcIt(const PathDumper &) {}
275 275

	
276 276
        /// Conversion to Arc
277
	operator Arc() const { return INVALID; }
277
        operator Arc() const { return INVALID; }
278 278

	
279
	/// Next arc
280
	RevArcIt& operator++() {return *this;}
279
        /// Next arc
280
        RevArcIt& operator++() {return *this;}
281 281

	
282
	/// Comparison operator
283
	bool operator==(const RevArcIt&) const {return true;}
284
	/// Comparison operator
285
	bool operator!=(const RevArcIt&) const {return true;}
286
 	/// Comparison operator
287
 	bool operator<(const RevArcIt&) const {return false;}
282
        /// Comparison operator
283
        bool operator==(const RevArcIt&) const {return true;}
284
        /// Comparison operator
285
        bool operator!=(const RevArcIt&) const {return true;}
286
         /// Comparison operator
287
         bool operator<(const RevArcIt&) const {return false;}
288 288

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -28,3 +28,3 @@
28 28

	
29
namespace lemon 
29
namespace lemon
30 30
{
... ...
@@ -34,3 +34,3 @@
34 34
  template<class P>
35
  class _SubCounter 
35
  class _SubCounter
36 36
  {
... ...
@@ -51,3 +51,3 @@
51 51
      : _parent(parent), _title(title), _os(os), count(0) {}
52
    ~_SubCounter() { 
52
    ~_SubCounter() {
53 53
      _os << _title << count <<std::endl;
... ...
@@ -65,3 +65,3 @@
65 65
  template<class P>
66
  class _NoSubCounter 
66
  class _NoSubCounter
67 67
  {
... ...
@@ -71,7 +71,7 @@
71 71
    typedef _NoSubCounter<_NoSubCounter<P> > NoSubCounter;
72
  
72

	
73 73
    _NoSubCounter(P &parent) :_parent(parent) {}
74
    _NoSubCounter(P &parent,std::string,std::ostream &) 
74
    _NoSubCounter(P &parent,std::string,std::ostream &)
75 75
      :_parent(parent) {}
76
    _NoSubCounter(P &parent,std::string) 
76
    _NoSubCounter(P &parent,std::string)
77 77
      :_parent(parent) {}
... ...
@@ -104,3 +104,3 @@
104 104
  /// A report containing the given title and the value of the counter
105
  /// is automatically printed on destruction. 
105
  /// is automatically printed on destruction.
106 106
  ///
... ...
@@ -135,3 +135,3 @@
135 135
  /// \sa NoCounter
136
  class Counter 
136
  class Counter
137 137
  {
... ...
@@ -143,3 +143,3 @@
143 143
    /// SubCounter class
144
    
144

	
145 145
    /// This class can be used to setup subcounters for a \ref Counter
... ...
@@ -149,3 +149,3 @@
149 149
    /// Subcounters can also have subcounters.
150
    /// 
150
    ///
151 151
    /// The parent counter must be given as the first parameter of the
... ...
@@ -158,3 +158,3 @@
158 158
    /// instead.
159
    /// 
159
    ///
160 160
    /// \sa NoSubCounter
... ...
@@ -162,4 +162,4 @@
162 162

	
163
    /// SubCounter class without printing report on destruction 
164
    
163
    /// SubCounter class without printing report on destruction
164

	
165 165
    /// This class can be used to setup subcounters for a \ref Counter.
... ...
@@ -170,3 +170,3 @@
170 170
    /// Replacing \ref SubCounter "SubCounter"s with \ref NoSubCounter
171
    /// "NoSubCounter"s makes it possible to turn off reporting 
171
    /// "NoSubCounter"s makes it possible to turn off reporting
172 172
    /// subcounter values without actually removing the definitions
... ...
@@ -180,3 +180,3 @@
180 180
    /// Constructor.
181
    Counter(std::string title,std::ostream &os=std::cerr) 
181
    Counter(std::string title,std::ostream &os=std::cerr)
182 182
      : _title(title), _os(os), count(0) {}
... ...
@@ -206,3 +206,3 @@
206 206
    /// \ref SubCounter "SubCounter"s but it resets \ref NoSubCounter
207
    /// "NoSubCounter"s along with the main counter. 
207
    /// "NoSubCounter"s along with the main counter.
208 208
    void reset(int c=0) {count=c;}
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -36,3 +36,3 @@
36 36

	
37
  
37

	
38 38
  ///Default traits class of Dfs class.
... ...
@@ -44,3 +44,3 @@
44 44
  {
45
    ///The digraph type the algorithm runs on. 
45
    ///The digraph type the algorithm runs on.
46 46
    typedef GR Digraph;
... ...
@@ -48,3 +48,3 @@
48 48
    ///arcs of the %DFS paths.
49
    /// 
49
    ///
50 50
    ///The type of the map that stores the last
... ...
@@ -55,7 +55,7 @@
55 55
    ///Instantiates a PredMap.
56
 
57
    ///This function instantiates a \ref PredMap. 
56

	
57
    ///This function instantiates a \ref PredMap.
58 58
    ///\param G is the digraph, to which we would like to define the PredMap.
59 59
    ///\todo The digraph alone may be insufficient to initialize
60
    static PredMap *createPredMap(const GR &G) 
60
    static PredMap *createPredMap(const GR &G)
61 61
    {
... ...
@@ -65,3 +65,3 @@
65 65
    ///The type of the map that indicates which nodes are processed.
66
 
66

	
67 67
    ///The type of the map that indicates which nodes are processed.
... ...
@@ -71,4 +71,4 @@
71 71
    ///Instantiates a ProcessedMap.
72
 
73
    ///This function instantiates a \ref ProcessedMap. 
72

	
73
    ///This function instantiates a \ref ProcessedMap.
74 74
    ///\param g is the digraph, to which
... ...
@@ -84,3 +84,3 @@
84 84
    ///The type of the map that indicates which nodes are reached.
85
 
85

	
86 86
    ///The type of the map that indicates which nodes are reached.
... ...
@@ -90,4 +90,4 @@
90 90
    ///Instantiates a ReachedMap.
91
 
92
    ///This function instantiates a \ref ReachedMap. 
91

	
92
    ///This function instantiates a \ref ReachedMap.
93 93
    ///\param G is the digraph, to which
... ...
@@ -99,3 +99,3 @@
99 99
    ///The type of the map that stores the dists of the nodes.
100
 
100

	
101 101
    ///The type of the map that stores the dists of the nodes.
... ...
@@ -105,4 +105,4 @@
105 105
    ///Instantiates a DistMap.
106
 
107
    ///This function instantiates a \ref DistMap. 
106

	
107
    ///This function instantiates a \ref DistMap.
108 108
    ///\param G is the digraph, to which we would like to define the \ref DistMap
... ...
@@ -113,5 +113,5 @@
113 113
  };
114
  
114

	
115 115
  ///%DFS algorithm class.
116
  
116

	
117 117
  ///\ingroup search
... ...
@@ -129,6 +129,6 @@
129 129
  template <typename GR,
130
	    typename TR>
130
            typename TR>
131 131
#else
132 132
  template <typename GR=ListDigraph,
133
	    typename TR=DfsDefaultTraits<GR> >
133
            typename TR=DfsDefaultTraits<GR> >
134 134
#endif
... ...
@@ -145,3 +145,3 @@
145 145
      virtual const char* what() const throw() {
146
	return "lemon::Dfs::UninitializedParameter";
146
        return "lemon::Dfs::UninitializedParameter";
147 147
      }
... ...
@@ -160,3 +160,3 @@
160 160
    typedef typename Digraph::OutArcIt OutArcIt;
161
    
161

	
162 162
    ///\brief The type of the map that stores the last
... ...
@@ -194,21 +194,21 @@
194 194
    ///Creates the maps if necessary.
195
    
195

	
196 196
    ///\todo Better memory allocation (instead of new).
197
    void create_maps() 
197
    void create_maps()
198 198
    {
199 199
      if(!_pred) {
200
	local_pred = true;
201
	_pred = Traits::createPredMap(*G);
200
        local_pred = true;
201
        _pred = Traits::createPredMap(*G);
202 202
      }
203 203
      if(!_dist) {
204
	local_dist = true;
205
	_dist = Traits::createDistMap(*G);
204
        local_dist = true;
205
        _dist = Traits::createDistMap(*G);
206 206
      }
207 207
      if(!_reached) {
208
	local_reached = true;
209
	_reached = Traits::createReachedMap(*G);
208
        local_reached = true;
209
        _reached = Traits::createReachedMap(*G);
210 210
      }
211 211
      if(!_processed) {
212
	local_processed = true;
213
	_processed = Traits::createProcessedMap(*G);
212
        local_processed = true;
213
        _processed = Traits::createProcessedMap(*G);
214 214
      }
... ...
@@ -219,3 +219,3 @@
219 219
    Dfs() {}
220
    
220

	
221 221
  public:
... ...
@@ -231,5 +231,5 @@
231 231
      typedef T PredMap;
232
      static PredMap *createPredMap(const Digraph &G) 
232
      static PredMap *createPredMap(const Digraph &G)
233 233
      {
234
	throw UninitializedParameter();
234
        throw UninitializedParameter();
235 235
      }
... ...
@@ -245,4 +245,4 @@
245 245
    };
246
    
247
    
246

	
247

	
248 248
    template <class T>
... ...
@@ -250,5 +250,5 @@
250 250
      typedef T DistMap;
251
      static DistMap *createDistMap(const Digraph &) 
251
      static DistMap *createDistMap(const Digraph &)
252 252
      {
253
	throw UninitializedParameter();
253
        throw UninitializedParameter();
254 254
      }
... ...
@@ -264,3 +264,3 @@
264 264
    };
265
    
265

	
266 266
    template <class T>
... ...
@@ -268,5 +268,5 @@
268 268
      typedef T ReachedMap;
269
      static ReachedMap *createReachedMap(const Digraph &) 
269
      static ReachedMap *createReachedMap(const Digraph &)
270 270
      {
271
	throw UninitializedParameter();
271
        throw UninitializedParameter();
272 272
      }
... ...
@@ -286,5 +286,5 @@
286 286
      typedef T ProcessedMap;
287
      static ProcessedMap *createProcessedMap(const Digraph &) 
287
      static ProcessedMap *createProcessedMap(const Digraph &)
288 288
      {
289
	throw UninitializedParameter();
289
        throw UninitializedParameter();
290 290
      }
... ...
@@ -297,11 +297,11 @@
297 297
    template <class T>
298
    struct DefProcessedMap : public Dfs< Digraph, DefProcessedMapTraits<T> > { 
298
    struct DefProcessedMap : public Dfs< Digraph, DefProcessedMapTraits<T> > {
299 299
      typedef Dfs< Digraph, DefProcessedMapTraits<T> > Create;
300 300
    };
301
    
301

	
302 302
    struct DefDigraphProcessedMapTraits : public Traits {
303 303
      typedef typename Digraph::template NodeMap<bool> ProcessedMap;
304
      static ProcessedMap *createProcessedMap(const Digraph &G) 
304
      static ProcessedMap *createProcessedMap(const Digraph &G)
305 305
      {
306
	return new ProcessedMap(G);
306
        return new ProcessedMap(G);
307 307
      }
... ...
@@ -316,12 +316,12 @@
316 316
    class DefProcessedMapToBeDefaultMap :
317
      public Dfs< Digraph, DefDigraphProcessedMapTraits> { 
317
      public Dfs< Digraph, DefDigraphProcessedMapTraits> {
318 318
      typedef Dfs< Digraph, DefDigraphProcessedMapTraits> Create;
319 319
    };
320
    
320

	
321 321
    ///@}
322 322

	
323
  public:      
324
    
323
  public:
324

	
325 325
    ///Constructor.
326
    
326

	
327 327
    ///\param _G the digraph the algorithm will run on.
... ...
@@ -335,5 +335,5 @@
335 335
    { }
336
    
336

	
337 337
    ///Destructor.
338
    ~Dfs() 
338
    ~Dfs()
339 339
    {
... ...
@@ -352,7 +352,7 @@
352 352
    ///\return <tt> (*this) </tt>
353
    Dfs &predMap(PredMap &m) 
353
    Dfs &predMap(PredMap &m)
354 354
    {
355 355
      if(local_pred) {
356
	delete _pred;
357
	local_pred=false;
356
        delete _pred;
357
        local_pred=false;
358 358
      }
... ...
@@ -369,7 +369,7 @@
369 369
    ///\return <tt> (*this) </tt>
370
    Dfs &distMap(DistMap &m) 
370
    Dfs &distMap(DistMap &m)
371 371
    {
372 372
      if(local_dist) {
373
	delete _dist;
374
	local_dist=false;
373
        delete _dist;
374
        local_dist=false;
375 375
      }
... ...
@@ -386,7 +386,7 @@
386 386
    ///\return <tt> (*this) </tt>
387
    Dfs &reachedMap(ReachedMap &m) 
387
    Dfs &reachedMap(ReachedMap &m)
388 388
    {
389 389
      if(local_reached) {
390
	delete _reached;
391
	local_reached=false;
390
        delete _reached;
391
        local_reached=false;
392 392
      }
... ...
@@ -403,7 +403,7 @@
403 403
    ///\return <tt> (*this) </tt>
404
    Dfs &processedMap(ProcessedMap &m) 
404
    Dfs &processedMap(ProcessedMap &m)
405 405
    {
406 406
      if(local_processed) {
407
	delete _processed;
408
	local_processed=false;
407
        delete _processed;
408
        local_processed=false;
409 409
      }
... ...
@@ -436,9 +436,9 @@
436 436
      for ( NodeIt u(*G) ; u!=INVALID ; ++u ) {
437
	_pred->set(u,INVALID);
438
	// _predNode->set(u,INVALID);
439
	_reached->set(u,false);
440
	_processed->set(u,false);
437
        _pred->set(u,INVALID);
438
        // _predNode->set(u,INVALID);
439
        _reached->set(u,false);
440
        _processed->set(u,false);
441 441
      }
442 442
    }
443
    
443

	
444 444
    ///Adds a new source node.
... ...
@@ -452,17 +452,17 @@
452 452
      if(!(*_reached)[s])
453
	{
454
	  _reached->set(s,true);
455
	  _pred->set(s,INVALID);
456
	  OutArcIt e(*G,s);
457
	  if(e!=INVALID) {
458
	    _stack[++_stack_head]=e;
459
	    _dist->set(s,_stack_head);
460
	  }
461
	  else {
462
	    _processed->set(s,true);
463
	    _dist->set(s,0);
464
	  }
465
	}
453
        {
454
          _reached->set(s,true);
455
          _pred->set(s,INVALID);
456
          OutArcIt e(*G,s);
457
          if(e!=INVALID) {
458
            _stack[++_stack_head]=e;
459
            _dist->set(s,_stack_head);
460
          }
461
          else {
462
            _processed->set(s,true);
463
            _dist->set(s,0);
464
          }
465
        }
466 466
    }
467
    
467

	
468 468
    ///Processes the next arc.
... ...
@@ -475,3 +475,3 @@
475 475
    Arc processNextArc()
476
    { 
476
    {
477 477
      Node m;
... ...
@@ -479,19 +479,19 @@
479 479
      if(!(*_reached)[m=G->target(e)]) {
480
	_pred->set(m,e);
481
	_reached->set(m,true);
482
	++_stack_head;
483
	_stack[_stack_head] = OutArcIt(*G, m);
484
	_dist->set(m,_stack_head);
480
        _pred->set(m,e);
481
        _reached->set(m,true);
482
        ++_stack_head;
483
        _stack[_stack_head] = OutArcIt(*G, m);
484
        _dist->set(m,_stack_head);
485 485
      }
486 486
      else {
487
	m=G->source(e);
488
	++_stack[_stack_head];
487
        m=G->source(e);
488
        ++_stack[_stack_head];
489 489
      }
490 490
      while(_stack_head>=0 && _stack[_stack_head]==INVALID) {
491
	_processed->set(m,true);
492
	--_stack_head;
493
	if(_stack_head>=0) {
494
	  m=G->source(_stack[_stack_head]);
495
	  ++_stack[_stack_head];
496
	}
491
        _processed->set(m,true);
492
        --_stack_head;
493
        if(_stack_head>=0) {
494
          m=G->source(_stack[_stack_head]);
495
          ++_stack[_stack_head];
496
        }
497 497
      }
... ...
@@ -506,3 +506,3 @@
506 506
    OutArcIt nextArc()
507
    { 
507
    {
508 508
      return _stack_head>=0?_stack[_stack_head]:INVALID;
... ...
@@ -517,6 +517,6 @@
517 517
    ///Returns the number of the nodes to be processed.
518
    
518

	
519 519
    ///Returns the number of the nodes to be processed in the queue.
520 520
    int queueSize() { return _stack_head+1; }
521
    
521

	
522 522
    ///Executes the algorithm.
... ...
@@ -539,3 +539,3 @@
539 539
    }
540
    
540

	
541 541
    ///Executes the algorithm until \c dest is reached.
... ...
@@ -556,6 +556,6 @@
556 556
    {
557
      while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest ) 
558
	processNextArc();
557
      while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest )
558
        processNextArc();
559 559
    }
560
    
560

	
561 561
    ///Executes the algorithm until a condition is met.
... ...
@@ -584,3 +584,3 @@
584 584
    ///Runs %DFS algorithm to visit all nodes in the digraph.
585
    
585

	
586 586
    ///This method runs the %DFS algorithm in order to
... ...
@@ -612,3 +612,3 @@
612 612
    ///Runs %DFS algorithm from node \c s.
613
    
613

	
614 614
    ///This method runs the %DFS algorithm from a root node \c s
... ...
@@ -631,5 +631,5 @@
631 631
    }
632
    
632

	
633 633
    ///Finds the %DFS path between \c s and \c t.
634
    
634

	
635 635
    ///Finds the %DFS path between \c s and \c t.
... ...
@@ -651,3 +651,3 @@
651 651
    }
652
    
652

	
653 653
    ///@}
... ...
@@ -659,3 +659,3 @@
659 659
    ///either run() or start() must be called.
660
    
660

	
661 661
    ///@{
... ...
@@ -665,6 +665,6 @@
665 665
    ///Gives back the shortest path.
666
    
666

	
667 667
    ///Gives back the shortest path.
668 668
    ///\pre The \c t should be reachable from the source.
669
    Path path(Node t) 
669
    Path path(Node t)
670 670
    {
... ...
@@ -677,3 +677,3 @@
677 677
    ///\pre \ref run() must be called before using this function.
678
    ///\warning If node \c v is unreachable from the root(s) then the return 
678
    ///\warning If node \c v is unreachable from the root(s) then the return
679 679
    ///value of this funcion is undefined.
... ...
@@ -707,4 +707,4 @@
707 707
    Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
708
				  G->source((*_pred)[v]); }
709
    
708
                                  G->source((*_pred)[v]); }
709

	
710 710
    ///Returns a reference to the NodeMap of distances.
... ...
@@ -715,3 +715,3 @@
715 715
    const DistMap &distMap() const { return *_dist;}
716
 
716

	
717 717
    ///Returns a reference to the %DFS arc-tree map.
... ...
@@ -723,3 +723,3 @@
723 723
    const PredMap &predMap() const { return *_pred;}
724
 
724

	
725 725
    ///Checks if a node is reachable from the root.
... ...
@@ -732,3 +732,3 @@
732 732
    bool reached(Node v) { return (*_reached)[v]; }
733
    
733

	
734 734
    ///@}
... ...
@@ -743,3 +743,3 @@
743 743
  {
744
    ///The digraph type the algorithm runs on. 
744
    ///The digraph type the algorithm runs on.
745 745
    typedef GR Digraph;
... ...
@@ -747,3 +747,3 @@
747 747
    ///arcs of the %DFS paths.
748
    /// 
748
    ///
749 749
    ///The type of the map that stores the last
... ...
@@ -754,4 +754,4 @@
754 754
    ///Instantiates a PredMap.
755
 
756
    ///This function instantiates a \ref PredMap. 
755

	
756
    ///This function instantiates a \ref PredMap.
757 757
    ///\param g is the digraph, to which we would like to define the PredMap.
... ...
@@ -759,5 +759,5 @@
759 759
#ifdef DOXYGEN
760
    static PredMap *createPredMap(const GR &g) 
760
    static PredMap *createPredMap(const GR &g)
761 761
#else
762
    static PredMap *createPredMap(const GR &) 
762
    static PredMap *createPredMap(const GR &)
763 763
#endif
... ...
@@ -768,3 +768,3 @@
768 768
    ///The type of the map that indicates which nodes are processed.
769
 
769

	
770 770
    ///The type of the map that indicates which nodes are processed.
... ...
@@ -774,4 +774,4 @@
774 774
    ///Instantiates a ProcessedMap.
775
 
776
    ///This function instantiates a \ref ProcessedMap. 
775

	
776
    ///This function instantiates a \ref ProcessedMap.
777 777
    ///\param g is the digraph, to which
... ...
@@ -787,3 +787,3 @@
787 787
    ///The type of the map that indicates which nodes are reached.
788
 
788

	
789 789
    ///The type of the map that indicates which nodes are reached.
... ...
@@ -793,4 +793,4 @@
793 793
    ///Instantiates a ReachedMap.
794
 
795
    ///This function instantiates a \ref ReachedMap. 
794

	
795
    ///This function instantiates a \ref ReachedMap.
796 796
    ///\param G is the digraph, to which
... ...
@@ -802,3 +802,3 @@
802 802
    ///The type of the map that stores the dists of the nodes.
803
 
803

	
804 804
    ///The type of the map that stores the dists of the nodes.
... ...
@@ -808,4 +808,4 @@
808 808
    ///Instantiates a DistMap.
809
 
810
    ///This function instantiates a \ref DistMap. 
809

	
810
    ///This function instantiates a \ref DistMap.
811 811
    ///\param g is the digraph, to which we would like to define the \ref DistMap
... ...
@@ -820,3 +820,3 @@
820 820
  };
821
  
821

	
822 822
  /// Default traits used by \ref DfsWizard
... ...
@@ -850,6 +850,6 @@
850 850
    Node _source;
851
    
851

	
852 852
    public:
853 853
    /// Constructor.
854
    
854

	
855 855
    /// This constructor does not require parameters, therefore it initiates
... ...
@@ -857,6 +857,6 @@
857 857
    DfsWizardBase() : _g(0), _reached(0), _processed(0), _pred(0),
858
			   _dist(0), _source(INVALID) {}
858
                           _dist(0), _source(INVALID) {}
859 859

	
860 860
    /// Constructor.
861
    
861

	
862 862
    /// This constructor requires some parameters,
... ...
@@ -867,3 +867,3 @@
867 867
    DfsWizardBase(const GR &g, Node s=INVALID) :
868
      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))), 
868
      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
869 869
      _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
... ...
@@ -871,3 +871,3 @@
871 871
  };
872
  
872

	
873 873
  /// A class to make the usage of the Dfs algorithm easier
... ...
@@ -906,3 +906,3 @@
906 906
    typedef typename Digraph::OutArcIt OutArcIt;
907
    
907

	
908 908
    ///\brief The type of the map that stores
... ...
@@ -936,3 +936,3 @@
936 936
    ///Runs Dfs algorithm from a given node.
937
    
937

	
938 938
    ///Runs Dfs algorithm from a given node.
... ...
@@ -943,9 +943,9 @@
943 943
      Dfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
944
      if(Base::_reached) 
944
      if(Base::_reached)
945 945
        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
946
      if(Base::_processed) 
946
      if(Base::_processed)
947 947
        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
948
      if(Base::_pred) 
948
      if(Base::_pred)
949 949
        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
950
      if(Base::_dist) 
950
      if(Base::_dist)
951 951
        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
... ...
@@ -970,3 +970,3 @@
970 970
    };
971
    
971

	
972 972
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -978,3 +978,3 @@
978 978
    template<class T>
979
    DfsWizard<DefPredMapBase<T> > predMap(const T &t) 
979
    DfsWizard<DefPredMapBase<T> > predMap(const T &t)
980 980
    {
... ...
@@ -983,4 +983,4 @@
983 983
    }
984
    
985
 
984

	
985

	
986 986
    template<class T>
... ...
@@ -991,3 +991,3 @@
991 991
    };
992
    
992

	
993 993
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -999,3 +999,3 @@
999 999
    template<class T>
1000
    DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t) 
1000
    DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
1001 1001
    {
... ...
@@ -1004,3 +1004,3 @@
1004 1004
    }
1005
    
1005

	
1006 1006

	
... ...
@@ -1012,3 +1012,3 @@
1012 1012
    };
1013
    
1013

	
1014 1014
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1020,3 +1020,3 @@
1020 1020
    template<class T>
1021
    DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t) 
1021
    DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
1022 1022
    {
... ...
@@ -1025,3 +1025,3 @@
1025 1025
    }
1026
    
1026

	
1027 1027
    template<class T>
... ...
@@ -1032,3 +1032,3 @@
1032 1032
    };
1033
    
1033

	
1034 1034
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1040,3 +1040,3 @@
1040 1040
    template<class T>
1041
    DfsWizard<DefDistMapBase<T> > distMap(const T &t) 
1041
    DfsWizard<DefDistMapBase<T> > distMap(const T &t)
1042 1042
    {
... ...
@@ -1045,3 +1045,3 @@
1045 1045
    }
1046
    
1046

	
1047 1047
    /// Sets the source node, from which the Dfs algorithm runs.
... ...
@@ -1050,3 +1050,3 @@
1050 1050
    /// \param s is the source node.
1051
    DfsWizard<TR> &source(Node s) 
1051
    DfsWizard<TR> &source(Node s)
1052 1052
    {
... ...
@@ -1055,5 +1055,5 @@
1055 1055
    }
1056
    
1056

	
1057 1057
  };
1058
  
1058

	
1059 1059
  ///Function type interface for Dfs algorithm.
... ...
@@ -1084,5 +1084,5 @@
1084 1084
  /// \brief Visitor class for dfs.
1085
  ///  
1086
  /// It gives a simple interface for a functional interface for dfs 
1087
  /// traversal. The traversal on a linear data structure. 
1085
  ///
1086
  /// It gives a simple interface for a functional interface for dfs
1087
  /// traversal. The traversal on a linear data structure.
1088 1088
  template <typename _Digraph>
... ...
@@ -1093,3 +1093,3 @@
1093 1093
    /// \brief Called when the arc reach a node.
1094
    /// 
1094
    ///
1095 1095
    /// It is called when the dfs find an arc which target is not
... ...
@@ -1098,3 +1098,3 @@
1098 1098
    /// \brief Called when the node reached first time.
1099
    /// 
1099
    ///
1100 1100
    /// It is Called when the node reached first time.
... ...
@@ -1102,3 +1102,3 @@
1102 1102
    /// \brief Called when we step back on an arc.
1103
    /// 
1103
    ///
1104 1104
    /// It is called when the dfs should step back on the arc.
... ...
@@ -1106,9 +1106,9 @@
1106 1106
    /// \brief Called when we step back from the node.
1107
    /// 
1107
    ///
1108 1108
    /// It is called when we step back from the node.
1109 1109
    void leave(const Node& node) {}
1110
    /// \brief Called when the arc examined but target of the arc 
1110
    /// \brief Called when the arc examined but target of the arc
1111 1111
    /// already discovered.
1112
    /// 
1113
    /// It called when the arc examined but the target of the arc 
1112
    ///
1113
    /// It called when the arc examined but the target of the arc
1114 1114
    /// already discovered.
... ...
@@ -1116,3 +1116,3 @@
1116 1116
    /// \brief Called for the source node of the dfs.
1117
    /// 
1117
    ///
1118 1118
    /// It is called for the source node of the dfs.
... ...
@@ -1120,3 +1120,3 @@
1120 1120
    /// \brief Called when we leave the source node of the dfs.
1121
    /// 
1121
    ///
1122 1122
    /// It is called when we leave the source node of the dfs.
... ...
@@ -1142,11 +1142,11 @@
1142 1142
      void constraints() {
1143
	Arc arc;
1144
	Node node;
1145
	visitor.discover(arc);
1146
	visitor.reach(node);
1147
	visitor.backtrack(arc);
1148
	visitor.leave(node);
1149
	visitor.examine(arc);
1150
	visitor.start(node);
1151
	visitor.stop(arc);
1143
        Arc arc;
1144
        Node node;
1145
        visitor.discover(arc);
1146
        visitor.reach(node);
1147
        visitor.backtrack(arc);
1148
        visitor.leave(node);
1149
        visitor.examine(arc);
1150
        visitor.start(node);
1151
        visitor.stop(arc);
1152 1152
      }
... ...
@@ -1164,3 +1164,3 @@
1164 1164

	
1165
    /// \brief The digraph type the algorithm runs on. 
1165
    /// \brief The digraph type the algorithm runs on.
1166 1166
    typedef _Digraph Digraph;
... ...
@@ -1168,3 +1168,3 @@
1168 1168
    /// \brief The type of the map that indicates which nodes are reached.
1169
    /// 
1169
    ///
1170 1170
    /// The type of the map that indicates which nodes are reached.
... ...
@@ -1176,3 +1176,3 @@
1176 1176
    ///
1177
    /// This function instantiates a \ref ReachedMap. 
1177
    /// This function instantiates a \ref ReachedMap.
1178 1178
    /// \param digraph is the digraph, to which
... ...
@@ -1184,5 +1184,5 @@
1184 1184
  };
1185
  
1185

	
1186 1186
  /// %DFS Visit algorithm class.
1187
  
1187

	
1188 1188
  /// \ingroup search
... ...
@@ -1193,3 +1193,3 @@
1193 1193
  /// class. It works with callback mechanism, the DfsVisit object calls
1194
  /// on every dfs event the \c Visitor class member functions. 
1194
  /// on every dfs event the \c Visitor class member functions.
1195 1195
  ///
... ...
@@ -1198,3 +1198,3 @@
1198 1198
  /// is only passed to \ref DfsDefaultTraits.
1199
  /// \tparam _Visitor The Visitor object for the algorithm. The 
1199
  /// \tparam _Visitor The Visitor object for the algorithm. The
1200 1200
  /// \ref DfsVisitor "DfsVisitor<_Digraph>" is an empty Visitor which
... ...
@@ -1202,3 +1202,3 @@
1202 1202
  /// events you should implement your own Visitor class.
1203
  /// \tparam _Traits Traits class to set various data types used by the 
1203
  /// \tparam _Traits Traits class to set various data types used by the
1204 1204
  /// algorithm. The default traits class is
... ...
@@ -1213,4 +1213,4 @@
1213 1213
  template <typename _Digraph = ListDigraph,
1214
	    typename _Visitor = DfsVisitor<_Digraph>,
1215
	    typename _Traits = DfsDefaultTraits<_Digraph> >
1214
            typename _Visitor = DfsVisitor<_Digraph>,
1215
            typename _Traits = DfsDefaultTraits<_Digraph> >
1216 1216
#endif
... ...
@@ -1218,3 +1218,3 @@
1218 1218
  public:
1219
    
1219

	
1220 1220
    /// \brief \ref Exception for uninitialized parameters.
... ...
@@ -1225,5 +1225,5 @@
1225 1225
    public:
1226
      virtual const char* what() const throw() 
1226
      virtual const char* what() const throw()
1227 1227
      {
1228
	return "lemon::DfsVisit::UninitializedParameter";
1228
        return "lemon::DfsVisit::UninitializedParameter";
1229 1229
      }
... ...
@@ -1264,4 +1264,4 @@
1264 1264
      if(!_reached) {
1265
	local_reached = true;
1266
	_reached = Traits::createReachedMap(*_digraph);
1265
        local_reached = true;
1266
        _reached = Traits::createReachedMap(*_digraph);
1267 1267
      }
... ...
@@ -1272,3 +1272,3 @@
1272 1272
    DfsVisit() {}
1273
    
1273

	
1274 1274
  public:
... ...
@@ -1284,6 +1284,6 @@
1284 1284
      static ReachedMap *createReachedMap(const Digraph &digraph) {
1285
	throw UninitializedParameter();
1285
        throw UninitializedParameter();
1286 1286
      }
1287 1287
    };
1288
    /// \brief \ref named-templ-param "Named parameter" for setting 
1288
    /// \brief \ref named-templ-param "Named parameter" for setting
1289 1289
    /// ReachedMap type
... ...
@@ -1293,3 +1293,3 @@
1293 1293
    struct DefReachedMap : public DfsVisit< Digraph, Visitor,
1294
					    DefReachedMapTraits<T> > {
1294
                                            DefReachedMapTraits<T> > {
1295 1295
      typedef DfsVisit< Digraph, Visitor, DefReachedMapTraits<T> > Create;
... ...
@@ -1298,4 +1298,4 @@
1298 1298

	
1299
  public:      
1300
    
1299
  public:
1300

	
1301 1301
    /// \brief Constructor.
... ...
@@ -1307,6 +1307,6 @@
1307 1307
    ///
1308
    DfsVisit(const Digraph& digraph, Visitor& visitor) 
1308
    DfsVisit(const Digraph& digraph, Visitor& visitor)
1309 1309
      : _digraph(&digraph), _visitor(&visitor),
1310
	_reached(0), local_reached(false) {}
1311
    
1310
        _reached(0), local_reached(false) {}
1311

	
1312 1312
    /// \brief Destructor.
... ...
@@ -1327,4 +1327,4 @@
1327 1327
      if(local_reached) {
1328
	delete _reached;
1329
	local_reached=false;
1328
        delete _reached;
1329
        local_reached=false;
1330 1330
      }
... ...
@@ -1355,6 +1355,6 @@
1355 1355
      for (NodeIt u(*_digraph) ; u != INVALID ; ++u) {
1356
	_reached->set(u, false);
1356
        _reached->set(u, false);
1357 1357
      }
1358 1358
    }
1359
    
1359

	
1360 1360
    /// \brief Adds a new source node.
... ...
@@ -1364,15 +1364,15 @@
1364 1364
      if(!(*_reached)[s]) {
1365
	  _reached->set(s,true);
1366
	  _visitor->start(s);
1367
	  _visitor->reach(s);
1368
	  Arc e; 
1369
	  _digraph->firstOut(e, s);
1370
	  if (e != INVALID) {
1371
	    _stack[++_stack_head] = e;
1372
	  } else {
1373
	    _visitor->leave(s);
1374
	  }
1375
	}
1365
          _reached->set(s,true);
1366
          _visitor->start(s);
1367
          _visitor->reach(s);
1368
          Arc e;
1369
          _digraph->firstOut(e, s);
1370
          if (e != INVALID) {
1371
            _stack[++_stack_head] = e;
1372
          } else {
1373
            _visitor->leave(s);
1374
          }
1375
        }
1376 1376
    }
1377
    
1377

	
1378 1378
    /// \brief Processes the next arc.
... ...
@@ -1384,3 +1384,3 @@
1384 1384
    /// \pre The stack must not be empty!
1385
    Arc processNextArc() { 
1385
    Arc processNextArc() {
1386 1386
      Arc e = _stack[_stack_head];
... ...
@@ -1388,21 +1388,21 @@
1388 1388
      if(!(*_reached)[m]) {
1389
	_visitor->discover(e);
1390
	_visitor->reach(m);
1391
	_reached->set(m, true);
1392
	_digraph->firstOut(_stack[++_stack_head], m);
1389
        _visitor->discover(e);
1390
        _visitor->reach(m);
1391
        _reached->set(m, true);
1392
        _digraph->firstOut(_stack[++_stack_head], m);
1393 1393
      } else {
1394
	_visitor->examine(e);
1395
	m = _digraph->source(e);
1396
	_digraph->nextOut(_stack[_stack_head]);
1394
        _visitor->examine(e);
1395
        m = _digraph->source(e);
1396
        _digraph->nextOut(_stack[_stack_head]);
1397 1397
      }
1398 1398
      while (_stack_head>=0 && _stack[_stack_head] == INVALID) {
1399
	_visitor->leave(m);
1400
	--_stack_head;
1401
	if (_stack_head >= 0) {
1402
	  _visitor->backtrack(_stack[_stack_head]);
1403
	  m = _digraph->source(_stack[_stack_head]);
1404
	  _digraph->nextOut(_stack[_stack_head]);
1405
	} else {
1406
	  _visitor->stop(m);	  
1407
	}
1399
        _visitor->leave(m);
1400
        --_stack_head;
1401
        if (_stack_head >= 0) {
1402
          _visitor->backtrack(_stack[_stack_head]);
1403
          m = _digraph->source(_stack[_stack_head]);
1404
          _digraph->nextOut(_stack[_stack_head]);
1405
        } else {
1406
          _visitor->stop(m);
1407
        }
1408 1408
      }
... ...
@@ -1417,3 +1417,3 @@
1417 1417
    /// empty.
1418
    Arc nextArc() { 
1418
    Arc nextArc() {
1419 1419
      return _stack_head >= 0 ? _stack[_stack_head] : INVALID;
... ...
@@ -1432,3 +1432,3 @@
1432 1432
    int queueSize() { return _stack_head + 1; }
1433
    
1433

	
1434 1434
    /// \brief Executes the algorithm.
... ...
@@ -1442,3 +1442,3 @@
1442 1442
    }
1443
    
1443

	
1444 1444
    /// \brief Executes the algorithm until \c dest is reached.
... ...
@@ -1450,6 +1450,6 @@
1450 1450
    void start(Node dest) {
1451
      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest ) 
1452
	processNextArc();
1451
      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest )
1452
        processNextArc();
1453 1453
    }
1454
    
1454

	
1455 1455
    /// \brief Executes the algorithm until a condition is met.
... ...
@@ -1492,3 +1492,3 @@
1492 1492
    /// \brief Runs %DFSVisit algorithm to visit all nodes in the digraph.
1493
    
1493

	
1494 1494
    /// This method runs the %DFS algorithm in order to
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -36,3 +36,3 @@
36 36
  /// \brief Default OperationTraits for the Dijkstra algorithm class.
37
  ///  
37
  ///
38 38
  /// It defines all computational operations and constants which are
... ...
@@ -56,3 +56,3 @@
56 56
  /// \brief Widest path OperationTraits for the Dijkstra algorithm class.
57
  ///  
57
  ///
58 58
  /// It defines all computational operations and constants which are
... ...
@@ -74,3 +74,3 @@
74 74
  };
75
  
75

	
76 76
  ///Default traits class of Dijkstra class.
... ...
@@ -83,3 +83,3 @@
83 83
  {
84
    ///The digraph type the algorithm runs on. 
84
    ///The digraph type the algorithm runs on.
85 85
    typedef GR Digraph;
... ...
@@ -105,6 +105,6 @@
105 105

	
106
    ///This function instantiates a \c HeapCrossRef. 
107
    /// \param G is the digraph, to which we would like to define the 
106
    ///This function instantiates a \c HeapCrossRef.
107
    /// \param G is the digraph, to which we would like to define the
108 108
    /// HeapCrossRef.
109
    static HeapCrossRef *createHeapCrossRef(const GR &G) 
109
    static HeapCrossRef *createHeapCrossRef(const GR &G)
110 110
    {
... ...
@@ -112,3 +112,3 @@
112 112
    }
113
    
113

	
114 114
    ///The heap type used by Dijkstra algorithm.
... ...
@@ -121,3 +121,3 @@
121 121

	
122
    static Heap *createHeap(HeapCrossRef& R) 
122
    static Heap *createHeap(HeapCrossRef& R)
123 123
    {
... ...
@@ -128,3 +128,3 @@
128 128
    ///arcs of the shortest paths.
129
    /// 
129
    ///
130 130
    ///The type of the map that stores the last
... ...
@@ -135,7 +135,7 @@
135 135
    ///Instantiates a PredMap.
136
 
137
    ///This function instantiates a \c PredMap. 
136

	
137
    ///This function instantiates a \c PredMap.
138 138
    ///\param G is the digraph, to which we would like to define the PredMap.
139 139
    ///\todo The digraph alone may be insufficient for the initialization
140
    static PredMap *createPredMap(const GR &G) 
140
    static PredMap *createPredMap(const GR &G)
141 141
    {
... ...
@@ -145,3 +145,3 @@
145 145
    ///The type of the map that stores whether a nodes is processed.
146
 
146

	
147 147
    ///The type of the map that stores whether a nodes is processed.
... ...
@@ -154,4 +154,4 @@
154 154
    ///Instantiates a ProcessedMap.
155
 
156
    ///This function instantiates a \c ProcessedMap. 
155

	
156
    ///This function instantiates a \c ProcessedMap.
157 157
    ///\param g is the digraph, to which
... ...
@@ -167,3 +167,3 @@
167 167
    ///The type of the map that stores the dists of the nodes.
168
 
168

	
169 169
    ///The type of the map that stores the dists of the nodes.
... ...
@@ -173,4 +173,4 @@
173 173
    ///Instantiates a DistMap.
174
 
175
    ///This function instantiates a \ref DistMap. 
174

	
175
    ///This function instantiates a \ref DistMap.
176 176
    ///\param G is the digraph, to which we would like to define the \ref DistMap
... ...
@@ -181,5 +181,5 @@
181 181
  };
182
  
182

	
183 183
  ///%Dijkstra algorithm class.
184
  
184

	
185 185
  /// \ingroup shortest_path
... ...
@@ -204,3 +204,3 @@
204 204
  ///of LM is not used directly by Dijkstra, it is only passed to \ref
205
  ///DijkstraDefaultTraits.  
205
  ///DijkstraDefaultTraits.
206 206
  ///\tparam TR Traits class to set
... ...
@@ -216,4 +216,4 @@
216 216
  template <typename GR=ListDigraph,
217
	    typename LM=typename GR::template ArcMap<int>,
218
	    typename TR=DijkstraDefaultTraits<GR,LM> >
217
            typename LM=typename GR::template ArcMap<int>,
218
            typename TR=DijkstraDefaultTraits<GR,LM> >
219 219
#endif
... ...
@@ -230,3 +230,3 @@
230 230
      virtual const char* what() const throw() {
231
	return "lemon::Dijkstra::UninitializedParameter";
231
        return "lemon::Dijkstra::UninitializedParameter";
232 232
      }
... ...
@@ -245,3 +245,3 @@
245 245
    typedef typename Digraph::OutArcIt OutArcIt;
246
    
246

	
247 247
    ///The type of the length of the arcs.
... ...
@@ -290,28 +290,28 @@
290 290
    ///Creates the maps if necessary.
291
    
291

	
292 292
    ///\todo Better memory allocation (instead of new).
293
    void create_maps() 
293
    void create_maps()
294 294
    {
295 295
      if(!_pred) {
296
	local_pred = true;
297
	_pred = Traits::createPredMap(*G);
296
        local_pred = true;
297
        _pred = Traits::createPredMap(*G);
298 298
      }
299 299
      if(!_dist) {
300
	local_dist = true;
301
	_dist = Traits::createDistMap(*G);
300
        local_dist = true;
301
        _dist = Traits::createDistMap(*G);
302 302
      }
303 303
      if(!_processed) {
304
	local_processed = true;
305
	_processed = Traits::createProcessedMap(*G);
304
        local_processed = true;
305
        _processed = Traits::createProcessedMap(*G);
306 306
      }
307 307
      if (!_heap_cross_ref) {
308
	local_heap_cross_ref = true;
309
	_heap_cross_ref = Traits::createHeapCrossRef(*G);
308
        local_heap_cross_ref = true;
309
        _heap_cross_ref = Traits::createHeapCrossRef(*G);
310 310
      }
311 311
      if (!_heap) {
312
	local_heap = true;
313
	_heap = Traits::createHeap(*_heap_cross_ref);
312
        local_heap = true;
313
        _heap = Traits::createHeap(*_heap_cross_ref);
314 314
      }
315 315
    }
316
    
316

	
317 317
  public :
... ...
@@ -319,3 +319,3 @@
319 319
    typedef Dijkstra Create;
320
 
320

	
321 321
    ///\name Named template parameters
... ...
@@ -329,3 +329,3 @@
329 329
      {
330
	throw UninitializedParameter();
330
        throw UninitializedParameter();
331 331
      }
... ...
@@ -337,7 +337,7 @@
337 337
    template <class T>
338
    struct DefPredMap 
339
      : public Dijkstra< Digraph,	LengthMap, DefPredMapTraits<T> > {
340
      typedef Dijkstra< Digraph,	LengthMap, DefPredMapTraits<T> > Create;
338
    struct DefPredMap
339
      : public Dijkstra< Digraph,        LengthMap, DefPredMapTraits<T> > {
340
      typedef Dijkstra< Digraph,        LengthMap, DefPredMapTraits<T> > Create;
341 341
    };
342
    
342

	
343 343
    template <class T>
... ...
@@ -347,3 +347,3 @@
347 347
      {
348
	throw UninitializedParameter();
348
        throw UninitializedParameter();
349 349
      }
... ...
@@ -355,7 +355,7 @@
355 355
    template <class T>
356
    struct DefDistMap 
357
      : public Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > { 
356
    struct DefDistMap
357
      : public Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > {
358 358
      typedef Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > Create;
359 359
    };
360
    
360

	
361 361
    template <class T>
... ...
@@ -363,5 +363,5 @@
363 363
      typedef T ProcessedMap;
364
      static ProcessedMap *createProcessedMap(const Digraph &G) 
364
      static ProcessedMap *createProcessedMap(const Digraph &G)
365 365
      {
366
	throw UninitializedParameter();
366
        throw UninitializedParameter();
367 367
      }
... ...
@@ -373,12 +373,12 @@
373 373
    template <class T>
374
    struct DefProcessedMap 
375
      : public Dijkstra< Digraph,	LengthMap, DefProcessedMapTraits<T> > { 
376
      typedef Dijkstra< Digraph,	LengthMap, DefProcessedMapTraits<T> > Create;
374
    struct DefProcessedMap
375
      : public Dijkstra< Digraph,        LengthMap, DefProcessedMapTraits<T> > {
376
      typedef Dijkstra< Digraph,        LengthMap, DefProcessedMapTraits<T> > Create;
377 377
    };
378
    
378

	
379 379
    struct DefDigraphProcessedMapTraits : public Traits {
380 380
      typedef typename Digraph::template NodeMap<bool> ProcessedMap;
381
      static ProcessedMap *createProcessedMap(const Digraph &G) 
381
      static ProcessedMap *createProcessedMap(const Digraph &G)
382 382
      {
383
	return new ProcessedMap(G);
383
        return new ProcessedMap(G);
384 384
      }
... ...
@@ -392,3 +392,3 @@
392 392
    template <class T>
393
    struct DefProcessedMapToBeDefaultMap 
393
    struct DefProcessedMapToBeDefaultMap
394 394
      : public Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> {
... ...
@@ -402,7 +402,7 @@
402 402
      static HeapCrossRef *createHeapCrossRef(const Digraph &) {
403
	throw UninitializedParameter();
403
        throw UninitializedParameter();
404 404
      }
405
      static Heap *createHeap(HeapCrossRef &) 
405
      static Heap *createHeap(HeapCrossRef &)
406 406
      {
407
	throw UninitializedParameter();
407
        throw UninitializedParameter();
408 408
      }
... ...
@@ -412,3 +412,3 @@
412 412
    ///
413
    ///\ref named-templ-param "Named parameter" for setting heap and cross 
413
    ///\ref named-templ-param "Named parameter" for setting heap and cross
414 414
    ///reference type
... ...
@@ -417,4 +417,4 @@
417 417
    struct DefHeap
418
      : public Dijkstra< Digraph,	LengthMap, DefHeapTraits<H, CR> > { 
419
      typedef Dijkstra< Digraph,	LengthMap, DefHeapTraits<H, CR> > Create;
418
      : public Dijkstra< Digraph,        LengthMap, DefHeapTraits<H, CR> > {
419
      typedef Dijkstra< Digraph,        LengthMap, DefHeapTraits<H, CR> > Create;
420 420
    };
... ...
@@ -426,7 +426,7 @@
426 426
      static HeapCrossRef *createHeapCrossRef(const Digraph &G) {
427
	return new HeapCrossRef(G);
427
        return new HeapCrossRef(G);
428 428
      }
429
      static Heap *createHeap(HeapCrossRef &R) 
429
      static Heap *createHeap(HeapCrossRef &R)
430 430
      {
431
	return new Heap(R);
431
        return new Heap(R);
432 432
      }
... ...
@@ -436,5 +436,5 @@
436 436
    ///
437
    ///\ref named-templ-param "Named parameter" for setting heap and cross 
438
    ///reference type. It can allocate the heap and the cross reference 
439
    ///object if the cross reference's constructor waits for the digraph as 
437
    ///\ref named-templ-param "Named parameter" for setting heap and cross
438
    ///reference type. It can allocate the heap and the cross reference
439
    ///object if the cross reference's constructor waits for the digraph as
440 440
    ///parameter and the heap's constructor waits for the cross reference.
... ...
@@ -442,4 +442,4 @@
442 442
    struct DefStandardHeap
443
      : public Dijkstra< Digraph,	LengthMap, DefStandardHeapTraits<H, CR> > { 
444
      typedef Dijkstra< Digraph,	LengthMap, DefStandardHeapTraits<H, CR> > 
443
      : public Dijkstra< Digraph,        LengthMap, DefStandardHeapTraits<H, CR> > {
444
      typedef Dijkstra< Digraph,        LengthMap, DefStandardHeapTraits<H, CR> >
445 445
      Create;
... ...
@@ -451,4 +451,4 @@
451 451
    };
452
    
453
    /// \brief \ref named-templ-param "Named parameter" for setting 
452

	
453
    /// \brief \ref named-templ-param "Named parameter" for setting
454 454
    /// OperationTraits type
... ...
@@ -463,3 +463,3 @@
463 463
    };
464
    
464

	
465 465
    ///@}
... ...
@@ -471,6 +471,6 @@
471 471

	
472
  public:      
473
    
472
  public:
473

	
474 474
    ///Constructor.
475
    
475

	
476 476
    ///\param _G the digraph the algorithm will run on.
... ...
@@ -485,5 +485,5 @@
485 485
    { }
486
    
486

	
487 487
    ///Destructor.
488
    ~Dijkstra() 
488
    ~Dijkstra()
489 489
    {
... ...
@@ -500,3 +500,3 @@
500 500
    ///\return <tt> (*this) </tt>
501
    Dijkstra &lengthMap(const LengthMap &m) 
501
    Dijkstra &lengthMap(const LengthMap &m)
502 502
    {
... ...
@@ -513,7 +513,7 @@
513 513
    ///\return <tt> (*this) </tt>
514
    Dijkstra &predMap(PredMap &m) 
514
    Dijkstra &predMap(PredMap &m)
515 515
    {
516 516
      if(local_pred) {
517
	delete _pred;
518
	local_pred=false;
517
        delete _pred;
518
        local_pred=false;
519 519
      }
... ...
@@ -530,7 +530,7 @@
530 530
    ///\return <tt> (*this) </tt>
531
    Dijkstra &distMap(DistMap &m) 
531
    Dijkstra &distMap(DistMap &m)
532 532
    {
533 533
      if(local_dist) {
534
	delete _dist;
535
	local_dist=false;
534
        delete _dist;
535
        local_dist=false;
536 536
      }
... ...
@@ -550,4 +550,4 @@
550 550
      if(local_heap_cross_ref) {
551
	delete _heap_cross_ref;
552
	local_heap_cross_ref=false;
551
        delete _heap_cross_ref;
552
        local_heap_cross_ref=false;
553 553
      }
... ...
@@ -555,4 +555,4 @@
555 555
      if(local_heap) {
556
	delete _heap;
557
	local_heap=false;
556
        delete _heap;
557
        local_heap=false;
558 558
      }
... ...
@@ -594,8 +594,8 @@
594 594
      for ( NodeIt u(*G) ; u!=INVALID ; ++u ) {
595
	_pred->set(u,INVALID);
596
	_processed->set(u,false);
597
	_heap_cross_ref->set(u,Heap::PRE_HEAP);
595
        _pred->set(u,INVALID);
596
        _processed->set(u,false);
597
        _heap_cross_ref->set(u,Heap::PRE_HEAP);
598 598
      }
599 599
    }
600
    
600

	
601 601
    ///Adds a new source node.
... ...
@@ -612,9 +612,9 @@
612 612
      if(_heap->state(s) != Heap::IN_HEAP) {
613
	_heap->push(s,dst);
613
        _heap->push(s,dst);
614 614
      } else if(OperationTraits::less((*_heap)[s], dst)) {
615
	_heap->set(s,dst);
616
	_pred->set(s,INVALID);
615
        _heap->set(s,dst);
616
        _pred->set(s,INVALID);
617 617
      }
618 618
    }
619
    
619

	
620 620
    ///Processes the next node in the priority heap
... ...
@@ -628,3 +628,3 @@
628 628
    {
629
      Node v=_heap->top(); 
629
      Node v=_heap->top();
630 630
      Value oldvalue=_heap->prio();
... ...
@@ -632,22 +632,22 @@
632 632
      finalizeNodeData(v,oldvalue);
633
      
633

	
634 634
      for(OutArcIt e(*G,v); e!=INVALID; ++e) {
635
	Node w=G->target(e); 
636
	switch(_heap->state(w)) {
637
	case Heap::PRE_HEAP:
638
	  _heap->push(w,OperationTraits::plus(oldvalue, (*length)[e])); 
639
	  _pred->set(w,e);
640
	  break;
641
	case Heap::IN_HEAP:
642
	  {
643
	    Value newvalue = OperationTraits::plus(oldvalue, (*length)[e]);
644
	    if ( OperationTraits::less(newvalue, (*_heap)[w]) ) {
645
	      _heap->decrease(w, newvalue); 
646
	      _pred->set(w,e);
647
	    }
648
	  }
649
	  break;
650
	case Heap::POST_HEAP:
651
	  break;
652
	}
635
        Node w=G->target(e);
636
        switch(_heap->state(w)) {
637
        case Heap::PRE_HEAP:
638
          _heap->push(w,OperationTraits::plus(oldvalue, (*length)[e]));
639
          _pred->set(w,e);
640
          break;
641
        case Heap::IN_HEAP:
642
          {
643
            Value newvalue = OperationTraits::plus(oldvalue, (*length)[e]);
644
            if ( OperationTraits::less(newvalue, (*_heap)[w]) ) {
645
              _heap->decrease(w, newvalue);
646
              _pred->set(w,e);
647
            }
648
          }
649
          break;
650
        case Heap::POST_HEAP:
651
          break;
652
        }
653 653
      }
... ...
@@ -657,3 +657,3 @@
657 657
    ///Next node to be processed.
658
    
658

	
659 659
    ///Next node to be processed.
... ...
@@ -663,6 +663,6 @@
663 663
    Node nextNode()
664
    { 
664
    {
665 665
      return !_heap->empty()?_heap->top():INVALID;
666 666
    }
667
 
667

	
668 668
    ///\brief Returns \c false if there are nodes
... ...
@@ -678,3 +678,3 @@
678 678
    int queueSize() { return _heap->size(); }
679
    
679

	
680 680
    ///Executes the algorithm.
... ...
@@ -697,3 +697,3 @@
697 697
    }
698
    
698

	
699 699
    ///Executes the algorithm until \c dest is reached.
... ...
@@ -717,3 +717,3 @@
717 717
    }
718
    
718

	
719 719
    ///Executes the algorithm until a condition is met.
... ...
@@ -738,5 +738,5 @@
738 738
    }
739
    
739

	
740 740
    ///Runs %Dijkstra algorithm from node \c s.
741
    
741

	
742 742
    ///This method runs the %Dijkstra algorithm from a root node \c s
... ...
@@ -759,5 +759,5 @@
759 759
    }
760
    
760

	
761 761
    ///Finds the shortest path between \c s and \c t.
762
    
762

	
763 763
    ///Finds the shortest path between \c s and \c t.
... ...
@@ -779,3 +779,3 @@
779 779
    }
780
    
780

	
781 781
    ///@}
... ...
@@ -787,3 +787,3 @@
787 787
    ///either run() or start() must be called.
788
    
788

	
789 789
    ///@{
... ...
@@ -791,6 +791,6 @@
791 791
    ///Gives back the shortest path.
792
    
792

	
793 793
    ///Gives back the shortest path.
794 794
    ///\pre The \c t should be reachable from the source.
795
    Path path(Node t) 
795
    Path path(Node t)
796 796
    {
... ...
@@ -834,4 +834,4 @@
834 834
    Node predNode(Node v) const { return (*_pred)[v]==INVALID ? INVALID:
835
				  G->source((*_pred)[v]); }
836
    
835
                                  G->source((*_pred)[v]); }
836

	
837 837
    ///Returns a reference to the NodeMap of distances.
... ...
@@ -841,3 +841,3 @@
841 841
    const DistMap &distMap() const { return *_dist;}
842
 
842

	
843 843
    ///Returns a reference to the shortest path tree map.
... ...
@@ -848,3 +848,3 @@
848 848
    const PredMap &predMap() const { return *_pred;}
849
 
849

	
850 850
    ///Checks if a node is reachable from the root.
... ...
@@ -864,3 +864,3 @@
864 864
    bool processed(Node v) { return (*_heap_cross_ref)[v] == Heap::POST_HEAP; }
865
    
865

	
866 866
    ///@}
... ...
@@ -871,3 +871,3 @@
871 871

	
872
 
872

	
873 873
  ///Default traits class of Dijkstra function.
... ...
@@ -880,3 +880,3 @@
880 880
  {
881
    ///The digraph type the algorithm runs on. 
881
    ///The digraph type the algorithm runs on.
882 882
    typedef GR Digraph;
... ...
@@ -903,7 +903,7 @@
903 903

	
904
    ///This function instantiates a \ref HeapCrossRef. 
905
    /// \param G is the digraph, to which we would like to define the 
904
    ///This function instantiates a \ref HeapCrossRef.
905
    /// \param G is the digraph, to which we would like to define the
906 906
    /// HeapCrossRef.
907 907
    /// \todo The digraph alone may be insufficient for the initialization
908
    static HeapCrossRef *createHeapCrossRef(const GR &G) 
908
    static HeapCrossRef *createHeapCrossRef(const GR &G)
909 909
    {
... ...
@@ -911,3 +911,3 @@
911 911
    }
912
    
912

	
913 913
    ///The heap type used by Dijkstra algorithm.
... ...
@@ -919,5 +919,5 @@
919 919
    typedef BinHeap<typename LM::Value, typename GR::template NodeMap<int>,
920
		    std::less<Value> > Heap;
920
                    std::less<Value> > Heap;
921 921

	
922
    static Heap *createHeap(HeapCrossRef& R) 
922
    static Heap *createHeap(HeapCrossRef& R)
923 923
    {
... ...
@@ -928,3 +928,3 @@
928 928
    ///arcs of the shortest paths.
929
    /// 
929
    ///
930 930
    ///The type of the map that stores the last
... ...
@@ -935,4 +935,4 @@
935 935
    ///Instantiates a PredMap.
936
 
937
    ///This function instantiates a \ref PredMap. 
936

	
937
    ///This function instantiates a \ref PredMap.
938 938
    ///\param g is the digraph, to which we would like to define the PredMap.
... ...
@@ -940,5 +940,5 @@
940 940
#ifdef DOXYGEN
941
    static PredMap *createPredMap(const GR &g) 
941
    static PredMap *createPredMap(const GR &g)
942 942
#else
943
    static PredMap *createPredMap(const GR &) 
943
    static PredMap *createPredMap(const GR &)
944 944
#endif
... ...
@@ -948,3 +948,3 @@
948 948
    ///The type of the map that stores whether a nodes is processed.
949
 
949

	
950 950
    ///The type of the map that stores whether a nodes is processed.
... ...
@@ -957,4 +957,4 @@
957 957
    ///Instantiates a ProcessedMap.
958
 
959
    ///This function instantiates a \ref ProcessedMap. 
958

	
959
    ///This function instantiates a \ref ProcessedMap.
960 960
    ///\param g is the digraph, to which
... ...
@@ -970,3 +970,3 @@
970 970
    ///The type of the map that stores the dists of the nodes.
971
 
971

	
972 972
    ///The type of the map that stores the dists of the nodes.
... ...
@@ -976,4 +976,4 @@
976 976
    ///Instantiates a DistMap.
977
 
978
    ///This function instantiates a \ref DistMap. 
977

	
978
    ///This function instantiates a \ref DistMap.
979 979
    ///\param g is the digraph, to which we would like to define the \ref DistMap
... ...
@@ -988,3 +988,3 @@
988 988
  };
989
  
989

	
990 990
  /// Default traits used by \ref DijkstraWizard
... ...
@@ -1020,3 +1020,3 @@
1020 1020
    /// Constructor.
1021
    
1021

	
1022 1022
    /// This constructor does not require parameters, therefore it initiates
... ...
@@ -1024,6 +1024,6 @@
1024 1024
    DijkstraWizardBase() : _g(0), _length(0), _pred(0),
1025
			   _dist(0), _source(INVALID) {}
1025
                           _dist(0), _source(INVALID) {}
1026 1026

	
1027 1027
    /// Constructor.
1028
    
1028

	
1029 1029
    /// This constructor requires some parameters,
... ...
@@ -1035,4 +1035,4 @@
1035 1035
    DijkstraWizardBase(const GR &g,const LM &l, Node s=INVALID) :
1036
      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))), 
1037
      _length(reinterpret_cast<void*>(const_cast<LM*>(&l))), 
1036
      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
1037
      _length(reinterpret_cast<void*>(const_cast<LM*>(&l))),
1038 1038
      _pred(0), _dist(0), _source(s) {}
... ...
@@ -1040,3 +1040,3 @@
1040 1040
  };
1041
  
1041

	
1042 1042
  /// A class to make the usage of Dijkstra algorithm easier
... ...
@@ -1058,3 +1058,3 @@
1058 1058
  /// It does not have own \ref run method. When its \ref run method is called
1059
  /// it initiates a plain \ref Dijkstra class, and calls the \ref 
1059
  /// it initiates a plain \ref Dijkstra class, and calls the \ref
1060 1060
  /// Dijkstra::run method of it.
... ...
@@ -1075,3 +1075,3 @@
1075 1075
    typedef typename Digraph::OutArcIt OutArcIt;
1076
    
1076

	
1077 1077
    ///The type of the map that stores the arc lengths.
... ...
@@ -1104,3 +1104,3 @@
1104 1104
    ///Runs Dijkstra algorithm from a given node.
1105
    
1105

	
1106 1106
    ///Runs Dijkstra algorithm from a given node.
... ...
@@ -1110,4 +1110,4 @@
1110 1110
      if(Base::_source==INVALID) throw UninitializedParameter();
1111
      Dijkstra<Digraph,LengthMap,TR> 
1112
	dij(*reinterpret_cast<const Digraph*>(Base::_g),
1111
      Dijkstra<Digraph,LengthMap,TR>
1112
        dij(*reinterpret_cast<const Digraph*>(Base::_g),
1113 1113
            *reinterpret_cast<const LengthMap*>(Base::_length));
... ...
@@ -1134,3 +1134,3 @@
1134 1134
    };
1135
    
1135

	
1136 1136
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1142,3 +1142,3 @@
1142 1142
    template<class T>
1143
    DijkstraWizard<DefPredMapBase<T> > predMap(const T &t) 
1143
    DijkstraWizard<DefPredMapBase<T> > predMap(const T &t)
1144 1144
    {
... ...
@@ -1147,3 +1147,3 @@
1147 1147
    }
1148
    
1148

	
1149 1149
    template<class T>
... ...
@@ -1154,3 +1154,3 @@
1154 1154
    };
1155
    
1155

	
1156 1156
    ///\brief \ref named-templ-param "Named parameter"
... ...
@@ -1162,3 +1162,3 @@
1162 1162
    template<class T>
1163
    DijkstraWizard<DefDistMapBase<T> > distMap(const T &t) 
1163
    DijkstraWizard<DefDistMapBase<T> > distMap(const T &t)
1164 1164
    {
... ...
@@ -1167,3 +1167,3 @@
1167 1167
    }
1168
    
1168

	
1169 1169
    /// Sets the source node, from which the Dijkstra algorithm runs.
... ...
@@ -1172,3 +1172,3 @@
1172 1172
    /// \param s is the source node.
1173
    DijkstraWizard<TR> &source(Node s) 
1173
    DijkstraWizard<TR> &source(Node s)
1174 1174
    {
... ...
@@ -1177,5 +1177,5 @@
1177 1177
    }
1178
    
1178

	
1179 1179
  };
1180
  
1180

	
1181 1181
  ///Function type interface for Dijkstra algorithm.
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -26,3 +26,3 @@
26 26
///\file
27
///\brief A simple two dimensional vector and a bounding box implementation 
27
///\brief A simple two dimensional vector and a bounding box implementation
28 28
///
... ...
@@ -61,4 +61,4 @@
61 61
      ///Second coordinate
62
      T y;     
63
      
62
      T y;
63

	
64 64
      ///Default constructor
... ...
@@ -72,3 +72,3 @@
72 72
      ///The dimension of the vector.
73
      ///This function always returns 2. 
73
      ///This function always returns 2.
74 74
      int size() const { return 2; }
... ...
@@ -94,3 +94,3 @@
94 94
      }
95
  
95

	
96 96
      ///Increment the left hand side by \c u
... ...
@@ -101,3 +101,3 @@
101 101
      }
102
  
102

	
103 103
      ///Decrement the left hand side by \c u
... ...
@@ -122,3 +122,3 @@
122 122
      }
123
  
123

	
124 124
      ///Return the scalar product of two vectors
... ...
@@ -127,3 +127,3 @@
127 127
      }
128
  
128

	
129 129
      ///Return the sum of two vectors
... ...
@@ -171,3 +171,3 @@
171 171

	
172
  ///Return a Point 
172
  ///Return a Point
173 173

	
... ...
@@ -261,3 +261,3 @@
261 261

	
262
  
262

	
263 263

	
... ...
@@ -272,3 +272,3 @@
272 272
    public:
273
      
273

	
274 274
      ///Default constructor: creates an empty bounding box
... ...
@@ -278,5 +278,5 @@
278 278
      BoundingBox(Point<T> a) { bottom_left=top_right=a; _empty = false; }
279
      
279

	
280 280
      ///Construct an instance from two points
281
      
281

	
282 282
      ///Construct an instance from two points.
... ...
@@ -288,7 +288,7 @@
288 288
      {
289
	bottom_left=a;
290
	top_right=b;
291
	_empty = false;
289
        bottom_left=a;
290
        top_right=b;
291
        _empty = false;
292 292
      }
293
      
293

	
294 294
      ///Construct an instance from four numbers
... ...
@@ -301,12 +301,12 @@
301 301
      ///\warning The left side must be no more than the right side and
302
      ///bottom must be no more than the top. 
302
      ///bottom must be no more than the top.
303 303
      BoundingBox(T l,T b,T r,T t)
304 304
      {
305
	bottom_left=Point<T>(l,b);
306
	top_right=Point<T>(r,t);
307
	_empty = false;
305
        bottom_left=Point<T>(l,b);
306
        top_right=Point<T>(r,t);
307
        _empty = false;
308 308
      }
309
      
309

	
310 310
      ///Return \c true if the bounding box is empty.
311
      
311

	
312 312
      ///Return \c true if the bounding box is empty (i.e. return \c false
... ...
@@ -315,3 +315,3 @@
315 315
      ///
316
      ///The coordinates of an empty bounding box are not defined. 
316
      ///The coordinates of an empty bounding box are not defined.
317 317
      bool empty() const {
... ...
@@ -319,3 +319,3 @@
319 319
      }
320
      
320

	
321 321
      ///Make the BoundingBox empty
... ...
@@ -338,3 +338,3 @@
338 338
      void bottomLeft(Point<T> p) {
339
	bottom_left = p;
339
        bottom_left = p;
340 340
      }
... ...
@@ -354,3 +354,3 @@
354 354
      void topRight(Point<T> p) {
355
	top_right = p;
355
        top_right = p;
356 356
      }
... ...
@@ -370,6 +370,6 @@
370 370
      void bottomRight(Point<T> p) {
371
	top_right.x = p.x;
372
	bottom_left.y = p.y;
371
        top_right.x = p.x;
372
        bottom_left.y = p.y;
373 373
      }
374
 
374

	
375 375
      ///Give back the top left corner of the box
... ...
@@ -387,4 +387,4 @@
387 387
      void topLeft(Point<T> p) {
388
	top_right.y = p.y;
389
	bottom_left.x = p.x;
388
        top_right.y = p.y;
389
        bottom_left.x = p.x;
390 390
      }
... ...
@@ -404,3 +404,3 @@
404 404
      void bottom(T t) {
405
	bottom_left.y = t;
405
        bottom_left.y = t;
406 406
      }
... ...
@@ -420,3 +420,3 @@
420 420
      void top(T t) {
421
	top_right.y = t;
421
        top_right.y = t;
422 422
      }
... ...
@@ -430,3 +430,3 @@
430 430
      }
431
 
431

	
432 432
      ///Set the left side of the box
... ...
@@ -436,3 +436,3 @@
436 436
      void left(T t) {
437
	bottom_left.x = t;
437
        bottom_left.x = t;
438 438
      }
... ...
@@ -452,3 +452,3 @@
452 452
      void right(T t) {
453
	top_right.x = t;
453
        top_right.x = t;
454 454
      }
... ...
@@ -480,3 +480,3 @@
480 480
      }
481
  
481

	
482 482
      ///Increments a bounding box with a point
... ...
@@ -498,5 +498,5 @@
498 498
      }
499
    
499

	
500 500
      ///Increments a bounding box to contain another bounding box
501
      
501

	
502 502
      ///Increments a bounding box to contain another bounding box.
... ...
@@ -506,3 +506,3 @@
506 506
          this->add(u.bottomLeft());
507
	  this->add(u.topRight());
507
          this->add(u.topRight());
508 508
        }
... ...
@@ -510,3 +510,3 @@
510 510
      }
511
  
511

	
512 512
      ///Intersection of two bounding boxes
... ...
@@ -518,11 +518,11 @@
518 518
        if (this->_empty || u._empty) {
519
	  b._empty = true;
520
	} else {
521
	  b.bottom_left.x = std::max(this->bottom_left.x,u.bottom_left.x);
522
	  b.bottom_left.y = std::max(this->bottom_left.y,u.bottom_left.y);
523
	  b.top_right.x = std::min(this->top_right.x,u.top_right.x);
524
	  b.top_right.y = std::min(this->top_right.y,u.top_right.y);
525
	  b._empty = b.bottom_left.x > b.top_right.x ||
526
	             b.bottom_left.y > b.top_right.y;
527
	} 
519
          b._empty = true;
520
        } else {
521
          b.bottom_left.x = std::max(this->bottom_left.x,u.bottom_left.x);
522
          b.bottom_left.y = std::max(this->bottom_left.y,u.bottom_left.y);
523
          b.top_right.x = std::min(this->top_right.x,u.top_right.x);
524
          b.top_right.y = std::min(this->top_right.y,u.top_right.y);
525
          b._empty = b.bottom_left.x > b.top_right.x ||
526
                     b.bottom_left.y > b.top_right.y;
527
        }
528 528
        return b;
... ...
@@ -539,3 +539,3 @@
539 539
  template<class M>
540
  class XMap 
540
  class XMap
541 541
  {
... ...
@@ -551,3 +551,3 @@
551 551
  };
552
    
552

	
553 553
  ///Returns an \ref XMap class
... ...
@@ -558,4 +558,4 @@
558 558
  ///\relates XMap
559
  template<class M> 
560
  inline XMap<M> xMap(M &m) 
559
  template<class M>
560
  inline XMap<M> xMap(M &m)
561 561
  {
... ...
@@ -564,4 +564,4 @@
564 564

	
565
  template<class M> 
566
  inline XMap<M> xMap(const M &m) 
565
  template<class M>
566
  inline XMap<M> xMap(const M &m)
567 567
  {
... ...
@@ -576,3 +576,3 @@
576 576
  template<class M>
577
  class ConstXMap 
577
  class ConstXMap
578 578
  {
... ...
@@ -587,3 +587,3 @@
587 587
  };
588
    
588

	
589 589
  ///Returns a \ref ConstXMap class
... ...
@@ -594,4 +594,4 @@
594 594
  ///\relates ConstXMap
595
  template<class M> 
596
  inline ConstXMap<M> xMap(const M &m) 
595
  template<class M>
596
  inline ConstXMap<M> xMap(const M &m)
597 597
  {
... ...
@@ -601,3 +601,3 @@
601 601
  ///Map of y-coordinates of a \ref Point "Point"-map
602
    
602

	
603 603
  ///\ingroup maps
... ...
@@ -606,3 +606,3 @@
606 606
  template<class M>
607
  class YMap 
607
  class YMap
608 608
  {
... ...
@@ -625,4 +625,4 @@
625 625
  ///\relates YMap
626
  template<class M> 
627
  inline YMap<M> yMap(M &m) 
626
  template<class M>
627
  inline YMap<M> yMap(M &m)
628 628
  {
... ...
@@ -631,4 +631,4 @@
631 631

	
632
  template<class M> 
633
  inline YMap<M> yMap(const M &m) 
632
  template<class M>
633
  inline YMap<M> yMap(const M &m)
634 634
  {
... ...
@@ -643,3 +643,3 @@
643 643
  template<class M>
644
  class ConstYMap 
644
  class ConstYMap
645 645
  {
... ...
@@ -654,3 +654,3 @@
654 654
  };
655
    
655

	
656 656
  ///Returns a \ref ConstYMap class
... ...
@@ -661,4 +661,4 @@
661 661
  ///\relates ConstYMap
662
  template<class M> 
663
  inline ConstYMap<M> yMap(const M &m) 
662
  template<class M>
663
  inline ConstYMap<M> yMap(const M &m)
664 664
  {
... ...
@@ -675,3 +675,3 @@
675 675
  template<class M>
676
  class NormSquareMap 
676
  class NormSquareMap
677 677
  {
... ...
@@ -686,3 +686,3 @@
686 686
  };
687
    
687

	
688 688
  ///Returns a \ref NormSquareMap class
... ...
@@ -693,4 +693,4 @@
693 693
  ///\relates NormSquareMap
694
  template<class M> 
695
  inline NormSquareMap<M> normSquareMap(const M &m) 
694
  template<class M>
695
  inline NormSquareMap<M> normSquareMap(const M &m)
696 696
  {
... ...
@@ -702,3 +702,3 @@
702 702
  } //namespce dim2
703
  
703

	
704 704
} //namespace lemon
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -47,3 +47,3 @@
47 47
      try {
48
	ptr.reset(new Type());
48
        ptr.reset(new Type());
49 49
      } catch (...) {}
... ...
@@ -53,5 +53,5 @@
53 53
      try {
54
	ptr.reset(new Type());
55
	if (ptr.get() == 0) return;
56
	*ptr = type;
54
        ptr.reset(new Type());
55
        if (ptr.get() == 0) return;
56
        *ptr = type;
57 57
      } catch (...) {}
... ...
@@ -61,6 +61,6 @@
61 61
      try {
62
	if (!copy.valid()) return;
63
	ptr.reset(new Type());
64
	if (ptr.get() == 0) return;
65
	*ptr = copy.get();
62
        if (!copy.valid()) return;
63
        ptr.reset(new Type());
64
        if (ptr.get() == 0) return;
65
        *ptr = copy.get();
66 66
      } catch (...) {}
... ...
@@ -71,4 +71,4 @@
71 71
      try {
72
	if (!copy.valid()) return;
73
 	*ptr = copy.get();
72
        if (!copy.valid()) return;
73
         *ptr = copy.get();
74 74
      } catch (...) {}
... ...
@@ -79,3 +79,3 @@
79 79
      try {
80
	*ptr = type;
80
        *ptr = type;
81 81
      } catch (...) {}
... ...
@@ -111,6 +111,6 @@
111 111
      try {
112
	buf.reset(new std::ostringstream);
112
        buf.reset(new std::ostringstream);
113 113
      }
114 114
      catch(...) {
115
	buf.reset();
115
        buf.reset();
116 116
      }
... ...
@@ -144,6 +144,6 @@
144 144
      try {
145
	*buf << t;
145
        *buf << t;
146 146
      }
147 147
      catch(...) {
148
	buf.reset();
148
        buf.reset();
149 149
      }
... ...
@@ -158,3 +158,3 @@
158 158
      try {
159
	mes = buf->str().c_str();
159
        mes = buf->str().c_str();
160 160
      }
... ...
@@ -256,3 +256,3 @@
256 256
    DataFormatError(const std::string &file_name, int line_num,
257
		    const char *the_message)
257
                    const char *the_message)
258 258
      : _message(the_message), _line(line_num) { file(file_name); }
... ...
@@ -271,5 +271,5 @@
271 271
      if (_message.valid() && !_message.get().empty()) {
272
	return _message.get().c_str();
272
        return _message.get().c_str();
273 273
      } else {
274
	return 0;
274
        return 0;
275 275
      }
... ...
@@ -282,5 +282,5 @@
282 282
      if (_file.valid() && !_file.get().empty()) {
283
	return _file.get().c_str();
283
        return _file.get().c_str();
284 284
      } else {
285
	return 0;
285
        return 0;
286 286
      }
... ...
@@ -291,13 +291,13 @@
291 291
      try {
292
	std::ostringstream ostr;
293
	ostr << "lemon:DataFormatError" << ": ";
294
	if (message()) ostr << message();
295
	if( file() || line() != 0 ) {
296
	  ostr << " (";
297
	  if( file() ) ostr << "in file '" << file() << "'";
298
	  if( file() && line() != 0 ) ostr << " ";
299
	  if( line() != 0 ) ostr << "at line " << line();
300
	  ostr << ")";
301
	}
302
	_message_holder.set(ostr.str());
292
        std::ostringstream ostr;
293
        ostr << "lemon:DataFormatError" << ": ";
294
        if (message()) ostr << message();
295
        if( file() || line() != 0 ) {
296
          ostr << " (";
297
          if( file() ) ostr << "in file '" << file() << "'";
298
          if( file() && line() != 0 ) ostr << " ";
299
          if( line() != 0 ) ostr << "at line " << line();
300
          ostr << ")";
301
        }
302
        _message_holder.set(ostr.str());
303 303
      }
... ...
@@ -335,5 +335,5 @@
335 335
      if (_file.valid() && !_file.get().empty()) {
336
	return _file.get().c_str();
336
        return _file.get().c_str();
337 337
      } else {
338
	return 0;
338
        return 0;
339 339
      }
... ...
@@ -344,6 +344,6 @@
344 344
      try {
345
	std::ostringstream ostr;
346
	ostr << "lemon::FileOpenError" << ": ";
347
	ostr << "Cannot open file - " << file();
348
	_message_holder.set(ostr.str());
345
        std::ostringstream ostr;
346
        ostr << "lemon::FileOpenError" << ": ";
347
        ostr << "Cannot open file - " << file();
348
        _message_holder.set(ostr.str());
349 349
      }
... ...
@@ -383,5 +383,5 @@
383 383
      if (_message.valid()) {
384
	return _message.get().c_str();
384
        return _message.get().c_str();
385 385
      } else {
386
	return 0;
386
        return 0;
387 387
      }
... ...
@@ -394,5 +394,5 @@
394 394
      if (_file.valid()) {
395
	return _file.get().c_str();
395
        return _file.get().c_str();
396 396
      } else {
397
	return 0;
397
        return 0;
398 398
      }
... ...
@@ -403,6 +403,6 @@
403 403
      try {
404
	std::ostringstream ostr;
405
	if (message()) ostr << message();
406
	if (file()) ostr << "(when reading file '" << file() << "')";
407
	_message_holder.set(ostr.str());
404
        std::ostringstream ostr;
405
        if (message()) ostr << message();
406
        if (file()) ostr << "(when reading file '" << file() << "')";
407
        _message_holder.set(ostr.str());
408 408
      }
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -62,3 +62,3 @@
62 62
  }
63
  
63

	
64 64
///Default traits class of \ref GraphToEps
... ...
@@ -78,3 +78,3 @@
78 78
  typedef typename Graph::OutArcIt OutArcIt;
79
  
79

	
80 80

	
... ...
@@ -83,3 +83,3 @@
83 83
  std::ostream& os;
84
  
84

	
85 85
  typedef ConstMap<typename Graph::Node,dim2::Point<double> > CoordsMapType;
... ...
@@ -95,3 +95,3 @@
95 95
  double _arcWidthScale;
96
  
96

	
97 97
  double _nodeScale;
... ...
@@ -100,6 +100,6 @@
100 100
  double _nodeBorderQuotient;
101
  
101

	
102 102
  bool _drawArrows;
103 103
  double _arrowLength, _arrowWidth;
104
  
104

	
105 105
  bool _showNodes, _showArcs;
... ...
@@ -110,3 +110,3 @@
110 110
  bool _showNodeText;
111
  ConstMap<typename Graph::Node,bool > _nodeTexts;  
111
  ConstMap<typename Graph::Node,bool > _nodeTexts;
112 112
  double _nodeTextSize;
... ...
@@ -114,5 +114,5 @@
114 114
  bool _showNodePsText;
115
  ConstMap<typename Graph::Node,bool > _nodePsTexts;  
115
  ConstMap<typename Graph::Node,bool > _nodePsTexts;
116 116
  char *_nodePsTextsPreamble;
117
  
117

	
118 118
  bool _undirected;
... ...
@@ -126,3 +126,3 @@
126 126

	
127
  enum NodeTextColorType 
127
  enum NodeTextColorType
128 128
    { DIST_COL=0, DIST_BW=1, CUST_COL=2, SAME_COL=3 } _nodeTextColorType;
... ...
@@ -148,3 +148,3 @@
148 148
  DefaultGraphToEpsTraits(const G &_g,std::ostream& _os=std::cout,
149
			  bool _pros=false) :
149
                          bool _pros=false) :
150 150
    g(_g), os(_os),
... ...
@@ -177,3 +177,3 @@
177 177
///For detailed examples see the \ref graph_to_eps_demo.cc demo file.
178
template<class T> class GraphToEps : public T 
178
template<class T> class GraphToEps : public T
179 179
{
... ...
@@ -196,3 +196,3 @@
196 196
  using T::_nodeBorderQuotient;
197
  
197

	
198 198
  using T::_drawArrows;
... ...
@@ -200,3 +200,3 @@
200 200
  using T::_arrowWidth;
201
  
201

	
202 202
  using T::_showNodes;
... ...
@@ -208,3 +208,3 @@
208 208
  using T::_showNodeText;
209
  using T::_nodeTexts;  
209
  using T::_nodeTexts;
210 210
  using T::_nodeTextSize;
... ...
@@ -212,5 +212,5 @@
212 212
  using T::_showNodePsText;
213
  using T::_nodePsTexts;  
213
  using T::_nodePsTexts;
214 214
  using T::_nodePsTextsPreamble;
215
  
215

	
216 216
  using T::_undirected;
... ...
@@ -263,3 +263,3 @@
263 263
  ///
264
  enum NodeShapes { 
264
  enum NodeShapes {
265 265
    /// = 0
... ...
@@ -267,3 +267,3 @@
267 267
    ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
268
    CIRCLE=0, 
268
    CIRCLE=0,
269 269
    /// = 1
... ...
@@ -272,3 +272,3 @@
272 272
    ///
273
    SQUARE=1, 
273
    SQUARE=1,
274 274
    /// = 2
... ...
@@ -295,3 +295,3 @@
295 295
    arcLess(const Graph &_g) : g(_g) {}
296
    bool operator()(Arc a,Arc b) const 
296
    bool operator()(Arc a,Arc b) const
297 297
    {
... ...
@@ -302,4 +302,4 @@
302 302
      return ai<bi ||
303
	(ai==bi && (aa < ba || 
304
		    (aa==ba && ai==g.source(a) && bi==g.target(b))));
303
        (ai==bi && (aa < ba ||
304
                    (aa==ba && ai==g.source(a) && bi==g.target(b))));
305 305
    }
... ...
@@ -309,3 +309,3 @@
309 309
    return (g.source(e)==g.source(f)&&
310
	    g.target(e)==g.target(f)) ||
310
            g.target(e)==g.target(f)) ||
311 311
      (g.source(e)==g.target(f)&&
... ...
@@ -314,5 +314,5 @@
314 314
  template<class TT>
315
  static std::string psOut(const dim2::Point<TT> &p) 
315
  static std::string psOut(const dim2::Point<TT> &p)
316 316
    {
317
      std::ostringstream os;	
317
      std::ostringstream os;
318 318
      os << p.x << ' ' << p.y;
... ...
@@ -320,5 +320,5 @@
320 320
    }
321
  static std::string psOut(const Color &c) 
321
  static std::string psOut(const Color &c)
322 322
    {
323
      std::ostringstream os;	
323
      std::ostringstream os;
324 324
      os << c.red() << ' ' << c.green() << ' ' << c.blue();
... ...
@@ -326,6 +326,6 @@
326 326
    }
327
  
327

	
328 328
public:
329 329
  GraphToEps(const T &t) : T(t), dontPrint(false) {};
330
  
330

	
331 331
  template<class X> struct CoordsTraits : public T {
... ...
@@ -339,3 +339,3 @@
339 339
  ///\param x must be a node map with \ref dim2::Point "dim2::Point<double>" or
340
  ///\ref dim2::Point "dim2::Point<int>" values. 
340
  ///\ref dim2::Point "dim2::Point<int>" values.
341 341
  template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
... ...
@@ -351,3 +351,3 @@
351 351
  ///Sets the map of the node sizes.
352
  ///\param x must be a node map with \c double (or convertible) values. 
352
  ///\param x must be a node map with \c double (or convertible) values.
353 353
  template<class X> GraphToEps<NodeSizesTraits<X> > nodeSizes(const X &x)
... ...
@@ -366,3 +366,3 @@
366 366
  ///can be found in \ref NodeShapes "enum NodeShapes".
367
  ///\param x must be a node map with \c int (or convertible) values. 
367
  ///\param x must be a node map with \c int (or convertible) values.
368 368
  ///\sa NodeShapes
... ...
@@ -381,3 +381,3 @@
381 381
  ///\param x must be a node map with type that can be pushed to a standard
382
  ///\c ostream. 
382
  ///\c ostream.
383 383
  template<class X> GraphToEps<NodeTextsTraits<X> > nodeTexts(const X &x)
... ...
@@ -419,3 +419,3 @@
419 419
  ///Sets the map of the arc widths.
420
  ///\param x must be an arc map with \c double (or convertible) values. 
420
  ///\param x must be an arc map with \c double (or convertible) values.
421 421
  template<class X> GraphToEps<ArcWidthsTraits<X> > arcWidths(const X &x)
... ...
@@ -449,3 +449,3 @@
449 449
  ///Sets the map of the node text colors.
450
  ///\param x must be a node map with \ref Color values. 
450
  ///\param x must be a node map with \ref Color values.
451 451
  ///
... ...
@@ -467,3 +467,3 @@
467 467
  ///Sets the map of the arc colors.
468
  ///\param x must be an arc map with \ref Color values. 
468
  ///\param x must be an arc map with \ref Color values.
469 469
  ///
... ...
@@ -479,3 +479,3 @@
479 479
  ///Sets a global scale factor for node sizes.
480
  /// 
480
  ///
481 481
  /// If nodeSizes() is not given, this function simply sets the node
... ...
@@ -570,12 +570,12 @@
570 570
  GraphToEps<T> &arrowWidth(double d=.3) {_arrowWidth*=d;return *this;}
571
  
571

	
572 572
  ///Scales the drawing to fit to A4 page
573 573
  GraphToEps<T> &scaleToA4() {_scaleToA4=true;return *this;}
574
  
574

	
575 575
  ///Enables parallel arcs
576 576
  GraphToEps<T> &enableParallel(bool b=true) {_enableParallel=b;return *this;}
577
  
577

	
578 578
  ///Sets the distance between parallel arcs
579 579
  GraphToEps<T> &parArcDist(double d) {_parArcDist*=d;return *this;}
580
  
580

	
581 581
  ///Hides the arcs
... ...
@@ -584,3 +584,3 @@
584 584
  GraphToEps<T> &hideNodes(bool b=true) {_showNodes=!b;return *this;}
585
  
585

	
586 586
  ///Sets the size of the node texts
... ...
@@ -602,3 +602,3 @@
602 602
  ///Gives a preamble block for node Postscript block.
603
  
603

	
604 604
  ///Gives a preamble block for node Postscript block.
... ...
@@ -627,3 +627,3 @@
627 627
  GraphToEps<T> &directed(bool b=true) {_undirected=!b;return *this;}
628
  
628

	
629 629
  ///Sets the title.
... ...
@@ -642,3 +642,3 @@
642 642
protected:
643
  bool isInsideNode(dim2::Point<double> p, double r,int t) 
643
  bool isInsideNode(dim2::Point<double> p, double r,int t)
644 644
  {
... ...
@@ -659,3 +659,3 @@
659 659
  ~GraphToEps() { }
660
  
660

	
661 661
  ///Draws the graph.
... ...
@@ -670,3 +670,3 @@
670 670
    if(dontPrint) return;
671
    
671

	
672 672
    _graph_to_eps_bits::_NegY<typename T::CoordsMapType>
... ...
@@ -679,4 +679,4 @@
679 679

	
680
    {    
681
#ifndef WIN32 
680
    {
681
#ifndef WIN32
682 682
      timeval tv;
... ...
@@ -690,13 +690,13 @@
690 690
      char buf1[11], buf2[9], buf3[5];
691
      
691

	
692 692
      GetSystemTime(&time);
693
      if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 
694
			"ddd MMM dd", buf1, 11) &&
695
	  GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, 
696
			"HH':'mm':'ss", buf2, 9) &&
697
	  GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 
698
				"yyyy", buf3, 5)) {
699
	os << "%%CreationDate: " << buf1 << ' ' 
700
	   << buf2 << ' ' << buf3 << std::endl;
701
      }	  
693
      if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
694
                        "ddd MMM dd", buf1, 11) &&
695
          GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
696
                        "HH':'mm':'ss", buf2, 9) &&
697
          GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
698
                                "yyyy", buf3, 5)) {
699
        os << "%%CreationDate: " << buf1 << ' '
700
           << buf2 << ' ' << buf3 << std::endl;
701
      }
702 702
#endif
... ...
@@ -707,6 +707,6 @@
707 707
      for(ArcIt e(g);e!=INVALID;++e)
708
	max_w=std::max(double(_arcWidths[e]),max_w);
708
        max_w=std::max(double(_arcWidths[e]),max_w);
709 709
      //\todo better 'epsilon' would be nice here.
710 710
      if(max_w>EPSILON) {
711
	_arcWidthScale/=max_w;
711
        _arcWidthScale/=max_w;
712 712
      }
... ...
@@ -717,6 +717,6 @@
717 717
      for(NodeIt n(g);n!=INVALID;++n)
718
	max_s=std::max(double(_nodeSizes[n]),max_s);
718
        max_s=std::max(double(_nodeSizes[n]),max_s);
719 719
      //\todo better 'epsilon' would be nice here.
720 720
      if(max_s>EPSILON) {
721
	_nodeScale/=max_s;
721
        _nodeScale/=max_s;
722 722
      }
... ...
@@ -729,3 +729,3 @@
729 729
      if (bb.empty()) {
730
	bb = dim2::BoundingBox<double>(dim2::Point<double>(0,0));
730
        bb = dim2::BoundingBox<double>(dim2::Point<double>(0,0));
731 731
      }
... ...
@@ -736,3 +736,3 @@
736 736
    }
737
    
737

	
738 738
    dim2::BoundingBox<double> bb;
... ...
@@ -745,13 +745,13 @@
745 745
      case DIAMOND:
746
	bb.add(p+mycoords[n]);
747
	bb.add(-p+mycoords[n]);
748
	break;
746
        bb.add(p+mycoords[n]);
747
        bb.add(-p+mycoords[n]);
748
        break;
749 749
      case MALE:
750
	bb.add(-p+mycoords[n]);
751
	bb.add(dim2::Point<double>(1.5*ns,1.5*std::sqrt(3.0)*ns)+mycoords[n]);
752
	break;
750
        bb.add(-p+mycoords[n]);
751
        bb.add(dim2::Point<double>(1.5*ns,1.5*std::sqrt(3.0)*ns)+mycoords[n]);
752
        break;
753 753
      case FEMALE:
754
	bb.add(p+mycoords[n]);
755
	bb.add(dim2::Point<double>(-ns,-3.01*ns)+mycoords[n]);
756
	break;
754
        bb.add(p+mycoords[n]);
755
        bb.add(dim2::Point<double>(-ns,-3.01*ns)+mycoords[n]);
756
        break;
757 757
      }
... ...
@@ -761,3 +761,3 @@
761 761
    }
762
    
762

	
763 763
    if(_scaleToA4)
... ...
@@ -766,16 +766,16 @@
766 766
      if(_preScale) {
767
	//Rescale so that BoundingBox won't be neither to big nor too small.
768
	while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10;
769
	while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10;
767
        //Rescale so that BoundingBox won't be neither to big nor too small.
768
        while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10;
769
        while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10;
770 770
      }
771
      
771

	
772 772
      os << "%%BoundingBox: "
773
	 << int(floor(bb.left()   * _scale - _xBorder)) << ' '
774
	 << int(floor(bb.bottom() * _scale - _yBorder)) << ' '
775
	 << int(ceil(bb.right()  * _scale + _xBorder)) << ' '
776
	 << int(ceil(bb.top()    * _scale + _yBorder)) << '\n';
773
         << int(floor(bb.left()   * _scale - _xBorder)) << ' '
774
         << int(floor(bb.bottom() * _scale - _yBorder)) << ' '
775
         << int(ceil(bb.right()  * _scale + _xBorder)) << ' '
776
         << int(ceil(bb.top()    * _scale + _yBorder)) << '\n';
777 777
    }
778
    
778

	
779 779
    os << "%%EndComments\n";
780
    
780

	
781 781
    //x1 y1 x2 y2 x3 y3 cr cg cb w
... ...
@@ -833,3 +833,3 @@
833 833
       << "  } bind def\n";
834
    
834

	
835 835

	
... ...
@@ -842,3 +842,3 @@
842 842
       << "       /w exch def /len exch def\n"
843
      //	 << "       0.1 setlinewidth x1 y1 moveto dx len mul dy len mul rlineto stroke"
843
      //         << "       0.1 setlinewidth x1 y1 moveto dx len mul dy len mul rlineto stroke"
844 844
       << "       newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto\n"
... ...
@@ -859,148 +859,148 @@
859 859
      if(bb.height()>bb.width()) {
860
	double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.height(),
861
		  (A4WIDTH-2*A4BORDER)/bb.width());
862
	os << ((A4WIDTH -2*A4BORDER)-sc*bb.width())/2 + A4BORDER << ' '
863
	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER
864
	   << " translate\n"
865
	   << sc << " dup scale\n"
866
	   << -bb.left() << ' ' << -bb.bottom() << " translate\n";
860
        double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.height(),
861
                  (A4WIDTH-2*A4BORDER)/bb.width());
862
        os << ((A4WIDTH -2*A4BORDER)-sc*bb.width())/2 + A4BORDER << ' '
863
           << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER
864
           << " translate\n"
865
           << sc << " dup scale\n"
866
           << -bb.left() << ' ' << -bb.bottom() << " translate\n";
867 867
      }
868 868
      else {
869
	//\todo Verify centering
870
	double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.width(),
871
		  (A4WIDTH-2*A4BORDER)/bb.height());
872
	os << ((A4WIDTH -2*A4BORDER)-sc*bb.height())/2 + A4BORDER << ' '
873
	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER 
874
	   << " translate\n"
875
	   << sc << " dup scale\n90 rotate\n"
876
	   << -bb.left() << ' ' << -bb.top() << " translate\n";	
877
	}
869
        //\todo Verify centering
870
        double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.width(),
871
                  (A4WIDTH-2*A4BORDER)/bb.height());
872
        os << ((A4WIDTH -2*A4BORDER)-sc*bb.height())/2 + A4BORDER << ' '
873
           << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER
874
           << " translate\n"
875
           << sc << " dup scale\n90 rotate\n"
876
           << -bb.left() << ' ' << -bb.top() << " translate\n";
877
        }
878 878
    else if(_scale!=1.0) os << _scale << " dup scale\n";
879
    
879

	
880 880
    if(_showArcs) {
881
      os << "%Arcs:\ngsave\n";      
881
      os << "%Arcs:\ngsave\n";
882 882
      if(_enableParallel) {
883
	std::vector<Arc> el;
884
	for(ArcIt e(g);e!=INVALID;++e)
885
	  if((!_undirected||g.source(e)<g.target(e))&&_arcWidths[e]>0
886
	     &&g.source(e)!=g.target(e))
887
	    el.push_back(e);
888
	std::sort(el.begin(),el.end(),arcLess(g));
889
	
890
	typename std::vector<Arc>::iterator j;
891
	for(typename std::vector<Arc>::iterator i=el.begin();i!=el.end();i=j) {
892
	  for(j=i+1;j!=el.end()&&isParallel(*i,*j);++j) ;
883
        std::vector<Arc> el;
884
        for(ArcIt e(g);e!=INVALID;++e)
885
          if((!_undirected||g.source(e)<g.target(e))&&_arcWidths[e]>0
886
             &&g.source(e)!=g.target(e))
887
            el.push_back(e);
888
        std::sort(el.begin(),el.end(),arcLess(g));
893 889

	
894
	  double sw=0;
895
	  for(typename std::vector<Arc>::iterator e=i;e!=j;++e)
896
	    sw+=_arcWidths[*e]*_arcWidthScale+_parArcDist;
897
	  sw-=_parArcDist;
898
	  sw/=-2.0;
899
	  dim2::Point<double>
900
	    dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]);
901
	  double l=std::sqrt(dvec.normSquare()); 
902
	  //\todo better 'epsilon' would be nice here.
903
	  dim2::Point<double> d(dvec/std::max(l,EPSILON));
904
 	  dim2::Point<double> m;
905
// 	  m=dim2::Point<double>(mycoords[g.target(*i)]+mycoords[g.source(*i)])/2.0;
890
        typename std::vector<Arc>::iterator j;
891
        for(typename std::vector<Arc>::iterator i=el.begin();i!=el.end();i=j) {
892
          for(j=i+1;j!=el.end()&&isParallel(*i,*j);++j) ;
906 893

	
907
//  	  m=dim2::Point<double>(mycoords[g.source(*i)])+
908
// 	    dvec*(double(_nodeSizes[g.source(*i)])/
909
// 	       (_nodeSizes[g.source(*i)]+_nodeSizes[g.target(*i)]));
894
          double sw=0;
895
          for(typename std::vector<Arc>::iterator e=i;e!=j;++e)
896
            sw+=_arcWidths[*e]*_arcWidthScale+_parArcDist;
897
          sw-=_parArcDist;
898
          sw/=-2.0;
899
          dim2::Point<double>
900
            dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]);
901
          double l=std::sqrt(dvec.normSquare());
902
          //\todo better 'epsilon' would be nice here.
903
          dim2::Point<double> d(dvec/std::max(l,EPSILON));
904
           dim2::Point<double> m;
905
//           m=dim2::Point<double>(mycoords[g.target(*i)]+mycoords[g.source(*i)])/2.0;
910 906

	
911
 	  m=dim2::Point<double>(mycoords[g.source(*i)])+
912
	    d*(l+_nodeSizes[g.source(*i)]-_nodeSizes[g.target(*i)])/2.0;
907
//            m=dim2::Point<double>(mycoords[g.source(*i)])+
908
//             dvec*(double(_nodeSizes[g.source(*i)])/
909
//                (_nodeSizes[g.source(*i)]+_nodeSizes[g.target(*i)]));
913 910

	
914
	  for(typename std::vector<Arc>::iterator e=i;e!=j;++e) {
915
	    sw+=_arcWidths[*e]*_arcWidthScale/2.0;
916
	    dim2::Point<double> mm=m+rot90(d)*sw/.75;
917
	    if(_drawArrows) {
918
	      int node_shape;
919
	      dim2::Point<double> s=mycoords[g.source(*e)];
920
	      dim2::Point<double> t=mycoords[g.target(*e)];
921
	      double rn=_nodeSizes[g.target(*e)]*_nodeScale;
922
	      node_shape=_nodeShapes[g.target(*e)];
923
	      dim2::Bezier3 bez(s,mm,mm,t);
924
	      double t1=0,t2=1;
925
	      for(int ii=0;ii<INTERPOL_PREC;++ii)
926
		if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
927
		else t1=(t1+t2)/2;
928
	      dim2::Point<double> apoint=bez((t1+t2)/2);
929
	      rn = _arrowLength+_arcWidths[*e]*_arcWidthScale;
930
	      rn*=rn;
931
	      t2=(t1+t2)/2;t1=0;
932
	      for(int ii=0;ii<INTERPOL_PREC;++ii)
933
		if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
934
		else t2=(t1+t2)/2;
935
	      dim2::Point<double> linend=bez((t1+t2)/2);	      
936
	      bez=bez.before((t1+t2)/2);
937
// 	      rn=_nodeSizes[g.source(*e)]*_nodeScale;
938
// 	      node_shape=_nodeShapes[g.source(*e)];
939
// 	      t1=0;t2=1;
940
// 	      for(int i=0;i<INTERPOL_PREC;++i)
941
// 		if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
942
// 		else t2=(t1+t2)/2;
943
// 	      bez=bez.after((t1+t2)/2);
944
	      os << _arcWidths[*e]*_arcWidthScale << " setlinewidth "
945
		 << _arcColors[*e].red() << ' '
946
		 << _arcColors[*e].green() << ' '
947
		 << _arcColors[*e].blue() << " setrgbcolor newpath\n"
948
		 << bez.p1.x << ' ' <<  bez.p1.y << " moveto\n"
949
		 << bez.p2.x << ' ' << bez.p2.y << ' '
950
		 << bez.p3.x << ' ' << bez.p3.y << ' '
951
		 << bez.p4.x << ' ' << bez.p4.y << " curveto stroke\n";
952
	      dim2::Point<double> dd(rot90(linend-apoint));
953
	      dd*=(.5*_arcWidths[*e]*_arcWidthScale+_arrowWidth)/
954
		std::sqrt(dd.normSquare());
955
	      os << "newpath " << psOut(apoint) << " moveto "
956
		 << psOut(linend+dd) << " lineto "
957
		 << psOut(linend-dd) << " lineto closepath fill\n";
958
	    }
959
	    else {
960
	      os << mycoords[g.source(*e)].x << ' '
961
		 << mycoords[g.source(*e)].y << ' '
962
		 << mm.x << ' ' << mm.y << ' '
963
		 << mycoords[g.target(*e)].x << ' '
964
		 << mycoords[g.target(*e)].y << ' '
965
		 << _arcColors[*e].red() << ' '
966
		 << _arcColors[*e].green() << ' '
967
		 << _arcColors[*e].blue() << ' '
968
		 << _arcWidths[*e]*_arcWidthScale << " lb\n";
969
	    }
970
	    sw+=_arcWidths[*e]*_arcWidthScale/2.0+_parArcDist;
971
	  }
972
	}
911
           m=dim2::Point<double>(mycoords[g.source(*i)])+
912
            d*(l+_nodeSizes[g.source(*i)]-_nodeSizes[g.target(*i)])/2.0;
913

	
914
          for(typename std::vector<Arc>::iterator e=i;e!=j;++e) {
915
            sw+=_arcWidths[*e]*_arcWidthScale/2.0;
916
            dim2::Point<double> mm=m+rot90(d)*sw/.75;
917
            if(_drawArrows) {
918
              int node_shape;
919
              dim2::Point<double> s=mycoords[g.source(*e)];
920
              dim2::Point<double> t=mycoords[g.target(*e)];
921
              double rn=_nodeSizes[g.target(*e)]*_nodeScale;
922
              node_shape=_nodeShapes[g.target(*e)];
923
              dim2::Bezier3 bez(s,mm,mm,t);
924
              double t1=0,t2=1;
925
              for(int ii=0;ii<INTERPOL_PREC;++ii)
926
                if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
927
                else t1=(t1+t2)/2;
928
              dim2::Point<double> apoint=bez((t1+t2)/2);
929
              rn = _arrowLength+_arcWidths[*e]*_arcWidthScale;
930
              rn*=rn;
931
              t2=(t1+t2)/2;t1=0;
932
              for(int ii=0;ii<INTERPOL_PREC;++ii)
933
                if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
934
                else t2=(t1+t2)/2;
935
              dim2::Point<double> linend=bez((t1+t2)/2);
936
              bez=bez.before((t1+t2)/2);
937
//               rn=_nodeSizes[g.source(*e)]*_nodeScale;
938
//               node_shape=_nodeShapes[g.source(*e)];
939
//               t1=0;t2=1;
940
//               for(int i=0;i<INTERPOL_PREC;++i)
941
//                 if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
942
//                 else t2=(t1+t2)/2;
943
//               bez=bez.after((t1+t2)/2);
944
              os << _arcWidths[*e]*_arcWidthScale << " setlinewidth "
945
                 << _arcColors[*e].red() << ' '
946
                 << _arcColors[*e].green() << ' '
947
                 << _arcColors[*e].blue() << " setrgbcolor newpath\n"
948
                 << bez.p1.x << ' ' <<  bez.p1.y << " moveto\n"
949
                 << bez.p2.x << ' ' << bez.p2.y << ' '
950
                 << bez.p3.x << ' ' << bez.p3.y << ' '
951
                 << bez.p4.x << ' ' << bez.p4.y << " curveto stroke\n";
952
              dim2::Point<double> dd(rot90(linend-apoint));
953
              dd*=(.5*_arcWidths[*e]*_arcWidthScale+_arrowWidth)/
954
                std::sqrt(dd.normSquare());
955
              os << "newpath " << psOut(apoint) << " moveto "
956
                 << psOut(linend+dd) << " lineto "
957
                 << psOut(linend-dd) << " lineto closepath fill\n";
958
            }
959
            else {
960
              os << mycoords[g.source(*e)].x << ' '
961
                 << mycoords[g.source(*e)].y << ' '
962
                 << mm.x << ' ' << mm.y << ' '
963
                 << mycoords[g.target(*e)].x << ' '
964
                 << mycoords[g.target(*e)].y << ' '
965
                 << _arcColors[*e].red() << ' '
966
                 << _arcColors[*e].green() << ' '
967
                 << _arcColors[*e].blue() << ' '
968
                 << _arcWidths[*e]*_arcWidthScale << " lb\n";
969
            }
970
            sw+=_arcWidths[*e]*_arcWidthScale/2.0+_parArcDist;
971
          }
972
        }
973 973
      }
974 974
      else for(ArcIt e(g);e!=INVALID;++e)
975
	if((!_undirected||g.source(e)<g.target(e))&&_arcWidths[e]>0
976
	   &&g.source(e)!=g.target(e)) {
977
	  if(_drawArrows) {
978
	    dim2::Point<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]);
979
	    double rn=_nodeSizes[g.target(e)]*_nodeScale;
980
	    int node_shape=_nodeShapes[g.target(e)];
981
	    double t1=0,t2=1;
982
	    for(int i=0;i<INTERPOL_PREC;++i)
983
	      if(isInsideNode((-(t1+t2)/2)*d,rn,node_shape)) t1=(t1+t2)/2;
984
	      else t2=(t1+t2)/2;
985
	    double l=std::sqrt(d.normSquare());
986
	    d/=l;
987
	    
988
	    os << l*(1-(t1+t2)/2) << ' '
989
	       << _arcWidths[e]*_arcWidthScale << ' '
990
	       << d.x << ' ' << d.y << ' '
991
	       << mycoords[g.source(e)].x << ' '
992
	       << mycoords[g.source(e)].y << ' '
993
	       << _arcColors[e].red() << ' '
994
	       << _arcColors[e].green() << ' '
995
	       << _arcColors[e].blue() << " arr\n";
996
	  } 
997
	  else os << mycoords[g.source(e)].x << ' '
998
		  << mycoords[g.source(e)].y << ' '
999
		  << mycoords[g.target(e)].x << ' '
1000
		  << mycoords[g.target(e)].y << ' '
1001
		  << _arcColors[e].red() << ' '
1002
		  << _arcColors[e].green() << ' '
1003
		  << _arcColors[e].blue() << ' '
1004
		  << _arcWidths[e]*_arcWidthScale << " l\n";
1005
	}
975
        if((!_undirected||g.source(e)<g.target(e))&&_arcWidths[e]>0
976
           &&g.source(e)!=g.target(e)) {
977
          if(_drawArrows) {
978
            dim2::Point<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]);
979
            double rn=_nodeSizes[g.target(e)]*_nodeScale;
980
            int node_shape=_nodeShapes[g.target(e)];
981
            double t1=0,t2=1;
982
            for(int i=0;i<INTERPOL_PREC;++i)
983
              if(isInsideNode((-(t1+t2)/2)*d,rn,node_shape)) t1=(t1+t2)/2;
984
              else t2=(t1+t2)/2;
985
            double l=std::sqrt(d.normSquare());
986
            d/=l;
987

	
988
            os << l*(1-(t1+t2)/2) << ' '
989
               << _arcWidths[e]*_arcWidthScale << ' '
990
               << d.x << ' ' << d.y << ' '
991
               << mycoords[g.source(e)].x << ' '
992
               << mycoords[g.source(e)].y << ' '
993
               << _arcColors[e].red() << ' '
994
               << _arcColors[e].green() << ' '
995
               << _arcColors[e].blue() << " arr\n";
996
          }
997
          else os << mycoords[g.source(e)].x << ' '
998
                  << mycoords[g.source(e)].y << ' '
999
                  << mycoords[g.target(e)].x << ' '
1000
                  << mycoords[g.target(e)].y << ' '
1001
                  << _arcColors[e].red() << ' '
1002
                  << _arcColors[e].green() << ' '
1003
                  << _arcColors[e].blue() << ' '
1004
                  << _arcWidths[e]*_arcWidthScale << " l\n";
1005
        }
1006 1006
      os << "grestore\n";
... ...
@@ -1010,20 +1010,20 @@
1010 1010
      for(NodeIt n(g);n!=INVALID;++n) {
1011
	os << mycoords[n].x << ' ' << mycoords[n].y << ' '
1012
	   << _nodeSizes[n]*_nodeScale << ' '
1013
	   << _nodeColors[n].red() << ' '
1014
	   << _nodeColors[n].green() << ' '
1015
	   << _nodeColors[n].blue() << ' ';
1016
	switch(_nodeShapes[n]) {
1017
	case CIRCLE:
1018
	  os<< "nc";break;
1019
	case SQUARE:
1020
	  os<< "nsq";break;
1021
	case DIAMOND:
1022
	  os<< "ndi";break;
1023
	case MALE:
1024
	  os<< "nmale";break;
1025
	case FEMALE:
1026
	  os<< "nfemale";break;
1027
	}
1028
	os<<'\n';
1011
        os << mycoords[n].x << ' ' << mycoords[n].y << ' '
1012
           << _nodeSizes[n]*_nodeScale << ' '
1013
           << _nodeColors[n].red() << ' '
1014
           << _nodeColors[n].green() << ' '
1015
           << _nodeColors[n].blue() << ' ';
1016
        switch(_nodeShapes[n]) {
1017
        case CIRCLE:
1018
          os<< "nc";break;
1019
        case SQUARE:
1020
          os<< "nsq";break;
1021
        case DIAMOND:
1022
          os<< "ndi";break;
1023
        case MALE:
1024
          os<< "nmale";break;
1025
        case FEMALE:
1026
          os<< "nfemale";break;
1027
        }
1028
        os<<'\n';
1029 1029
      }
... ...
@@ -1036,17 +1036,17 @@
1036 1036
      for(NodeIt n(g);n!=INVALID;++n) {
1037
	switch(_nodeTextColorType) {
1038
	case DIST_COL:
1039
	  os << psOut(distantColor(_nodeColors[n])) << " setrgbcolor\n";
1040
	  break;
1041
	case DIST_BW:
1042
	  os << psOut(distantBW(_nodeColors[n])) << " setrgbcolor\n";
1043
	  break;
1044
	case CUST_COL:
1045
	  os << psOut(distantColor(_nodeTextColors[n])) << " setrgbcolor\n";
1046
	  break;
1047
	default:
1048
	  os << "0 0 0 setrgbcolor\n";
1049
	}
1050
	os << mycoords[n].x << ' ' << mycoords[n].y
1051
	   << " (" << _nodeTexts[n] << ") cshow\n";
1037
        switch(_nodeTextColorType) {
1038
        case DIST_COL:
1039
          os << psOut(distantColor(_nodeColors[n])) << " setrgbcolor\n";
1040
          break;
1041
        case DIST_BW:
1042
          os << psOut(distantBW(_nodeColors[n])) << " setrgbcolor\n";
1043
          break;
1044
        case CUST_COL:
1045
          os << psOut(distantColor(_nodeTextColors[n])) << " setrgbcolor\n";
1046
          break;
1047
        default:
1048
          os << "0 0 0 setrgbcolor\n";
1049
        }
1050
        os << mycoords[n].x << ' ' << mycoords[n].y
1051
           << " (" << _nodeTexts[n] << ") cshow\n";
1052 1052
      }
... ...
@@ -1057,7 +1057,7 @@
1057 1057
      for(NodeIt n(g);n!=INVALID;++n)
1058
	os << mycoords[n].x << ' ' << mycoords[n].y
1059
	   << " moveto\n" << _nodePsTexts[n] << "\n";
1058
        os << mycoords[n].x << ' ' << mycoords[n].y
1059
           << " moveto\n" << _nodePsTexts[n] << "\n";
1060 1060
      os << "grestore\n";
1061 1061
    }
1062
    
1062

	
1063 1063
    os << "grestore\nshowpage\n";
... ...
@@ -1094,3 +1094,3 @@
1094 1094
  }
1095
  
1095

	
1096 1096
  ///An alias for absoluteArcWidths()
... ...
@@ -1100,6 +1100,6 @@
1100 1100
  }
1101
  
1101

	
1102 1102
  ///An alias for parArcDist()
1103 1103
  GraphToEps<T> &parEdgeDist(double d) {return parArcDist(d);}
1104
  
1104

	
1105 1105
  ///An alias for hideArcs()
... ...
@@ -1145,9 +1145,9 @@
1145 1145
template<class G>
1146
GraphToEps<DefaultGraphToEpsTraits<G> > 
1146
GraphToEps<DefaultGraphToEpsTraits<G> >
1147 1147
graphToEps(G &g, std::ostream& os=std::cout)
1148 1148
{
1149
  return 
1149
  return
1150 1150
    GraphToEps<DefaultGraphToEpsTraits<G> >(DefaultGraphToEpsTraits<G>(g,os));
1151 1151
}
1152
 
1152

	
1153 1153
///Generates an EPS file from a graph
... ...
@@ -1161,3 +1161,3 @@
1161 1161
template<class G>
1162
GraphToEps<DefaultGraphToEpsTraits<G> > 
1162
GraphToEps<DefaultGraphToEpsTraits<G> >
1163 1163
graphToEps(G &g,const char *file_name)
... ...
@@ -1177,3 +1177,3 @@
1177 1177
template<class G>
1178
GraphToEps<DefaultGraphToEpsTraits<G> > 
1178
GraphToEps<DefaultGraphToEpsTraits<G> >
1179 1179
graphToEps(G &g,const std::string& file_name)
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -48,3 +48,3 @@
48 48
  ///of \c Digraph: \c Node,  \c NodeIt, \c Arc, \c ArcIt, \c InArcIt,
49
  ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap, 
49
  ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap,
50 50
  ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap.
... ...
@@ -54,14 +54,14 @@
54 54
  ///macro.
55
#define DIGRAPH_TYPEDEFS(Digraph)					\
56
  typedef Digraph::Node Node;						\
57
  typedef Digraph::NodeIt NodeIt;					\
58
  typedef Digraph::Arc Arc;						\
59
  typedef Digraph::ArcIt ArcIt;						\
60
  typedef Digraph::InArcIt InArcIt;					\
61
  typedef Digraph::OutArcIt OutArcIt;					\
62
  typedef Digraph::NodeMap<bool> BoolNodeMap;				\
63
  typedef Digraph::NodeMap<int> IntNodeMap;				\
64
  typedef Digraph::NodeMap<double> DoubleNodeMap;			\
65
  typedef Digraph::ArcMap<bool> BoolArcMap;				\
66
  typedef Digraph::ArcMap<int> IntArcMap;				\
55
#define DIGRAPH_TYPEDEFS(Digraph)                                        \
56
  typedef Digraph::Node Node;                                                \
57
  typedef Digraph::NodeIt NodeIt;                                        \
58
  typedef Digraph::Arc Arc;                                                \
59
  typedef Digraph::ArcIt ArcIt;                                                \
60
  typedef Digraph::InArcIt InArcIt;                                        \
61
  typedef Digraph::OutArcIt OutArcIt;                                        \
62
  typedef Digraph::NodeMap<bool> BoolNodeMap;                                \
63
  typedef Digraph::NodeMap<int> IntNodeMap;                                \
64
  typedef Digraph::NodeMap<double> DoubleNodeMap;                        \
65
  typedef Digraph::ArcMap<bool> BoolArcMap;                                \
66
  typedef Digraph::ArcMap<int> IntArcMap;                                \
67 67
  typedef Digraph::ArcMap<double> DoubleArcMap
... ...
@@ -74,16 +74,16 @@
74 74
  ///ie. the graph type depend on a template parameter.
75
#define TEMPLATE_DIGRAPH_TYPEDEFS(Digraph)				\
76
  typedef typename Digraph::Node Node;					\
77
  typedef typename Digraph::NodeIt NodeIt;				\
78
  typedef typename Digraph::Arc Arc;					\
79
  typedef typename Digraph::ArcIt ArcIt;				\
80
  typedef typename Digraph::InArcIt InArcIt;				\
81
  typedef typename Digraph::OutArcIt OutArcIt;				\
82
  typedef typename Digraph::template NodeMap<bool> BoolNodeMap;		\
83
  typedef typename Digraph::template NodeMap<int> IntNodeMap;		\
84
  typedef typename Digraph::template NodeMap<double> DoubleNodeMap;	\
85
  typedef typename Digraph::template ArcMap<bool> BoolArcMap;		\
86
  typedef typename Digraph::template ArcMap<int> IntArcMap;		\
75
#define TEMPLATE_DIGRAPH_TYPEDEFS(Digraph)                                \
76
  typedef typename Digraph::Node Node;                                        \
77
  typedef typename Digraph::NodeIt NodeIt;                                \
78
  typedef typename Digraph::Arc Arc;                                        \
79
  typedef typename Digraph::ArcIt ArcIt;                                \
80
  typedef typename Digraph::InArcIt InArcIt;                                \
81
  typedef typename Digraph::OutArcIt OutArcIt;                                \
82
  typedef typename Digraph::template NodeMap<bool> BoolNodeMap;                \
83
  typedef typename Digraph::template NodeMap<int> IntNodeMap;                \
84
  typedef typename Digraph::template NodeMap<double> DoubleNodeMap;        \
85
  typedef typename Digraph::template ArcMap<bool> BoolArcMap;                \
86
  typedef typename Digraph::template ArcMap<int> IntArcMap;                \
87 87
  typedef typename Digraph::template ArcMap<double> DoubleArcMap
88
  
88

	
89 89
  ///Creates convenience typedefs for the graph types and iterators
... ...
@@ -98,9 +98,9 @@
98 98
  ///macro.
99
#define GRAPH_TYPEDEFS(Graph)						\
100
  DIGRAPH_TYPEDEFS(Graph);						\
101
  typedef Graph::Edge Edge;						\
102
  typedef Graph::EdgeIt EdgeIt;						\
103
  typedef Graph::IncEdgeIt IncEdgeIt;					\
104
  typedef Graph::EdgeMap<bool> BoolEdgeMap;				\
105
  typedef Graph::EdgeMap<int> IntEdgeMap;				\
99
#define GRAPH_TYPEDEFS(Graph)                                                \
100
  DIGRAPH_TYPEDEFS(Graph);                                                \
101
  typedef Graph::Edge Edge;                                                \
102
  typedef Graph::EdgeIt EdgeIt;                                                \
103
  typedef Graph::IncEdgeIt IncEdgeIt;                                        \
104
  typedef Graph::EdgeMap<bool> BoolEdgeMap;                                \
105
  typedef Graph::EdgeMap<int> IntEdgeMap;                                \
106 106
  typedef Graph::EdgeMap<double> DoubleEdgeMap
... ...
@@ -113,9 +113,9 @@
113 113
  ///ie. the graph type depend on a template parameter.
114
#define TEMPLATE_GRAPH_TYPEDEFS(Graph)					\
115
  TEMPLATE_DIGRAPH_TYPEDEFS(Graph);					\
116
  typedef typename Graph::Edge Edge;					\
117
  typedef typename Graph::EdgeIt EdgeIt;				\
118
  typedef typename Graph::IncEdgeIt IncEdgeIt;				\
119
  typedef typename Graph::template EdgeMap<bool> BoolEdgeMap;		\
120
  typedef typename Graph::template EdgeMap<int> IntEdgeMap;		\
114
#define TEMPLATE_GRAPH_TYPEDEFS(Graph)                                        \
115
  TEMPLATE_DIGRAPH_TYPEDEFS(Graph);                                        \
116
  typedef typename Graph::Edge Edge;                                        \
117
  typedef typename Graph::EdgeIt EdgeIt;                                \
118
  typedef typename Graph::IncEdgeIt IncEdgeIt;                                \
119
  typedef typename Graph::template EdgeMap<bool> BoolEdgeMap;                \
120
  typedef typename Graph::template EdgeMap<int> IntEdgeMap;                \
121 121
  typedef typename Graph::template EdgeMap<double> DoubleEdgeMap
... ...
@@ -140,3 +140,3 @@
140 140
  namespace _graph_utils_bits {
141
    
141

	
142 142
    template <typename Graph, typename Enable = void>
... ...
@@ -150,4 +150,4 @@
150 150
    struct CountNodesSelector<
151
      Graph, typename 
152
      enable_if<typename Graph::NodeNumTag, void>::type> 
151
      Graph, typename
152
      enable_if<typename Graph::NodeNumTag, void>::type>
153 153
    {
... ...
@@ -156,3 +156,3 @@
156 156
      }
157
    };    
157
    };
158 158
  }
... ...
@@ -165,3 +165,3 @@
165 165
  ///
166
  /// If the graph contains a \e nodeNum() member function and a 
166
  /// If the graph contains a \e nodeNum() member function and a
167 167
  /// \e NodeNumTag tag then this function calls directly the member
... ...
@@ -176,3 +176,3 @@
176 176
  namespace _graph_utils_bits {
177
    
177

	
178 178
    template <typename Graph, typename Enable = void>
... ...
@@ -186,4 +186,4 @@
186 186
    struct CountArcsSelector<
187
      Graph, 
188
      typename enable_if<typename Graph::ArcNumTag, void>::type> 
187
      Graph,
188
      typename enable_if<typename Graph::ArcNumTag, void>::type>
189 189
    {
... ...
@@ -192,3 +192,3 @@
192 192
      }
193
    };    
193
    };
194 194
  }
... ...
@@ -201,3 +201,3 @@
201 201
  ///
202
  /// If the graph contains a \e arcNum() member function and a 
202
  /// If the graph contains a \e arcNum() member function and a
203 203
  /// \e EdgeNumTag tag then this function calls directly the member
... ...
@@ -211,3 +211,3 @@
211 211
  namespace _graph_utils_bits {
212
    
212

	
213 213
    template <typename Graph, typename Enable = void>
... ...
@@ -221,4 +221,4 @@
221 221
    struct CountEdgesSelector<
222
      Graph, 
223
      typename enable_if<typename Graph::EdgeNumTag, void>::type> 
222
      Graph,
223
      typename enable_if<typename Graph::EdgeNumTag, void>::type>
224 224
    {
... ...
@@ -227,3 +227,3 @@
227 227
      }
228
    };    
228
    };
229 229
  }
... ...
@@ -236,3 +236,3 @@
236 236
  ///
237
  /// If the graph contains a \e edgeNum() member function and a 
237
  /// If the graph contains a \e edgeNum() member function and a
238 238
  /// \e EdgeNumTag tag then this function calls directly the member
... ...
@@ -258,3 +258,3 @@
258 258
  /// This function counts the number of the out-arcs from node \c n
259
  /// in the graph.  
259
  /// in the graph.
260 260
  template <typename Graph>
... ...
@@ -267,3 +267,3 @@
267 267
  /// This function counts the number of the in-arcs to node \c n
268
  /// in the graph.  
268
  /// in the graph.
269 269
  template <typename Graph>
... ...
@@ -276,3 +276,3 @@
276 276
  /// This function counts the number of the inc-edges to node \c n
277
  /// in the graph.  
277
  /// in the graph.
278 278
  template <typename Graph>
... ...
@@ -283,3 +283,3 @@
283 283
  namespace _graph_utils_bits {
284
    
284

	
285 285
    template <typename Graph, typename Enable = void>
... ...
@@ -303,4 +303,4 @@
303 303
    struct FindArcSelector<
304
      Graph, 
305
      typename enable_if<typename Graph::FindEdgeTag, void>::type> 
304
      Graph,
305
      typename enable_if<typename Graph::FindEdgeTag, void>::type>
306 306
    {
... ...
@@ -311,3 +311,3 @@
311 311
      }
312
    };    
312
    };
313 313
  }
... ...
@@ -335,3 +335,3 @@
335 335
  template <typename Graph>
336
  inline typename Graph::Arc 
336
  inline typename Graph::Arc
337 337
  findArc(const Graph &g, typename Graph::Node u, typename Graph::Node v,
... ...
@@ -343,3 +343,3 @@
343 343
  ///
344
  /// Iterator for iterating on arcs connected the same nodes. It is 
344
  /// Iterator for iterating on arcs connected the same nodes. It is
345 345
  /// higher level interface for the findArc() function. You can
... ...
@@ -351,3 +351,3 @@
351 351
  ///\endcode
352
  /// 
352
  ///
353 353
  ///\sa findArc()
... ...
@@ -376,6 +376,6 @@
376 376
    ///
377
    /// Construct a new ConArcIt which continues the iterating from 
377
    /// Construct a new ConArcIt which continues the iterating from
378 378
    /// the \c e arc.
379 379
    ConArcIt(const Graph& g, Arc a) : Parent(a), _graph(g) {}
380
    
380

	
381 381
    /// \brief Increment operator.
... ...
@@ -384,4 +384,4 @@
384 384
    ConArcIt& operator++() {
385
      Parent::operator=(findArc(_graph, _graph.source(*this), 
386
				_graph.target(*this), *this));
385
      Parent::operator=(findArc(_graph, _graph.source(*this),
386
                                _graph.target(*this), *this));
387 387
      return *this;
... ...
@@ -393,3 +393,3 @@
393 393
  namespace _graph_utils_bits {
394
    
394

	
395 395
    template <typename Graph, typename Enable = void>
... ...
@@ -427,4 +427,4 @@
427 427
    struct FindEdgeSelector<
428
      Graph, 
429
      typename enable_if<typename Graph::FindEdgeTag, void>::type> 
428
      Graph,
429
      typename enable_if<typename Graph::FindEdgeTag, void>::type>
430 430
    {
... ...
@@ -435,3 +435,3 @@
435 435
      }
436
    };    
436
    };
437 437
  }
... ...
@@ -451,3 +451,3 @@
451 451
  ///\code
452
  /// for(Edge e = findEdge(g,u,v); e != INVALID; 
452
  /// for(Edge e = findEdge(g,u,v); e != INVALID;
453 453
  ///     e = findEdge(g,u,v,e)) {
... ...
@@ -460,3 +460,3 @@
460 460
  template <typename Graph>
461
  inline typename Graph::Edge 
461
  inline typename Graph::Edge
462 462
  findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
... ...
@@ -468,3 +468,3 @@
468 468
  ///
469
  /// Iterator for iterating on edges connected the same nodes. It is 
469
  /// Iterator for iterating on edges connected the same nodes. It is
470 470
  /// higher level interface for the findEdge() function. You can
... ...
@@ -498,6 +498,6 @@
498 498
    ///
499
    /// Construct a new ConEdgeIt which continues the iterating from 
499
    /// Construct a new ConEdgeIt which continues the iterating from
500 500
    /// the \c e edge.
501 501
    ConEdgeIt(const Graph& g, Edge e) : Parent(e), _graph(g) {}
502
    
502

	
503 503
    /// \brief Increment operator.
... ...
@@ -506,4 +506,4 @@
506 506
    ConEdgeIt& operator++() {
507
      Parent::operator=(findEdge(_graph, _graph.u(*this), 
508
				 _graph.v(*this), *this));
507
      Parent::operator=(findEdge(_graph, _graph.u(*this),
508
                                 _graph.v(*this), *this));
509 509
      return *this;
... ...
@@ -520,3 +520,3 @@
520 520
      virtual void copy(const Digraph& from, const RefMap& refMap) = 0;
521
      
521

	
522 522
      virtual ~MapCopyBase() {}
... ...
@@ -524,3 +524,3 @@
524 524

	
525
    template <typename Digraph, typename Item, typename RefMap, 
525
    template <typename Digraph, typename Item, typename RefMap,
526 526
              typename ToMap, typename FromMap>
... ...
@@ -529,5 +529,5 @@
529 529

	
530
      MapCopy(ToMap& tmap, const FromMap& map) 
530
      MapCopy(ToMap& tmap, const FromMap& map)
531 531
        : _tmap(tmap), _map(map) {}
532
      
532

	
533 533
      virtual void copy(const Digraph& digraph, const RefMap& refMap) {
... ...
@@ -549,3 +549,3 @@
549 549
      ItemCopy(It& it, const Item& item) : _it(it), _item(item) {}
550
      
550

	
551 551
      virtual void copy(const Digraph&, const RefMap& refMap) {
... ...
@@ -564,3 +564,3 @@
564 564
      RefCopy(Ref& map) : _map(map) {}
565
      
565

	
566 566
      virtual void copy(const Digraph& digraph, const RefMap& refMap) {
... ...
@@ -576,3 +576,3 @@
576 576

	
577
    template <typename Digraph, typename Item, typename RefMap, 
577
    template <typename Digraph, typename Item, typename RefMap,
578 578
              typename CrossRef>
... ...
@@ -582,3 +582,3 @@
582 582
      CrossRefCopy(CrossRef& cmap) : _cmap(cmap) {}
583
      
583

	
584 584
      virtual void copy(const Digraph& digraph, const RefMap& refMap) {
... ...
@@ -603,4 +603,4 @@
603 603
        for (typename From::ArcIt it(from); it != INVALID; ++it) {
604
          arcRefMap[it] = to.addArc(nodeRefMap[from.source(it)], 
605
				    nodeRefMap[from.target(it)]);
604
          arcRefMap[it] = to.addArc(nodeRefMap[from.source(it)],
605
                                    nodeRefMap[from.target(it)]);
606 606
        }
... ...
@@ -611,4 +611,4 @@
611 611
    struct DigraphCopySelector<
612
      Digraph, 
613
      typename enable_if<typename Digraph::BuildTag, void>::type> 
612
      Digraph,
613
      typename enable_if<typename Digraph::BuildTag, void>::type>
614 614
    {
... ...
@@ -630,4 +630,4 @@
630 630
        for (typename From::EdgeIt it(from); it != INVALID; ++it) {
631
          edgeRefMap[it] = to.addEdge(nodeRefMap[from.u(it)], 
632
				      nodeRefMap[from.v(it)]);
631
          edgeRefMap[it] = to.addEdge(nodeRefMap[from.u(it)],
632
                                      nodeRefMap[from.v(it)]);
633 633
        }
... ...
@@ -638,4 +638,4 @@
638 638
    struct GraphCopySelector<
639
      Graph, 
640
      typename enable_if<typename Graph::BuildTag, void>::type> 
639
      Graph,
640
      typename enable_if<typename Graph::BuildTag, void>::type>
641 641
    {
... ...
@@ -699,5 +699,5 @@
699 699
    typedef typename From::template ArcMap<TArc> ArcRefMap;
700
    
701
    
702
  public: 
700

	
701

	
702
  public:
703 703

	
... ...
@@ -708,3 +708,3 @@
708 708
    /// \c _to digraph.
709
    DigraphCopy(To& to, const From& from) 
709
    DigraphCopy(To& to, const From& from)
710 710
      : _from(from), _to(to) {}
... ...
@@ -732,4 +732,4 @@
732 732
    DigraphCopy& nodeRef(NodeRef& map) {
733
      _node_maps.push_back(new _graph_utils_bits::RefCopy<From, Node, 
734
			   NodeRefMap, NodeRef>(map));
733
      _node_maps.push_back(new _graph_utils_bits::RefCopy<From, Node,
734
                           NodeRefMap, NodeRef>(map));
735 735
      return *this;
... ...
@@ -746,3 +746,3 @@
746 746
      _node_maps.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
747
			   NodeRefMap, NodeCrossRef>(map));
747
                           NodeRefMap, NodeCrossRef>(map));
748 748
      return *this;
... ...
@@ -757,4 +757,4 @@
757 757
    DigraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
758
      _node_maps.push_back(new _graph_utils_bits::MapCopy<From, Node, 
759
			   NodeRefMap, ToMap, FromMap>(tmap, map));
758
      _node_maps.push_back(new _graph_utils_bits::MapCopy<From, Node,
759
                           NodeRefMap, ToMap, FromMap>(tmap, map));
760 760
      return *this;
... ...
@@ -766,4 +766,4 @@
766 766
    DigraphCopy& node(TNode& tnode, const Node& snode) {
767
      _node_maps.push_back(new _graph_utils_bits::ItemCopy<From, Node, 
768
			   NodeRefMap, TNode>(tnode, snode));
767
      _node_maps.push_back(new _graph_utils_bits::ItemCopy<From, Node,
768
                           NodeRefMap, TNode>(tnode, snode));
769 769
      return *this;
... ...
@@ -776,4 +776,4 @@
776 776
    DigraphCopy& arcRef(ArcRef& map) {
777
      _arc_maps.push_back(new _graph_utils_bits::RefCopy<From, Arc, 
778
			  ArcRefMap, ArcRef>(map));
777
      _arc_maps.push_back(new _graph_utils_bits::RefCopy<From, Arc,
778
                          ArcRefMap, ArcRef>(map));
779 779
      return *this;
... ...
@@ -788,3 +788,3 @@
788 788
      _arc_maps.push_back(new _graph_utils_bits::CrossRefCopy<From, Arc,
789
			  ArcRefMap, ArcCrossRef>(map));
789
                          ArcRefMap, ArcCrossRef>(map));
790 790
      return *this;
... ...
@@ -794,10 +794,10 @@
794 794
    ///
795
    /// Makes copy of the given map for the newly created digraph. 
795
    /// Makes copy of the given map for the newly created digraph.
796 796
    /// The new map's key type is the to digraph's arc type,
797 797
    /// and the copied map's key type is the from digraph's arc
798
    /// type.  
798
    /// type.
799 799
    template <typename ToMap, typename FromMap>
800 800
    DigraphCopy& arcMap(ToMap& tmap, const FromMap& map) {
801
      _arc_maps.push_back(new _graph_utils_bits::MapCopy<From, Arc, 
802
			  ArcRefMap, ToMap, FromMap>(tmap, map));
801
      _arc_maps.push_back(new _graph_utils_bits::MapCopy<From, Arc,
802
                          ArcRefMap, ToMap, FromMap>(tmap, map));
803 803
      return *this;
... ...
@@ -809,4 +809,4 @@
809 809
    DigraphCopy& arc(TArc& tarc, const Arc& sarc) {
810
      _arc_maps.push_back(new _graph_utils_bits::ItemCopy<From, Arc, 
811
			  ArcRefMap, TArc>(tarc, sarc));
810
      _arc_maps.push_back(new _graph_utils_bits::ItemCopy<From, Arc,
811
                          ArcRefMap, TArc>(tarc, sarc));
812 812
      return *this;
... ...
@@ -827,3 +827,3 @@
827 827
        _arc_maps[i]->copy(_from, arcRefMap);
828
      }      
828
      }
829 829
    }
... ...
@@ -836,6 +836,6 @@
836 836

	
837
    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* > 
837
    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
838 838
    _node_maps;
839 839

	
840
    std::vector<_graph_utils_bits::MapCopyBase<From, Arc, ArcRefMap>* > 
840
    std::vector<_graph_utils_bits::MapCopyBase<From, Arc, ArcRefMap>* >
841 841
    _arc_maps;
... ...
@@ -852,3 +852,3 @@
852 852
  ///\endcode
853
  /// 
853
  ///
854 854
  /// After the copy the \c nr map will contain the mapping from the
... ...
@@ -858,3 +858,3 @@
858 858
  ///
859
  /// \see DigraphCopy 
859
  /// \see DigraphCopy
860 860
  template <typename To, typename From>
... ...
@@ -919,4 +919,4 @@
919 919
      ArcRefMap(const To& to, const From& from,
920
		const EdgeRefMap& edge_ref, const NodeRefMap& node_ref) 
921
        : _to(to), _from(from), 
920
                const EdgeRefMap& edge_ref, const NodeRefMap& node_ref)
921
        : _to(to), _from(from),
922 922
          _edge_ref(edge_ref), _node_ref(node_ref) {}
... ...
@@ -928,8 +928,8 @@
928 928
        bool forward = _from.u(key) != _from.v(key) ?
929
	  _node_ref[_from.source(key)] == 
930
	  _to.source(_to.direct(_edge_ref[key], true)) :
931
	  _from.direction(key);
932
	return _to.direct(_edge_ref[key], forward); 
929
          _node_ref[_from.source(key)] ==
930
          _to.source(_to.direct(_edge_ref[key], true)) :
931
          _from.direction(key);
932
        return _to.direct(_edge_ref[key], forward);
933 933
      }
934
      
934

	
935 935
      const To& _to;
... ...
@@ -940,4 +940,4 @@
940 940

	
941
    
942
  public: 
941

	
942
  public:
943 943

	
... ...
@@ -948,3 +948,3 @@
948 948
    /// \c _to graph.
949
    GraphCopy(To& to, const From& from) 
949
    GraphCopy(To& to, const From& from)
950 950
      : _from(from), _to(to) {}
... ...
@@ -972,4 +972,4 @@
972 972
    GraphCopy& nodeRef(NodeRef& map) {
973
      _node_maps.push_back(new _graph_utils_bits::RefCopy<From, Node, 
974
			   NodeRefMap, NodeRef>(map));
973
      _node_maps.push_back(new _graph_utils_bits::RefCopy<From, Node,
974
                           NodeRefMap, NodeRef>(map));
975 975
      return *this;
... ...
@@ -984,3 +984,3 @@
984 984
      _node_maps.push_back(new _graph_utils_bits::CrossRefCopy<From, Node,
985
			   NodeRefMap, NodeCrossRef>(map));
985
                           NodeRefMap, NodeCrossRef>(map));
986 986
      return *this;
... ...
@@ -990,10 +990,10 @@
990 990
    ///
991
    /// Makes copy of the given map for the newly created graph. 
991
    /// Makes copy of the given map for the newly created graph.
992 992
    /// The new map's key type is the to graph's node type,
993 993
    /// and the copied map's key type is the from graph's node
994
    /// type.  
994
    /// type.
995 995
    template <typename ToMap, typename FromMap>
996 996
    GraphCopy& nodeMap(ToMap& tmap, const FromMap& map) {
997
      _node_maps.push_back(new _graph_utils_bits::MapCopy<From, Node, 
998
			   NodeRefMap, ToMap, FromMap>(tmap, map));
997
      _node_maps.push_back(new _graph_utils_bits::MapCopy<From, Node,
998
                           NodeRefMap, ToMap, FromMap>(tmap, map));
999 999
      return *this;
... ...
@@ -1005,4 +1005,4 @@
1005 1005
    GraphCopy& node(TNode& tnode, const Node& snode) {
1006
      _node_maps.push_back(new _graph_utils_bits::ItemCopy<From, Node, 
1007
			   NodeRefMap, TNode>(tnode, snode));
1006
      _node_maps.push_back(new _graph_utils_bits::ItemCopy<From, Node,
1007
                           NodeRefMap, TNode>(tnode, snode));
1008 1008
      return *this;
... ...
@@ -1015,4 +1015,4 @@
1015 1015
    GraphCopy& arcRef(ArcRef& map) {
1016
      _arc_maps.push_back(new _graph_utils_bits::RefCopy<From, Arc, 
1017
			  ArcRefMap, ArcRef>(map));
1016
      _arc_maps.push_back(new _graph_utils_bits::RefCopy<From, Arc,
1017
                          ArcRefMap, ArcRef>(map));
1018 1018
      return *this;
... ...
@@ -1027,3 +1027,3 @@
1027 1027
      _arc_maps.push_back(new _graph_utils_bits::CrossRefCopy<From, Arc,
1028
			  ArcRefMap, ArcCrossRef>(map));
1028
                          ArcRefMap, ArcCrossRef>(map));
1029 1029
      return *this;
... ...
@@ -1033,10 +1033,10 @@
1033 1033
    ///
1034
    /// Makes copy of the given map for the newly created graph. 
1034
    /// Makes copy of the given map for the newly created graph.
1035 1035
    /// The new map's key type is the to graph's arc type,
1036 1036
    /// and the copied map's key type is the from graph's arc
1037
    /// type.  
1037
    /// type.
1038 1038
    template <typename ToMap, typename FromMap>
1039 1039
    GraphCopy& arcMap(ToMap& tmap, const FromMap& map) {
1040
      _arc_maps.push_back(new _graph_utils_bits::MapCopy<From, Arc, 
1041
			  ArcRefMap, ToMap, FromMap>(tmap, map));
1040
      _arc_maps.push_back(new _graph_utils_bits::MapCopy<From, Arc,
1041
                          ArcRefMap, ToMap, FromMap>(tmap, map));
1042 1042
      return *this;
... ...
@@ -1048,4 +1048,4 @@
1048 1048
    GraphCopy& arc(TArc& tarc, const Arc& sarc) {
1049
      _arc_maps.push_back(new _graph_utils_bits::ItemCopy<From, Arc, 
1050
			  ArcRefMap, TArc>(tarc, sarc));
1049
      _arc_maps.push_back(new _graph_utils_bits::ItemCopy<From, Arc,
1050
                          ArcRefMap, TArc>(tarc, sarc));
1051 1051
      return *this;
... ...
@@ -1058,4 +1058,4 @@
1058 1058
    GraphCopy& edgeRef(EdgeRef& map) {
1059
      _edge_maps.push_back(new _graph_utils_bits::RefCopy<From, Edge, 
1060
			   EdgeRefMap, EdgeRef>(map));
1059
      _edge_maps.push_back(new _graph_utils_bits::RefCopy<From, Edge,
1060
                           EdgeRefMap, EdgeRef>(map));
1061 1061
      return *this;
... ...
@@ -1069,4 +1069,4 @@
1069 1069
    GraphCopy& edgeCrossRef(EdgeCrossRef& map) {
1070
      _edge_maps.push_back(new _graph_utils_bits::CrossRefCopy<From, 
1071
			   Edge, EdgeRefMap, EdgeCrossRef>(map));
1070
      _edge_maps.push_back(new _graph_utils_bits::CrossRefCopy<From,
1071
                           Edge, EdgeRefMap, EdgeCrossRef>(map));
1072 1072
      return *this;
... ...
@@ -1076,10 +1076,10 @@
1076 1076
    ///
1077
    /// Makes copy of the given map for the newly created graph. 
1077
    /// Makes copy of the given map for the newly created graph.
1078 1078
    /// The new map's key type is the to graph's edge type,
1079 1079
    /// and the copied map's key type is the from graph's edge
1080
    /// type.  
1080
    /// type.
1081 1081
    template <typename ToMap, typename FromMap>
1082 1082
    GraphCopy& edgeMap(ToMap& tmap, const FromMap& map) {
1083
      _edge_maps.push_back(new _graph_utils_bits::MapCopy<From, Edge, 
1084
			   EdgeRefMap, ToMap, FromMap>(tmap, map));
1083
      _edge_maps.push_back(new _graph_utils_bits::MapCopy<From, Edge,
1084
                           EdgeRefMap, ToMap, FromMap>(tmap, map));
1085 1085
      return *this;
... ...
@@ -1091,4 +1091,4 @@
1091 1091
    GraphCopy& edge(TEdge& tedge, const Edge& sedge) {
1092
      _edge_maps.push_back(new _graph_utils_bits::ItemCopy<From, Edge, 
1093
			   EdgeRefMap, TEdge>(tedge, sedge));
1092
      _edge_maps.push_back(new _graph_utils_bits::ItemCopy<From, Edge,
1093
                           EdgeRefMap, TEdge>(tedge, sedge));
1094 1094
      return *this;
... ...
@@ -1117,3 +1117,3 @@
1117 1117
  private:
1118
    
1118

	
1119 1119
    const From& _from;
... ...
@@ -1121,9 +1121,9 @@
1121 1121

	
1122
    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* > 
1122
    std::vector<_graph_utils_bits::MapCopyBase<From, Node, NodeRefMap>* >
1123 1123
    _node_maps;
1124 1124

	
1125
    std::vector<_graph_utils_bits::MapCopyBase<From, Arc, ArcRefMap>* > 
1125
    std::vector<_graph_utils_bits::MapCopyBase<From, Arc, ArcRefMap>* >
1126 1126
    _arc_maps;
1127 1127

	
1128
    std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* > 
1128
    std::vector<_graph_utils_bits::MapCopyBase<From, Edge, EdgeRefMap>* >
1129 1129
    _edge_maps;
... ...
@@ -1140,3 +1140,3 @@
1140 1140
  ///\endcode
1141
  /// 
1141
  ///
1142 1142
  /// After the copy the \c nr map will contain the mapping from the
... ...
@@ -1146,5 +1146,5 @@
1146 1146
  ///
1147
  /// \see GraphCopy 
1147
  /// \see GraphCopy
1148 1148
  template <typename To, typename From>
1149
  GraphCopy<To, From> 
1149
  GraphCopy<To, From>
1150 1150
  copyGraph(To& to, const From& from) {
... ...
@@ -1216,3 +1216,3 @@
1216 1216
      /// Gives back the given item from its id.
1217
      /// 
1217
      ///
1218 1218
      Item operator[](int id) const { return _graph->fromId(id, Item());}
... ...
@@ -1226,3 +1226,3 @@
1226 1226
    /// Gives back the inverse of the IdMap.
1227
    InverseMap inverse() const { return InverseMap(*_graph);} 
1227
    InverseMap inverse() const { return InverseMap(*_graph);}
1228 1228

	
... ...
@@ -1230,7 +1230,7 @@
1230 1230

	
1231
  
1231

	
1232 1232
  /// \brief General invertable graph-map type.
1233 1233

	
1234
  /// This type provides simple invertable graph-maps. 
1235
  /// The InvertableMap wraps an arbitrary ReadWriteMap 
1234
  /// This type provides simple invertable graph-maps.
1235
  /// The InvertableMap wraps an arbitrary ReadWriteMap
1236 1236
  /// and if a key is set to a new value then store it
... ...
@@ -1249,3 +1249,3 @@
1249 1249
  private:
1250
    
1250

	
1251 1251
    typedef DefaultMap<_Graph, _Item, _Value> Map;
... ...
@@ -1254,6 +1254,6 @@
1254 1254
    typedef std::map<_Value, _Item> Container;
1255
    Container _inv_map;    
1255
    Container _inv_map;
1256 1256

	
1257 1257
  public:
1258
 
1258

	
1259 1259
    /// The key type of InvertableMap (Node, Arc, Edge).
... ...
@@ -1269,3 +1269,3 @@
1269 1269
    ///
1270
    explicit InvertableMap(const Graph& graph) : Map(graph) {} 
1270
    explicit InvertableMap(const Graph& graph) : Map(graph) {}
1271 1271

	
... ...
@@ -1277,3 +1277,3 @@
1277 1277
    ///
1278
    class ValueIterator 
1278
    class ValueIterator
1279 1279
      : public std::iterator<std::forward_iterator_tag, Value> {
... ...
@@ -1281,6 +1281,6 @@
1281 1281
    private:
1282
      ValueIterator(typename Container::const_iterator _it) 
1282
      ValueIterator(typename Container::const_iterator _it)
1283 1283
        : it(_it) {}
1284 1284
    public:
1285
      
1285

	
1286 1286
      ValueIterator() {}
... ...
@@ -1288,6 +1288,6 @@
1288 1288
      ValueIterator& operator++() { ++it; return *this; }
1289
      ValueIterator operator++(int) { 
1290
        ValueIterator tmp(*this); 
1289
      ValueIterator operator++(int) {
1290
        ValueIterator tmp(*this);
1291 1291
        operator++();
1292
        return tmp; 
1292
        return tmp;
1293 1293
      }
... ...
@@ -1299,3 +1299,3 @@
1299 1299
      bool operator!=(ValueIterator jt) const { return it != jt.it; }
1300
      
1300

	
1301 1301
    private:
... ...
@@ -1306,3 +1306,3 @@
1306 1306
    ///
1307
    /// Returns an stl compatible iterator to the 
1307
    /// Returns an stl compatible iterator to the
1308 1308
    /// first value of the map. The values of the
... ...
@@ -1316,3 +1316,3 @@
1316 1316
    ///
1317
    /// Returns an stl compatible iterator after the 
1317
    /// Returns an stl compatible iterator after the
1318 1318
    /// last value of the map. The values of the
... ...
@@ -1323,3 +1323,3 @@
1323 1323
    }
1324
    
1324

	
1325 1325
    /// \brief The setter function of the map.
... ...
@@ -1331,4 +1331,4 @@
1331 1331
      if (it != _inv_map.end() && it->second == key) {
1332
	_inv_map.erase(it);
1333
      }      
1332
        _inv_map.erase(it);
1333
      }
1334 1334
      _inv_map.insert(make_pair(val, key));
... ...
@@ -1340,3 +1340,3 @@
1340 1340
    /// It gives back the value associated with the key.
1341
    typename MapTraits<Map>::ConstReturnValue 
1341
    typename MapTraits<Map>::ConstReturnValue
1342 1342
    operator[](const Key& key) const {
... ...
@@ -1363,3 +1363,3 @@
1363 1363
      if (it != _inv_map.end() && it->second == key) {
1364
	_inv_map.erase(it);
1364
        _inv_map.erase(it);
1365 1365
      }
... ...
@@ -1374,7 +1374,7 @@
1374 1374
      for (int i = 0; i < int(keys.size()); ++i) {
1375
	Value val = Map::operator[](keys[i]);
1376
	typename Container::iterator it = _inv_map.find(val);
1377
	if (it != _inv_map.end() && it->second == keys[i]) {
1378
	  _inv_map.erase(it);
1379
	}
1375
        Value val = Map::operator[](keys[i]);
1376
        typename Container::iterator it = _inv_map.find(val);
1377
        if (it != _inv_map.end() && it->second == keys[i]) {
1378
          _inv_map.erase(it);
1379
        }
1380 1380
      }
... ...
@@ -1397,3 +1397,3 @@
1397 1397
    /// The inverse of this map. The subscript operator of the map
1398
    /// gives back always the item what was last assigned to the value. 
1398
    /// gives back always the item what was last assigned to the value.
1399 1399
    class InverseMap {
... ...
@@ -1403,3 +1403,3 @@
1403 1403
      /// Constructor of the InverseMap.
1404
      explicit InverseMap(const InvertableMap& inverted) 
1404
      explicit InverseMap(const InvertableMap& inverted)
1405 1405
        : _inverted(inverted) {}
... ...
@@ -1409,12 +1409,12 @@
1409 1409
      /// The key type of the InverseMap.
1410
      typedef typename InvertableMap::Value Key; 
1411

	
1412
      /// \brief Subscript operator. 
1410
      typedef typename InvertableMap::Value Key;
1411

	
1412
      /// \brief Subscript operator.
1413 1413
      ///
1414
      /// Subscript operator. It gives back always the item 
1414
      /// Subscript operator. It gives back always the item
1415 1415
      /// what was last assigned to the value.
1416 1416
      Value operator[](const Key& key) const {
1417
	return _inverted(key);
1417
        return _inverted(key);
1418 1418
      }
1419
      
1419

	
1420 1420
    private:
... ...
@@ -1428,9 +1428,9 @@
1428 1428
      return InverseMap(*this);
1429
    } 
1430

	
1431

	
1432
    
1429
    }
1430

	
1431

	
1432

	
1433 1433
  };
1434 1434

	
1435
  /// \brief Provides a mutable, continuous and unique descriptor for each 
1435
  /// \brief Provides a mutable, continuous and unique descriptor for each
1436 1436
  /// item in the graph.
... ...
@@ -1447,3 +1447,3 @@
1447 1447
  /// \tparam _Graph The graph class the \c DescriptorMap belongs to.
1448
  /// \tparam _Item The Item is the Key of the Map. It may be Node, Arc or 
1448
  /// \tparam _Item The Item is the Key of the Map. It may be Node, Arc or
1449 1449
  /// Edge.
... ...
@@ -1469,7 +1469,7 @@
1469 1469
      Item it;
1470
      const typename Map::Notifier* nf = Map::notifier(); 
1470
      const typename Map::Notifier* nf = Map::notifier();
1471 1471
      for (nf->first(it); it != INVALID; nf->next(it)) {
1472
	Map::set(it, _inv_map.size());
1473
	_inv_map.push_back(it);	
1474
      }      
1472
        Map::set(it, _inv_map.size());
1473
        _inv_map.push_back(it);
1474
      }
1475 1475
    }
... ...
@@ -1495,4 +1495,4 @@
1495 1495
      for (int i = 0; i < int(items.size()); ++i) {
1496
	Map::set(items[i], _inv_map.size());
1497
	_inv_map.push_back(items[i]);
1496
        Map::set(items[i], _inv_map.size());
1497
        _inv_map.push_back(items[i]);
1498 1498
      }
... ...
@@ -1517,5 +1517,5 @@
1517 1517
      for (int i = 0; i < int(items.size()); ++i) {
1518
	Map::set(_inv_map.back(), Map::operator[](items[i]));
1519
	_inv_map[Map::operator[](items[i])] = _inv_map.back();
1520
	_inv_map.pop_back();
1518
        Map::set(_inv_map.back(), Map::operator[](items[i]));
1519
        _inv_map[Map::operator[](items[i])] = _inv_map.back();
1520
        _inv_map.pop_back();
1521 1521
      }
... ...
@@ -1531,9 +1531,9 @@
1531 1531
      Item it;
1532
      const typename Map::Notifier* nf = Map::notifier(); 
1532
      const typename Map::Notifier* nf = Map::notifier();
1533 1533
      for (nf->first(it); it != INVALID; nf->next(it)) {
1534
	Map::set(it, _inv_map.size());
1535
	_inv_map.push_back(it);	
1536
      }      
1534
        Map::set(it, _inv_map.size());
1535
        _inv_map.push_back(it);
1536
      }
1537 1537
    }
1538
    
1538

	
1539 1539
    /// \brief Clear the keys from the map.
... ...
@@ -1581,3 +1581,3 @@
1581 1581
    }
1582
    
1582

	
1583 1583
  private:
... ...
@@ -1596,4 +1596,4 @@
1596 1596
      /// Constructor of the InverseMap.
1597
      explicit InverseMap(const DescriptorMap& inverted) 
1598
	: _inverted(inverted) {}
1597
      explicit InverseMap(const DescriptorMap& inverted)
1598
        : _inverted(inverted) {}
1599 1599

	
... ...
@@ -1603,10 +1603,10 @@
1603 1603
      /// The key type of the InverseMap.
1604
      typedef typename DescriptorMap::Value Key; 
1605

	
1606
      /// \brief Subscript operator. 
1604
      typedef typename DescriptorMap::Value Key;
1605

	
1606
      /// \brief Subscript operator.
1607 1607
      ///
1608
      /// Subscript operator. It gives back the item 
1608
      /// Subscript operator. It gives back the item
1609 1609
      /// that the descriptor belongs to currently.
1610 1610
      Value operator[](const Key& key) const {
1611
	return _inverted(key);
1611
        return _inverted(key);
1612 1612
      }
... ...
@@ -1617,5 +1617,5 @@
1617 1617
      unsigned int size() const {
1618
	return _inverted.size();
1618
        return _inverted.size();
1619 1619
      }
1620
      
1620

	
1621 1621
    private:
... ...
@@ -1634,3 +1634,3 @@
1634 1634
  ///
1635
  /// The SourceMap gives back the source Node of the given arc. 
1635
  /// The SourceMap gives back the source Node of the given arc.
1636 1636
  /// \see TargetMap
... ...
@@ -1652,4 +1652,4 @@
1652 1652
    /// The subscript operator.
1653
    /// \param arc The arc 
1654
    /// \return The source of the arc 
1653
    /// \param arc The arc
1654
    /// \return The source of the arc
1655 1655
    Value operator[](const Key& arc) const {
... ...
@@ -1669,3 +1669,3 @@
1669 1669
    return SourceMap<Digraph>(digraph);
1670
  } 
1670
  }
1671 1671

	
... ...
@@ -1673,3 +1673,3 @@
1673 1673
  ///
1674
  /// The TargetMap gives back the target Node of the given arc. 
1674
  /// The TargetMap gives back the target Node of the given arc.
1675 1675
  /// \see SourceMap
... ...
@@ -1691,4 +1691,4 @@
1691 1691
    /// The subscript operator.
1692
    /// \param e The arc 
1693
    /// \return The target of the arc 
1692
    /// \param e The arc
1693
    /// \return The target of the arc
1694 1694
    Value operator[](const Key& e) const {
... ...
@@ -1730,4 +1730,4 @@
1730 1730
    /// The subscript operator.
1731
    /// \param key An edge 
1732
    /// \return The "forward" directed arc view of edge 
1731
    /// \param key An edge
1732
    /// \return The "forward" directed arc view of edge
1733 1733
    Value operator[](const Key& key) const {
... ...
@@ -1769,4 +1769,4 @@
1769 1769
    /// The subscript operator.
1770
    /// \param key An edge 
1771
    /// \return The "backward" directed arc view of edge 
1770
    /// \param key An edge
1771
    /// \return The "backward" directed arc view of edge
1772 1772
    Value operator[](const Key& key) const {
... ...
@@ -1802,4 +1802,4 @@
1802 1802
    /// Contructor of the map
1803
    explicit PotentialDifferenceMap(const Digraph& digraph, 
1804
                                    const NodeMap& potential) 
1803
    explicit PotentialDifferenceMap(const Digraph& digraph,
1804
                                    const NodeMap& potential)
1805 1805
      : _digraph(digraph), _potential(potential) {}
... ...
@@ -1810,4 +1810,4 @@
1810 1810
    Value operator[](const Key& arc) const {
1811
      return _potential[_digraph.target(arc)] - 
1812
	_potential[_digraph.source(arc)];
1811
      return _potential[_digraph.target(arc)] -
1812
        _potential[_digraph.source(arc)];
1813 1813
    }
... ...
@@ -1824,3 +1824,3 @@
1824 1824
  template <typename Digraph, typename NodeMap>
1825
  PotentialDifferenceMap<Digraph, NodeMap> 
1825
  PotentialDifferenceMap<Digraph, NodeMap>
1826 1826
  potentialDifferenceMap(const Digraph& digraph, const NodeMap& potential) {
... ...
@@ -1847,3 +1847,3 @@
1847 1847
  template <typename _Digraph>
1848
  class InDegMap  
1848
  class InDegMap
1849 1849
    : protected ItemSetTraits<_Digraph, typename _Digraph::Arc>
... ...
@@ -1852,3 +1852,3 @@
1852 1852
  public:
1853
    
1853

	
1854 1854
    typedef _Digraph Digraph;
... ...
@@ -1868,6 +1868,6 @@
1868 1868
      AutoNodeMap(const Digraph& digraph) : Parent(digraph, 0) {}
1869
      
1869

	
1870 1870
      virtual void add(const Key& key) {
1871
	Parent::add(key);
1872
	Parent::set(key, 0);
1871
        Parent::add(key);
1872
        Parent::set(key, 0);
1873 1873
      }
... ...
@@ -1875,6 +1875,6 @@
1875 1875
      virtual void add(const std::vector<Key>& keys) {
1876
	Parent::add(keys);
1877
	for (int i = 0; i < int(keys.size()); ++i) {
1878
	  Parent::set(keys[i], 0);
1879
	}
1876
        Parent::add(keys);
1877
        for (int i = 0; i < int(keys.size()); ++i) {
1878
          Parent::set(keys[i], 0);
1879
        }
1880 1880
      }
... ...
@@ -1882,8 +1882,8 @@
1882 1882
      virtual void build() {
1883
	Parent::build();
1884
	Key it;
1885
	typename Parent::Notifier* nf = Parent::notifier();
1886
	for (nf->first(it); it != INVALID; nf->next(it)) {
1887
	  Parent::set(it, 0);
1888
	}
1883
        Parent::build();
1884
        Key it;
1885
        typename Parent::Notifier* nf = Parent::notifier();
1886
        for (nf->first(it); it != INVALID; nf->next(it)) {
1887
          Parent::set(it, 0);
1888
        }
1889 1889
      }
... ...
@@ -1896,11 +1896,11 @@
1896 1896
    /// Constructor for creating in-degree map.
1897
    explicit InDegMap(const Digraph& digraph) 
1897
    explicit InDegMap(const Digraph& digraph)
1898 1898
      : _digraph(digraph), _deg(digraph) {
1899 1899
      Parent::attach(_digraph.notifier(typename Digraph::Arc()));
1900
      
1900

	
1901 1901
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
1902
	_deg[it] = countInArcs(_digraph, it);
1902
        _deg[it] = countInArcs(_digraph, it);
1903 1903
      }
1904 1904
    }
1905
    
1905

	
1906 1906
    /// Gives back the in-degree of a Node.
... ...
@@ -1911,3 +1911,3 @@
1911 1911
  protected:
1912
    
1912

	
1913 1913
    typedef typename Digraph::Arc Arc;
... ...
@@ -1936,4 +1936,4 @@
1936 1936
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
1937
	_deg[it] = countInArcs(_digraph, it);
1938
      }      
1937
        _deg[it] = countInArcs(_digraph, it);
1938
      }
1939 1939
    }
... ...
@@ -1942,3 +1942,3 @@
1942 1942
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
1943
	_deg[it] = 0;
1943
        _deg[it] = 0;
1944 1944
      }
... ...
@@ -1946,3 +1946,3 @@
1946 1946
  private:
1947
    
1947

	
1948 1948
    const Digraph& _digraph;
... ...
@@ -1969,3 +1969,3 @@
1969 1969
  template <typename _Digraph>
1970
  class OutDegMap  
1970
  class OutDegMap
1971 1971
    : protected ItemSetTraits<_Digraph, typename _Digraph::Arc>
... ...
@@ -1974,3 +1974,3 @@
1974 1974
  public:
1975
    
1975

	
1976 1976
    typedef _Digraph Digraph;
... ...
@@ -1990,20 +1990,20 @@
1990 1990
      AutoNodeMap(const Digraph& digraph) : Parent(digraph, 0) {}
1991
      
1991

	
1992 1992
      virtual void add(const Key& key) {
1993
	Parent::add(key);
1994
	Parent::set(key, 0);
1993
        Parent::add(key);
1994
        Parent::set(key, 0);
1995 1995
      }
1996 1996
      virtual void add(const std::vector<Key>& keys) {
1997
	Parent::add(keys);
1998
	for (int i = 0; i < int(keys.size()); ++i) {
1999
	  Parent::set(keys[i], 0);
2000
	}
1997
        Parent::add(keys);
1998
        for (int i = 0; i < int(keys.size()); ++i) {
1999
          Parent::set(keys[i], 0);
2000
        }
2001 2001
      }
2002 2002
      virtual void build() {
2003
	Parent::build();
2004
	Key it;
2005
	typename Parent::Notifier* nf = Parent::notifier();
2006
	for (nf->first(it); it != INVALID; nf->next(it)) {
2007
	  Parent::set(it, 0);
2008
	}
2003
        Parent::build();
2004
        Key it;
2005
        typename Parent::Notifier* nf = Parent::notifier();
2006
        for (nf->first(it); it != INVALID; nf->next(it)) {
2007
          Parent::set(it, 0);
2008
        }
2009 2009
      }
... ...
@@ -2016,8 +2016,8 @@
2016 2016
    /// Constructor for creating out-degree map.
2017
    explicit OutDegMap(const Digraph& digraph) 
2017
    explicit OutDegMap(const Digraph& digraph)
2018 2018
      : _digraph(digraph), _deg(digraph) {
2019 2019
      Parent::attach(_digraph.notifier(typename Digraph::Arc()));
2020
      
2020

	
2021 2021
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
2022
	_deg[it] = countOutArcs(_digraph, it);
2022
        _deg[it] = countOutArcs(_digraph, it);
2023 2023
      }
... ...
@@ -2031,3 +2031,3 @@
2031 2031
  protected:
2032
    
2032

	
2033 2033
    typedef typename Digraph::Arc Arc;
... ...
@@ -2056,4 +2056,4 @@
2056 2056
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
2057
	_deg[it] = countOutArcs(_digraph, it);
2058
      }      
2057
        _deg[it] = countOutArcs(_digraph, it);
2058
      }
2059 2059
    }
... ...
@@ -2062,3 +2062,3 @@
2062 2062
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
2063
	_deg[it] = 0;
2063
        _deg[it] = 0;
2064 2064
      }
... ...
@@ -2066,3 +2066,3 @@
2066 2066
  private:
2067
    
2067

	
2068 2068
    const Digraph& _digraph;
... ...
@@ -2073,3 +2073,3 @@
2073 2073
  ///Dynamic arc look up between given endpoints.
2074
  
2074

	
2075 2075
  ///\ingroup gutils
... ...
@@ -2091,8 +2091,8 @@
2091 2091
  ///
2092
  ///\tparam G The type of the underlying digraph.  
2092
  ///\tparam G The type of the underlying digraph.
2093 2093
  ///
2094
  ///\sa ArcLookUp  
2095
  ///\sa AllArcLookUp  
2094
  ///\sa ArcLookUp
2095
  ///\sa AllArcLookUp
2096 2096
  template<class G>
2097
  class DynArcLookUp 
2097
  class DynArcLookUp
2098 2098
    : protected ItemSetTraits<G, typename G::Arc>::ItemNotifier::ObserverBase
... ...
@@ -2114,6 +2114,6 @@
2114 2114
      AutoNodeMap(const G& digraph) : Parent(digraph, INVALID) {}
2115
      
2115

	
2116 2116
      virtual void add(const Node& node) {
2117
	Parent::add(node);
2118
	Parent::set(node, INVALID);
2117
        Parent::add(node);
2118
        Parent::set(node, INVALID);
2119 2119
      }
... ...
@@ -2121,6 +2121,6 @@
2121 2121
      virtual void add(const std::vector<Node>& nodes) {
2122
	Parent::add(nodes);
2123
	for (int i = 0; i < int(nodes.size()); ++i) {
2124
	  Parent::set(nodes[i], INVALID);
2125
	}
2122
        Parent::add(nodes);
2123
        for (int i = 0; i < int(nodes.size()); ++i) {
2124
          Parent::set(nodes[i], INVALID);
2125
        }
2126 2126
      }
... ...
@@ -2128,8 +2128,8 @@
2128 2128
      virtual void build() {
2129
	Parent::build();
2130
	Node it;
2131
	typename Parent::Notifier* nf = Parent::notifier();
2132
	for (nf->first(it); it != INVALID; nf->next(it)) {
2133
	  Parent::set(it, INVALID);
2134
	}
2129
        Parent::build();
2130
        Node it;
2131
        typename Parent::Notifier* nf = Parent::notifier();
2132
        for (nf->first(it); it != INVALID; nf->next(it)) {
2133
          Parent::set(it, INVALID);
2134
        }
2135 2135
      }
... ...
@@ -2142,3 +2142,3 @@
2142 2142
    typename Digraph::template ArcMap<Arc> _right;
2143
    
2143

	
2144 2144
    class ArcLess {
... ...
@@ -2147,10 +2147,10 @@
2147 2147
      ArcLess(const Digraph &_g) : g(_g) {}
2148
      bool operator()(Arc a,Arc b) const 
2148
      bool operator()(Arc a,Arc b) const
2149 2149
      {
2150
	return g.target(a)<g.target(b);
2150
        return g.target(a)<g.target(b);
2151 2151
      }
2152 2152
    };
2153
    
2153

	
2154 2154
  public:
2155
    
2155

	
2156 2156
    ///Constructor
... ...
@@ -2160,9 +2160,9 @@
2160 2160
    ///It builds up the search database.
2161
    DynArcLookUp(const Digraph &g) 
2162
      : _g(g),_head(g),_parent(g),_left(g),_right(g) 
2163
    { 
2161
    DynArcLookUp(const Digraph &g)
2162
      : _g(g),_head(g),_parent(g),_left(g),_right(g)
2163
    {
2164 2164
      Parent::attach(_g.notifier(typename Digraph::Arc()));
2165
      refresh(); 
2165
      refresh();
2166 2166
    }
2167
    
2167

	
2168 2168
  protected:
... ...
@@ -2175,3 +2175,3 @@
2175 2175
      for (int i = 0; i < int(arcs.size()); ++i) {
2176
	insert(arcs[i]);
2176
        insert(arcs[i]);
2177 2177
      }
... ...
@@ -2185,4 +2185,4 @@
2185 2185
      for (int i = 0; i < int(arcs.size()); ++i) {
2186
	remove(arcs[i]);
2187
      }     
2186
        remove(arcs[i]);
2187
      }
2188 2188
    }
... ...
@@ -2195,3 +2195,3 @@
2195 2195
      for(NodeIt n(_g);n!=INVALID;++n) {
2196
	_head.set(n, INVALID);
2196
        _head.set(n, INVALID);
2197 2197
      }
... ...
@@ -2204,29 +2204,29 @@
2204 2204
      _right.set(arc, INVALID);
2205
      
2205

	
2206 2206
      Arc e = _head[s];
2207 2207
      if (e == INVALID) {
2208
	_head.set(s, arc);
2209
	_parent.set(arc, INVALID);
2210
	return;
2208
        _head.set(s, arc);
2209
        _parent.set(arc, INVALID);
2210
        return;
2211 2211
      }
2212 2212
      while (true) {
2213
	if (t < _g.target(e)) {
2214
	  if (_left[e] == INVALID) {
2215
	    _left.set(e, arc);
2216
	    _parent.set(arc, e);
2217
	    splay(arc);
2218
	    return;
2219
	  } else {
2220
	    e = _left[e];
2221
	  }
2222
	} else {
2223
	  if (_right[e] == INVALID) {
2224
	    _right.set(e, arc);
2225
	    _parent.set(arc, e);
2226
	    splay(arc);
2227
	    return;
2228
	  } else {
2229
	    e = _right[e];
2230
	  }
2231
	}
2213
        if (t < _g.target(e)) {
2214
          if (_left[e] == INVALID) {
2215
            _left.set(e, arc);
2216
            _parent.set(arc, e);
2217
            splay(arc);
2218
            return;
2219
          } else {
2220
            e = _left[e];
2221
          }
2222
        } else {
2223
          if (_right[e] == INVALID) {
2224
            _right.set(e, arc);
2225
            _parent.set(arc, e);
2226
            splay(arc);
2227
            return;
2228
          } else {
2229
            e = _right[e];
2230
          }
2231
        }
2232 2232
      }
... ...
@@ -2236,66 +2236,66 @@
2236 2236
      if (_left[arc] == INVALID) {
2237
	if (_right[arc] != INVALID) {
2238
	  _parent.set(_right[arc], _parent[arc]);
2239
	}
2240
	if (_parent[arc] != INVALID) {
2241
	  if (_left[_parent[arc]] == arc) {
2242
	    _left.set(_parent[arc], _right[arc]);
2243
	  } else {
2244
	    _right.set(_parent[arc], _right[arc]);
2245
	  }
2246
	} else {
2247
	  _head.set(_g.source(arc), _right[arc]);
2248
	}
2237
        if (_right[arc] != INVALID) {
2238
          _parent.set(_right[arc], _parent[arc]);
2239
        }
2240
        if (_parent[arc] != INVALID) {
2241
          if (_left[_parent[arc]] == arc) {
2242
            _left.set(_parent[arc], _right[arc]);
2243
          } else {
2244
            _right.set(_parent[arc], _right[arc]);
2245
          }
2246
        } else {
2247
          _head.set(_g.source(arc), _right[arc]);
2248
        }
2249 2249
      } else if (_right[arc] == INVALID) {
2250
	_parent.set(_left[arc], _parent[arc]);
2251
	if (_parent[arc] != INVALID) {
2252
	  if (_left[_parent[arc]] == arc) {
2253
	    _left.set(_parent[arc], _left[arc]);
2254
	  } else {
2255
	    _right.set(_parent[arc], _left[arc]);
2256
	  }
2257
	} else {
2258
	  _head.set(_g.source(arc), _left[arc]);
2259
	}
2250
        _parent.set(_left[arc], _parent[arc]);
2251
        if (_parent[arc] != INVALID) {
2252
          if (_left[_parent[arc]] == arc) {
2253
            _left.set(_parent[arc], _left[arc]);
2254
          } else {
2255
            _right.set(_parent[arc], _left[arc]);
2256
          }
2257
        } else {
2258
          _head.set(_g.source(arc), _left[arc]);
2259
        }
2260 2260
      } else {
2261
	Arc e = _left[arc];
2262
	if (_right[e] != INVALID) {
2263
	  e = _right[e];	  
2264
	  while (_right[e] != INVALID) {
2265
	    e = _right[e];
2266
	  }
2267
	  Arc s = _parent[e];
2268
	  _right.set(_parent[e], _left[e]);
2269
	  if (_left[e] != INVALID) {
2270
	    _parent.set(_left[e], _parent[e]);
2271
	  }
2272
	  
2273
	  _left.set(e, _left[arc]);
2274
	  _parent.set(_left[arc], e);
2275
	  _right.set(e, _right[arc]);
2276
	  _parent.set(_right[arc], e);
2277

	
2278
	  _parent.set(e, _parent[arc]);
2279
	  if (_parent[arc] != INVALID) {
2280
	    if (_left[_parent[arc]] == arc) {
2281
	      _left.set(_parent[arc], e);
2282
	    } else {
2283
	      _right.set(_parent[arc], e);
2284
	    }
2285
	  }
2286
	  splay(s);
2287
	} else {
2288
	  _right.set(e, _right[arc]);
2289
	  _parent.set(_right[arc], e);
2290

	
2291
	  if (_parent[arc] != INVALID) {
2292
	    if (_left[_parent[arc]] == arc) {
2293
	      _left.set(_parent[arc], e);
2294
	    } else {
2295
	      _right.set(_parent[arc], e);
2296
	    }
2297
	  } else {
2298
	    _head.set(_g.source(arc), e);
2299
	  }
2300
	}
2261
        Arc e = _left[arc];
2262
        if (_right[e] != INVALID) {
2263
          e = _right[e];
2264
          while (_right[e] != INVALID) {
2265
            e = _right[e];
2266
          }
2267
          Arc s = _parent[e];
2268
          _right.set(_parent[e], _left[e]);
2269
          if (_left[e] != INVALID) {
2270
            _parent.set(_left[e], _parent[e]);
2271
          }
2272

	
2273
          _left.set(e, _left[arc]);
2274
          _parent.set(_left[arc], e);
2275
          _right.set(e, _right[arc]);
2276
          _parent.set(_right[arc], e);
2277

	
2278
          _parent.set(e, _parent[arc]);
2279
          if (_parent[arc] != INVALID) {
2280
            if (_left[_parent[arc]] == arc) {
2281
              _left.set(_parent[arc], e);
2282
            } else {
2283
              _right.set(_parent[arc], e);
2284
            }
2285
          }
2286
          splay(s);
2287
        } else {
2288
          _right.set(e, _right[arc]);
2289
          _parent.set(_right[arc], e);
2290

	
2291
          if (_parent[arc] != INVALID) {
2292
            if (_left[_parent[arc]] == arc) {
2293
              _left.set(_parent[arc], e);
2294
            } else {
2295
              _right.set(_parent[arc], e);
2296
            }
2297
          } else {
2298
            _head.set(_g.source(arc), e);
2299
          }
2300
        }
2301 2301
      }
... ...
@@ -2303,3 +2303,3 @@
2303 2303

	
2304
    Arc refreshRec(std::vector<Arc> &v,int a,int b) 
2304
    Arc refreshRec(std::vector<Arc> &v,int a,int b)
2305 2305
    {
... ...
@@ -2308,14 +2308,14 @@
2308 2308
      if (a < m) {
2309
	Arc left = refreshRec(v,a,m-1);
2310
	_left.set(me, left);
2311
	_parent.set(left, me);
2309
        Arc left = refreshRec(v,a,m-1);
2310
        _left.set(me, left);
2311
        _parent.set(left, me);
2312 2312
      } else {
2313
	_left.set(me, INVALID);
2313
        _left.set(me, INVALID);
2314 2314
      }
2315 2315
      if (m < b) {
2316
	Arc right = refreshRec(v,m+1,b);
2317
	_right.set(me, right);
2318
	_parent.set(right, me);
2316
        Arc right = refreshRec(v,m+1,b);
2317
        _right.set(me, right);
2318
        _parent.set(right, me);
2319 2319
      } else {
2320
	_right.set(me, INVALID);
2320
        _right.set(me, INVALID);
2321 2321
      }
... ...
@@ -2326,11 +2326,11 @@
2326 2326
      for(NodeIt n(_g);n!=INVALID;++n) {
2327
	std::vector<Arc> v;
2328
	for(OutArcIt e(_g,n);e!=INVALID;++e) v.push_back(e);
2329
	if(v.size()) {
2330
	  std::sort(v.begin(),v.end(),ArcLess(_g));
2331
	  Arc head = refreshRec(v,0,v.size()-1);
2332
	  _head.set(n, head);
2333
	  _parent.set(head, INVALID);
2334
	}
2335
	else _head.set(n, INVALID);
2327
        std::vector<Arc> v;
2328
        for(OutArcIt e(_g,n);e!=INVALID;++e) v.push_back(e);
2329
        if(v.size()) {
2330
          std::sort(v.begin(),v.end(),ArcLess(_g));
2331
          Arc head = refreshRec(v,0,v.size()-1);
2332
          _head.set(n, head);
2333
          _parent.set(head, INVALID);
2334
        }
2335
        else _head.set(n, INVALID);
2336 2336
      }
... ...
@@ -2338,3 +2338,3 @@
2338 2338

	
2339
    void zig(Arc v) {        
2339
    void zig(Arc v) {
2340 2340
      Arc w = _parent[v];
... ...
@@ -2345,10 +2345,10 @@
2345 2345
      if (_parent[v] != INVALID) {
2346
	if (_right[_parent[v]] == w) {
2347
	  _right.set(_parent[v], v);
2348
	} else {
2349
	  _left.set(_parent[v], v);
2350
	}
2346
        if (_right[_parent[v]] == w) {
2347
          _right.set(_parent[v], v);
2348
        } else {
2349
          _left.set(_parent[v], v);
2350
        }
2351 2351
      }
2352 2352
      if (_left[w] != INVALID){
2353
	_parent.set(_left[w], w);
2353
        _parent.set(_left[w], w);
2354 2354
      }
... ...
@@ -2356,3 +2356,3 @@
2356 2356

	
2357
    void zag(Arc v) {        
2357
    void zag(Arc v) {
2358 2358
      Arc w = _parent[v];
... ...
@@ -2363,10 +2363,10 @@
2363 2363
      if (_parent[v] != INVALID){
2364
	if (_left[_parent[v]] == w) {
2365
	  _left.set(_parent[v], v);
2366
	} else {
2367
	  _right.set(_parent[v], v);
2368
	}
2364
        if (_left[_parent[v]] == w) {
2365
          _left.set(_parent[v], v);
2366
        } else {
2367
          _right.set(_parent[v], v);
2368
        }
2369 2369
      }
2370 2370
      if (_right[w] != INVALID){
2371
	_parent.set(_right[w], w);
2371
        _parent.set(_right[w], w);
2372 2372
      }
... ...
@@ -2376,27 +2376,27 @@
2376 2376
      while (_parent[v] != INVALID) {
2377
	if (v == _left[_parent[v]]) {
2378
	  if (_parent[_parent[v]] == INVALID) {
2379
	    zig(v);
2380
	  } else {
2381
	    if (_parent[v] == _left[_parent[_parent[v]]]) {
2382
	      zig(_parent[v]);
2383
	      zig(v);
2384
	    } else {
2385
	      zig(v);
2386
	      zag(v);
2387
	    }
2388
	  }
2389
	} else {
2390
	  if (_parent[_parent[v]] == INVALID) {
2391
	    zag(v);
2392
	  } else {
2393
	    if (_parent[v] == _left[_parent[_parent[v]]]) {
2394
	      zag(v);
2395
	      zig(v);
2396
	    } else {
2397
	      zag(_parent[v]);
2398
	      zag(v);
2399
	    }
2400
	  }
2401
	}
2377
        if (v == _left[_parent[v]]) {
2378
          if (_parent[_parent[v]] == INVALID) {
2379
            zig(v);
2380
          } else {
2381
            if (_parent[v] == _left[_parent[_parent[v]]]) {
2382
              zig(_parent[v]);
2383
              zig(v);
2384
            } else {
2385
              zig(v);
2386
              zag(v);
2387
            }
2388
          }
2389
        } else {
2390
          if (_parent[_parent[v]] == INVALID) {
2391
            zag(v);
2392
          } else {
2393
            if (_parent[v] == _left[_parent[_parent[v]]]) {
2394
              zag(v);
2395
              zig(v);
2396
            } else {
2397
              zag(_parent[v]);
2398
              zag(v);
2399
            }
2400
          }
2401
        }
2402 2402
      }
... ...
@@ -2407,5 +2407,5 @@
2407 2407
  public:
2408
    
2408

	
2409 2409
    ///Find an arc between two nodes.
2410
    
2410

	
2411 2411
    ///Find an arc between two nodes in time <em>O(</em>log<em>d)</em>, where
... ...
@@ -2420,20 +2420,20 @@
2420 2420
      while (true) {
2421
	if (_g.target(a) == t) {
2422
	  const_cast<DynArcLookUp&>(*this).splay(a);
2423
	  return a;
2424
	} else if (t < _g.target(a)) {
2425
	  if (_left[a] == INVALID) {
2426
	    const_cast<DynArcLookUp&>(*this).splay(a);
2427
	    return INVALID;
2428
	  } else {
2429
	    a = _left[a];
2430
	  }
2431
	} else  {
2432
	  if (_right[a] == INVALID) {
2433
	    const_cast<DynArcLookUp&>(*this).splay(a);
2434
	    return INVALID;
2435
	  } else {
2436
	    a = _right[a];
2437
	  }
2438
	}
2421
        if (_g.target(a) == t) {
2422
          const_cast<DynArcLookUp&>(*this).splay(a);
2423
          return a;
2424
        } else if (t < _g.target(a)) {
2425
          if (_left[a] == INVALID) {
2426
            const_cast<DynArcLookUp&>(*this).splay(a);
2427
            return INVALID;
2428
          } else {
2429
            a = _left[a];
2430
          }
2431
        } else  {
2432
          if (_right[a] == INVALID) {
2433
            const_cast<DynArcLookUp&>(*this).splay(a);
2434
            return INVALID;
2435
          } else {
2436
            a = _right[a];
2437
          }
2438
        }
2439 2439
      }
... ...
@@ -2442,7 +2442,7 @@
2442 2442
    ///Find the first arc between two nodes.
2443
    
2443

	
2444 2444
    ///Find the first arc between two nodes in time
2445 2445
    /// <em>O(</em>log<em>d)</em>, where <em>d</em> is the number of
2446
    /// outgoing arcs of \c s.  
2447
    ///\param s The source node 
2446
    /// outgoing arcs of \c s.
2447
    ///\param s The source node
2448 2448
    ///\param t The target node
... ...
@@ -2455,20 +2455,20 @@
2455 2455
      while (true) {
2456
	if (_g.target(a) < t) {
2457
	  if (_right[a] == INVALID) {
2458
	    const_cast<DynArcLookUp&>(*this).splay(a);
2459
	    return r;
2460
	  } else {
2461
	    a = _right[a];
2462
	  }
2463
	} else {
2464
	  if (_g.target(a) == t) {
2465
	    r = a;
2466
	  }
2467
	  if (_left[a] == INVALID) {
2468
	    const_cast<DynArcLookUp&>(*this).splay(a);
2469
	    return r;
2470
	  } else {
2471
	    a = _left[a];
2472
	  }
2473
	}
2456
        if (_g.target(a) < t) {
2457
          if (_right[a] == INVALID) {
2458
            const_cast<DynArcLookUp&>(*this).splay(a);
2459
            return r;
2460
          } else {
2461
            a = _right[a];
2462
          }
2463
        } else {
2464
          if (_g.target(a) == t) {
2465
            r = a;
2466
          }
2467
          if (_left[a] == INVALID) {
2468
            const_cast<DynArcLookUp&>(*this).splay(a);
2469
            return r;
2470
          } else {
2471
            a = _left[a];
2472
          }
2473
        }
2474 2474
      }
... ...
@@ -2477,7 +2477,7 @@
2477 2477
    ///Find the next arc between two nodes.
2478
    
2478

	
2479 2479
    ///Find the next arc between two nodes in time
2480 2480
    /// <em>O(</em>log<em>d)</em>, where <em>d</em> is the number of
2481
    /// outgoing arcs of \c s.  
2482
    ///\param s The source node 
2481
    /// outgoing arcs of \c s.
2482
    ///\param s The source node
2483 2483
    ///\param t The target node
... ...
@@ -2495,20 +2495,20 @@
2495 2495
      if (_right[a] != INVALID) {
2496
	a = _right[a];
2497
	while (_left[a] != INVALID) {
2498
	  a = _left[a];
2499
	}
2500
	const_cast<DynArcLookUp&>(*this).splay(a);
2496
        a = _right[a];
2497
        while (_left[a] != INVALID) {
2498
          a = _left[a];
2499
        }
2500
        const_cast<DynArcLookUp&>(*this).splay(a);
2501 2501
      } else {
2502
	while (_parent[a] != INVALID && _right[_parent[a]] ==  a) {
2503
	  a = _parent[a];
2504
	}
2505
	if (_parent[a] == INVALID) {
2506
	  return INVALID;
2507
	} else {
2508
	  a = _parent[a];
2509
	  const_cast<DynArcLookUp&>(*this).splay(a);
2510
	}
2502
        while (_parent[a] != INVALID && _right[_parent[a]] ==  a) {
2503
          a = _parent[a];
2504
        }
2505
        if (_parent[a] == INVALID) {
2506
          return INVALID;
2507
        } else {
2508
          a = _parent[a];
2509
          const_cast<DynArcLookUp&>(*this).splay(a);
2510
        }
2511 2511
      }
2512 2512
      if (_g.target(a) == t) return a;
2513
      else return INVALID;    
2513
      else return INVALID;
2514 2514
    }
... ...
@@ -2518,3 +2518,3 @@
2518 2518
  ///Fast arc look up between given endpoints.
2519
  
2519

	
2520 2520
  ///\ingroup gutils
... ...
@@ -2535,5 +2535,5 @@
2535 2535
  ///\sa DynArcLookUp
2536
  ///\sa AllArcLookUp  
2536
  ///\sa AllArcLookUp
2537 2537
  template<class G>
2538
  class ArcLookUp 
2538
  class ArcLookUp
2539 2539
  {
... ...
@@ -2548,3 +2548,3 @@
2548 2548
    typename Digraph::template ArcMap<Arc> _right;
2549
    
2549

	
2550 2550
    class ArcLess {
... ...
@@ -2553,10 +2553,10 @@
2553 2553
      ArcLess(const Digraph &_g) : g(_g) {}
2554
      bool operator()(Arc a,Arc b) const 
2554
      bool operator()(Arc a,Arc b) const
2555 2555
      {
2556
	return g.target(a)<g.target(b);
2556
        return g.target(a)<g.target(b);
2557 2557
      }
2558 2558
    };
2559
    
2559

	
2560 2560
  public:
2561
    
2561

	
2562 2562
    ///Constructor
... ...
@@ -2568,5 +2568,5 @@
2568 2568
    ArcLookUp(const Digraph &g) :_g(g),_head(g),_left(g),_right(g) {refresh();}
2569
    
2569

	
2570 2570
  private:
2571
    Arc refreshRec(std::vector<Arc> &v,int a,int b) 
2571
    Arc refreshRec(std::vector<Arc> &v,int a,int b)
2572 2572
    {
... ...
@@ -2585,3 +2585,3 @@
2585 2585
    ///the number of the outgoing arcs of \c n.
2586
    void refresh(Node n) 
2586
    void refresh(Node n)
2587 2587
    {
... ...
@@ -2590,4 +2590,4 @@
2590 2590
      if(v.size()) {
2591
	std::sort(v.begin(),v.end(),ArcLess(_g));
2592
	_head[n]=refreshRec(v,0,v.size()-1);
2591
        std::sort(v.begin(),v.end(),ArcLess(_g));
2592
        _head[n]=refreshRec(v,0,v.size()-1);
2593 2593
      }
... ...
@@ -2604,3 +2604,3 @@
2604 2604

	
2605
    void refresh() 
2605
    void refresh()
2606 2606
    {
... ...
@@ -2608,5 +2608,5 @@
2608 2608
    }
2609
    
2609

	
2610 2610
    ///Find an arc between two nodes.
2611
    
2611

	
2612 2612
    ///Find an arc between two nodes in time <em>O(</em>log<em>d)</em>, where
... ...
@@ -2627,4 +2627,4 @@
2627 2627
      for(e=_head[s];
2628
	  e!=INVALID&&_g.target(e)!=t;
2629
	  e = t < _g.target(e)?_left[e]:_right[e]) ;
2628
          e!=INVALID&&_g.target(e)!=t;
2629
          e = t < _g.target(e)?_left[e]:_right[e]) ;
2630 2630
      return e;
... ...
@@ -2635,3 +2635,3 @@
2635 2635
  ///Fast look up of all arcs between given endpoints.
2636
  
2636

	
2637 2637
  ///\ingroup gutils
... ...
@@ -2648,3 +2648,3 @@
2648 2648
  ///\sa DynArcLookUp
2649
  ///\sa ArcLookUp  
2649
  ///\sa ArcLookUp
2650 2650
  template<class G>
... ...
@@ -2659,5 +2659,5 @@
2659 2659
    typedef G Digraph;
2660
    
2660

	
2661 2661
    typename Digraph::template ArcMap<Arc> _next;
2662
    
2662

	
2663 2663
    Arc refreshNext(Arc head,Arc next=INVALID)
... ...
@@ -2666,10 +2666,10 @@
2666 2666
      else {
2667
	next=refreshNext(_right[head],next);
2668
// 	_next[head]=next;
2669
	_next[head]=( next!=INVALID && _g.target(next)==_g.target(head))
2670
	  ? next : INVALID;
2671
	return refreshNext(_left[head],head);
2667
        next=refreshNext(_right[head],next);
2668
//         _next[head]=next;
2669
        _next[head]=( next!=INVALID && _g.target(next)==_g.target(head))
2670
          ? next : INVALID;
2671
        return refreshNext(_left[head],head);
2672 2672
      }
2673 2673
    }
2674
    
2674

	
2675 2675
    void refreshNext()
... ...
@@ -2678,3 +2678,3 @@
2678 2678
    }
2679
    
2679

	
2680 2680
  public:
... ...
@@ -2694,4 +2694,4 @@
2694 2694
    ///the number of the outgoing arcs of \c n.
2695
    
2696
    void refresh(Node n) 
2695

	
2696
    void refresh(Node n)
2697 2697
    {
... ...
@@ -2700,3 +2700,3 @@
2700 2700
    }
2701
    
2701

	
2702 2702
    ///Refresh the full data structure.
... ...
@@ -2710,3 +2710,3 @@
2710 2710

	
2711
    void refresh() 
2711
    void refresh()
2712 2712
    {
... ...
@@ -2714,5 +2714,5 @@
2714 2714
    }
2715
    
2715

	
2716 2716
    ///Find an arc between two nodes.
2717
    
2717

	
2718 2718
    ///Find an arc between two nodes.
... ...
@@ -2752,3 +2752,3 @@
2752 2752
#endif
2753
      
2753

	
2754 2754
  };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -47,3 +47,3 @@
47 47
    typename disable_if<lemon::UndirectedTagIndicator<Digraph>,
48
		       typename In::value_type::second_type >::type
48
                       typename In::value_type::second_type >::type
49 49
    kruskal(const Digraph& digraph, const In& in, Out& out,dummy<0> = 0) {
... ...
@@ -52,3 +52,3 @@
52 52
      typedef typename Digraph::Node Node;
53
      
53

	
54 54
      IndexMap index(digraph);
... ...
@@ -58,3 +58,3 @@
58 58
      }
59
      
59

	
60 60
      Value tree_value = 0;
... ...
@@ -76,3 +76,3 @@
76 76
    typename enable_if<lemon::UndirectedTagIndicator<Graph>,
77
		       typename In::value_type::second_type >::type
77
                       typename In::value_type::second_type >::type
78 78
    kruskal(const Graph& graph, const In& in, Out& out,dummy<1> = 1) {
... ...
@@ -81,3 +81,3 @@
81 81
      typedef typename Graph::Node Node;
82
      
82

	
83 83
      IndexMap index(graph);
... ...
@@ -87,3 +87,3 @@
87 87
      }
88
      
88

	
89 89
      Value tree_value = 0;
... ...
@@ -106,3 +106,3 @@
106 106
      bool operator()(const Value& left, const Value& right) {
107
	return left.second < right.second;
107
        return left.second < right.second;
108 108
      }
... ...
@@ -116,3 +116,3 @@
116 116
    template <typename In>
117
    struct SequenceInputIndicator<In, 
117
    struct SequenceInputIndicator<In,
118 118
      typename exists<typename In::value_type::first_type>::type> {
... ...
@@ -127,3 +127,3 @@
127 127
    template <typename In>
128
    struct MapInputIndicator<In, 
128
    struct MapInputIndicator<In,
129 129
      typename exists<typename In::Value>::type> {
... ...
@@ -136,5 +136,5 @@
136 136
    };
137
 
137

	
138 138
    template <typename Out>
139
    struct SequenceOutputIndicator<Out, 
139
    struct SequenceOutputIndicator<Out,
140 140
      typename exists<typename Out::value_type>::type> {
... ...
@@ -149,3 +149,3 @@
149 149
    template <typename Out>
150
    struct MapOutputIndicator<Out, 
150
    struct MapOutputIndicator<Out,
151 151
      typename exists<typename Out::Value>::type> {
... ...
@@ -159,6 +159,6 @@
159 159
    struct KruskalValueSelector<In,
160
      typename enable_if<SequenceInputIndicator<In>, void>::type> 
160
      typename enable_if<SequenceInputIndicator<In>, void>::type>
161 161
    {
162 162
      typedef typename In::value_type::second_type Value;
163
    };    
163
    };
164 164

	
... ...
@@ -166,7 +166,7 @@
166 166
    struct KruskalValueSelector<In,
167
      typename enable_if<MapInputIndicator<In>, void>::type> 
167
      typename enable_if<MapInputIndicator<In>, void>::type>
168 168
    {
169 169
      typedef typename In::Value Value;
170
    };    
171
    
170
    };
171

	
172 172
    template <typename Graph, typename In, typename Out,
... ...
@@ -178,6 +178,6 @@
178 178
    struct KruskalOutputSelector {};
179
    
179

	
180 180
    template <typename Graph, typename In, typename Out>
181 181
    struct KruskalInputSelector<Graph, In, Out,
182
      typename enable_if<SequenceInputIndicator<In>, void>::type > 
182
      typename enable_if<SequenceInputIndicator<In>, void>::type >
183 183
    {
... ...
@@ -194,3 +194,3 @@
194 194
    struct KruskalInputSelector<Graph, In, Out,
195
      typename enable_if<MapInputIndicator<In>, void>::type > 
195
      typename enable_if<MapInputIndicator<In>, void>::type >
196 196
    {
... ...
@@ -203,3 +203,3 @@
203 203
        Sequence seq;
204
        
204

	
205 205
        for (MapArcIt it(graph); it != INVALID; ++it) {
... ...
@@ -226,3 +226,3 @@
226 226
    struct KruskalOutputSelector<Graph, In, Out,
227
      typename enable_if<SequenceOutputIndicator<Out>, void>::type > 
227
      typename enable_if<SequenceOutputIndicator<Out>, void>::type >
228 228
    {
... ...
@@ -240,3 +240,3 @@
240 240
    struct KruskalOutputSelector<Graph, In, Out,
241
      typename enable_if<MapOutputIndicator<Out>, void>::type > 
241
      typename enable_if<MapOutputIndicator<Out>, void>::type >
242 242
    {
... ...
@@ -256,3 +256,3 @@
256 256
  ///
257
  /// This function runs Kruskal's algorithm to find a minimum cost 
257
  /// This function runs Kruskal's algorithm to find a minimum cost
258 258
  /// spanning tree.
... ...
@@ -261,8 +261,8 @@
261 261
  /// \param g The graph the algorithm runs on.
262
  /// It can be either \ref concepts::Digraph "directed" or 
262
  /// It can be either \ref concepts::Digraph "directed" or
263 263
  /// \ref concepts::Graph "undirected".
264
  /// If the graph is directed, the algorithm consider it to be 
264
  /// If the graph is directed, the algorithm consider it to be
265 265
  /// undirected by disregarding the direction of the arcs.
266 266
  ///
267
  /// \param in This object is used to describe the arc/edge costs. 
267
  /// \param in This object is used to describe the arc/edge costs.
268 268
  /// It can be one of the following choices.
... ...
@@ -274,3 +274,3 @@
274 274
  /// cost-ascending order.</em>
275
  /// - Any readable arc/edge map. The values of the map indicate the 
275
  /// - Any readable arc/edge map. The values of the map indicate the
276 276
  /// arc/edge costs.
... ...
@@ -294,6 +294,6 @@
294 294
  /// Or if we don't know in advance the size of the tree, we can
295
  /// write this.  
295
  /// write this.
296 296
  ///\code
297 297
  /// std::vector<Arc> tree;
298
  /// kruskal(g,cost,std::back_inserter(tree)); 
298
  /// kruskal(g,cost,std::back_inserter(tree));
299 299
  ///\endcode
... ...
@@ -309,6 +309,6 @@
309 309
  Value kruskal(GR const& g, const In& in, Out& out)
310
#else 
310
#else
311 311
  template <class Graph, class In, class Out>
312
  inline typename _kruskal_bits::KruskalValueSelector<In>::Value 
313
  kruskal(const Graph& graph, const In& in, Out& out) 
312
  inline typename _kruskal_bits::KruskalValueSelector<In>::Value
313
  kruskal(const Graph& graph, const In& in, Out& out)
314 314
#endif
... ...
@@ -319,4 +319,4 @@
319 319

	
320
 
321
  
320

	
321

	
322 322

	
... ...
@@ -328,3 +328,3 @@
328 328
      kruskal(graph, in, out);
329
  }  
329
  }
330 330

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -48,11 +48,11 @@
48 48
      Value operator()(const std::string& str) {
49
	std::istringstream is(str);
50
	Value value;
51
	is >> value;
52

	
53
	char c;
54
	if (is >> std::ws >> c) {
55
	  throw DataFormatError("Remaining characters in token");
56
	}
57
	return value;
49
        std::istringstream is(str);
50
        Value value;
51
        is >> value;
52

	
53
        char c;
54
        if (is >> std::ws >> c) {
55
          throw DataFormatError("Remaining characters in token");
56
        }
57
        return value;
58 58
      }
... ...
@@ -63,3 +63,3 @@
63 63
      std::string operator()(const std::string& str) {
64
	return str;
64
        return str;
65 65
      }
... ...
@@ -67,3 +67,3 @@
67 67

	
68
    template <typename _Item>    
68
    template <typename _Item>
69 69
    class MapStorageBase {
... ...
@@ -80,4 +80,4 @@
80 80

	
81
    template <typename _Item, typename _Map, 
82
	      typename _Converter = DefaultConverter<typename _Map::Value> >
81
    template <typename _Item, typename _Map,
82
              typename _Converter = DefaultConverter<typename _Map::Value> >
83 83
    class MapStorage : public MapStorageBase<_Item> {
... ...
@@ -87,3 +87,3 @@
87 87
      typedef _Item Item;
88
      
88

	
89 89
    private:
... ...
@@ -93,4 +93,4 @@
93 93
    public:
94
      MapStorage(Map& map, const Converter& converter = Converter()) 
95
	: _map(map), _converter(converter) {}
94
      MapStorage(Map& map, const Converter& converter = Converter())
95
        : _map(map), _converter(converter) {}
96 96
      virtual ~MapStorage() {}
... ...
@@ -98,3 +98,3 @@
98 98
      virtual void set(const Item& item ,const std::string& value) {
99
	_map.set(item, _converter(value));
99
        _map.set(item, _converter(value));
100 100
      }
... ...
@@ -102,4 +102,4 @@
102 102

	
103
    template <typename _Graph, bool _dir, typename _Map, 
104
	      typename _Converter = DefaultConverter<typename _Map::Value> >
103
    template <typename _Graph, bool _dir, typename _Map,
104
              typename _Converter = DefaultConverter<typename _Map::Value> >
105 105
    class GraphArcMapStorage : public MapStorageBase<typename _Graph::Edge> {
... ...
@@ -111,3 +111,3 @@
111 111
      static const bool dir = _dir;
112
      
112

	
113 113
    private:
... ...
@@ -118,5 +118,5 @@
118 118
    public:
119
      GraphArcMapStorage(const Graph& graph, Map& map, 
120
			 const Converter& converter = Converter()) 
121
	: _graph(graph), _map(map), _converter(converter) {}
119
      GraphArcMapStorage(const Graph& graph, Map& map,
120
                         const Converter& converter = Converter())
121
        : _graph(graph), _map(map), _converter(converter) {}
122 122
      virtual ~GraphArcMapStorage() {}
... ...
@@ -124,3 +124,3 @@
124 124
      virtual void set(const Item& item ,const std::string& value) {
125
	_map.set(_graph.direct(item, dir), _converter(value));
125
        _map.set(_graph.direct(item, dir), _converter(value));
126 126
      }
... ...
@@ -148,6 +148,6 @@
148 148
      ValueStorage(Value& value, const Converter& converter = Converter())
149
 	: _value(value), _converter(converter) {}
149
         : _value(value), _converter(converter) {}
150 150

	
151 151
      virtual void set(const std::string& value) {
152
	_value = _converter(value);
152
        _value = _converter(value);
153 153
      }
... ...
@@ -178,18 +178,18 @@
178 178
      const std::map<std::string, typename Graph::Edge>& _map;
179
      
180
      GraphArcLookUpConverter(const Graph& graph, 
181
			      const std::map<std::string,
182
			                     typename Graph::Edge>& map) 
183
	: _graph(graph), _map(map) {}
184
      
179

	
180
      GraphArcLookUpConverter(const Graph& graph,
181
                              const std::map<std::string,
182
                                             typename Graph::Edge>& map)
183
        : _graph(graph), _map(map) {}
184

	
185 185
      typename Graph::Arc operator()(const std::string& str) {
186
	if (str.empty() || (str[0] != '+' && str[0] != '-')) {
187
	  throw DataFormatError("Item must start with '+' or '-'");
188
	}
189
	typename std::map<std::string, typename Graph::Edge>
190
	  ::const_iterator it = _map.find(str.substr(1));
191
	if (it == _map.end()) {
192
	  throw DataFormatError("Item not found");
193
	}
194
	return _graph.direct(it->second, str[0] == '+');
186
        if (str.empty() || (str[0] != '+' && str[0] != '-')) {
187
          throw DataFormatError("Item must start with '+' or '-'");
188
        }
189
        typename std::map<std::string, typename Graph::Edge>
190
          ::const_iterator it = _map.find(str.substr(1));
191
        if (it == _map.end()) {
192
          throw DataFormatError("Item not found");
193
        }
194
        return _graph.direct(it->second, str[0] == '+');
195 195
      }
... ...
@@ -198,10 +198,10 @@
198 198
    inline bool isWhiteSpace(char c) {
199
      return c == ' ' || c == '\t' || c == '\v' || 
200
        c == '\n' || c == '\r' || c == '\f'; 
199
      return c == ' ' || c == '\t' || c == '\v' ||
200
        c == '\n' || c == '\r' || c == '\f';
201 201
    }
202
    
202

	
203 203
    inline bool isOct(char c) {
204
      return '0' <= c && c <='7'; 
204
      return '0' <= c && c <='7';
205 205
    }
206
    
206

	
207 207
    inline int valueOct(char c) {
... ...
@@ -212,7 +212,7 @@
212 212
    inline bool isHex(char c) {
213
      return ('0' <= c && c <= '9') || 
214
	('a' <= c && c <= 'z') || 
215
	('A' <= c && c <= 'Z'); 
213
      return ('0' <= c && c <= '9') ||
214
        ('a' <= c && c <= 'z') ||
215
        ('A' <= c && c <= 'Z');
216 216
    }
217
    
217

	
218 218
    inline int valueHex(char c) {
... ...
@@ -226,3 +226,3 @@
226 226
      return ('a' <= c && c <= 'z') ||
227
	('A' <= c && c <= 'Z') || c == '_';
227
        ('A' <= c && c <= 'Z') || c == '_';
228 228
    }
... ...
@@ -231,3 +231,3 @@
231 231
      return isIdentifierFirstChar(c) ||
232
	('0' <= c && c <= '9');
232
        ('0' <= c && c <= '9');
233 233
    }
... ...
@@ -237,3 +237,3 @@
237 237
      if (!is.get(c))
238
	throw DataFormatError("Escape format error");
238
        throw DataFormatError("Escape format error");
239 239

	
... ...
@@ -241,47 +241,47 @@
241 241
      case '\\':
242
	return '\\';
242
        return '\\';
243 243
      case '\"':
244
	return '\"';
244
        return '\"';
245 245
      case '\'':
246
	return '\'';
246
        return '\'';
247 247
      case '\?':
248
	return '\?';
248
        return '\?';
249 249
      case 'a':
250
	return '\a';
250
        return '\a';
251 251
      case 'b':
252
	return '\b';
252
        return '\b';
253 253
      case 'f':
254
	return '\f';
254
        return '\f';
255 255
      case 'n':
256
	return '\n';
256
        return '\n';
257 257
      case 'r':
258
	return '\r';
258
        return '\r';
259 259
      case 't':
260
	return '\t';
260
        return '\t';
261 261
      case 'v':
262
	return '\v';
262
        return '\v';
263 263
      case 'x':
264
	{
265
	  int code;
266
	  if (!is.get(c) || !isHex(c)) 
267
	    throw DataFormatError("Escape format error");
268
	  else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
269
	  else code = code * 16 + valueHex(c);
270
	  return code;
271
	}
264
        {
265
          int code;
266
          if (!is.get(c) || !isHex(c))
267
            throw DataFormatError("Escape format error");
268
          else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
269
          else code = code * 16 + valueHex(c);
270
          return code;
271
        }
272 272
      default:
273
	{
274
	  int code;
275
	  if (!isOct(c)) 
276
	    throw DataFormatError("Escape format error");
277
	  else if (code = valueOct(c), !is.get(c) || !isOct(c)) 
278
	    is.putback(c);
279
	  else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c)) 
280
	    is.putback(c);
281
	  else code = code * 8 + valueOct(c);
282
	  return code;
283
	}	      
284
      } 
273
        {
274
          int code;
275
          if (!isOct(c))
276
            throw DataFormatError("Escape format error");
277
          else if (code = valueOct(c), !is.get(c) || !isOct(c))
278
            is.putback(c);
279
          else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c))
280
            is.putback(c);
281
          else code = code * 8 + valueOct(c);
282
          return code;
283
        }
284
      }
285 285
    }
286
    
286

	
287 287
    inline std::istream& readToken(std::istream& is, std::string& str) {
... ...
@@ -291,26 +291,26 @@
291 291
      is >> std::ws;
292
      
293
      if (!is.get(c)) 
294
	return is;
292

	
293
      if (!is.get(c))
294
        return is;
295 295

	
296 296
      if (c == '\"') {
297
	while (is.get(c) && c != '\"') {
298
	  if (c == '\\') 
299
	    c = readEscape(is);
300
	  os << c;
301
	}
302
	if (!is) 
303
	  throw DataFormatError("Quoted format error");
297
        while (is.get(c) && c != '\"') {
298
          if (c == '\\')
299
            c = readEscape(is);
300
          os << c;
301
        }
302
        if (!is)
303
          throw DataFormatError("Quoted format error");
304 304
      } else {
305
	is.putback(c);
306
	while (is.get(c) && !isWhiteSpace(c)) {
307
	  if (c == '\\') 
308
	    c = readEscape(is);
309
	  os << c;
310
	}
311
	if (!is) {
312
	  is.clear();
313
	} else {
314
	  is.putback(c);
315
	}
305
        is.putback(c);
306
        while (is.get(c) && !isWhiteSpace(c)) {
307
          if (c == '\\')
308
            c = readEscape(is);
309
          os << c;
310
        }
311
        if (!is) {
312
          is.clear();
313
        } else {
314
          is.putback(c);
315
        }
316 316
      }
... ...
@@ -333,3 +333,3 @@
333 333
    public:
334
      
334

	
335 335
      LineSection(const Functor& functor) : _functor(functor) {}
... ...
@@ -338,19 +338,19 @@
338 338
      virtual void process(std::istream& is, int& line_num) {
339
	char c;
340
	std::string line;
341
	while (is.get(c) && c != '@') {
342
	  if (c == '\n') {
343
	    ++line_num;
344
	  } else if (c == '#') {
345
	    getline(is, line);
346
	    ++line_num;
347
	  } else if (!isWhiteSpace(c)) {
348
	    is.putback(c);
349
	    getline(is, line);
350
	    _functor(line);
351
	    ++line_num;
352
	  }
353
	}
354
	if (is) is.putback(c);
355
	else if (is.eof()) is.clear();
339
        char c;
340
        std::string line;
341
        while (is.get(c) && c != '@') {
342
          if (c == '\n') {
343
            ++line_num;
344
          } else if (c == '#') {
345
            getline(is, line);
346
            ++line_num;
347
          } else if (!isWhiteSpace(c)) {
348
            is.putback(c);
349
            getline(is, line);
350
            _functor(line);
351
            ++line_num;
352
          }
353
        }
354
        if (is) is.putback(c);
355
        else if (is.eof()) is.clear();
356 356
      }
... ...
@@ -365,23 +365,23 @@
365 365
    public:
366
      
366

	
367 367
      StreamSection(const Functor& functor) : _functor(functor) {}
368
      virtual ~StreamSection() {} 
368
      virtual ~StreamSection() {}
369 369

	
370 370
      virtual void process(std::istream& is, int& line_num) {
371
	_functor(is, line_num);
372
	char c;
373
	std::string line;
374
	while (is.get(c) && c != '@') {
375
	  if (c == '\n') {
376
	    ++line_num;
377
	  } else if (!isWhiteSpace(c)) {
378
	    getline(is, line);
379
	    ++line_num;
380
	  }
381
	}
382
	if (is) is.putback(c);
383
	else if (is.eof()) is.clear();	
371
        _functor(is, line_num);
372
        char c;
373
        std::string line;
374
        while (is.get(c) && c != '@') {
375
          if (c == '\n') {
376
            ++line_num;
377
          } else if (!isWhiteSpace(c)) {
378
            getline(is, line);
379
            ++line_num;
380
          }
381
        }
382
        if (is) is.putback(c);
383
        else if (is.eof()) is.clear();
384 384
      }
385 385
    };
386
    
386

	
387 387
  }
... ...
@@ -401,3 +401,3 @@
401 401
  /// \ingroup lemon_io
402
  ///  
402
  ///
403 403
  /// \brief \ref lgf-format "LGF" reader for directed graphs
... ...
@@ -455,3 +455,3 @@
455 455
    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
456
    
456

	
457 457
  private:
... ...
@@ -472,6 +472,6 @@
472 472
    ArcIndex _arc_index;
473
    
474
    typedef std::vector<std::pair<std::string, 
475
      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
476
    NodeMaps _node_maps; 
473

	
474
    typedef std::vector<std::pair<std::string,
475
      _reader_bits::MapStorageBase<Node>*> > NodeMaps;
476
    NodeMaps _node_maps;
477 477

	
... ...
@@ -481,3 +481,3 @@
481 481

	
482
    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
482
    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*>
483 483
      Attributes;
... ...
@@ -500,6 +500,6 @@
500 500
    /// input stream.
501
    DigraphReader(std::istream& is, Digraph& digraph) 
501
    DigraphReader(std::istream& is, Digraph& digraph)
502 502
      : _is(&is), local_is(false), _digraph(digraph),
503
	_use_nodes(false), _use_arcs(false),
504
	_skip_nodes(false), _skip_arcs(false) {}
503
        _use_nodes(false), _use_arcs(false),
504
        _skip_nodes(false), _skip_arcs(false) {}
505 505

	
... ...
@@ -509,7 +509,7 @@
509 509
    /// file.
510
    DigraphReader(const std::string& fn, Digraph& digraph) 
510
    DigraphReader(const std::string& fn, Digraph& digraph)
511 511
      : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph),
512
    	_use_nodes(false), _use_arcs(false),
513
	_skip_nodes(false), _skip_arcs(false) {}
514
    
512
            _use_nodes(false), _use_arcs(false),
513
        _skip_nodes(false), _skip_arcs(false) {}
514

	
515 515
    /// \brief Constructor
... ...
@@ -518,6 +518,6 @@
518 518
    /// file.
519
    DigraphReader(const char* fn, Digraph& digraph) 
519
    DigraphReader(const char* fn, Digraph& digraph)
520 520
      : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
521
    	_use_nodes(false), _use_arcs(false),
522
	_skip_nodes(false), _skip_arcs(false) {}
521
            _use_nodes(false), _use_arcs(false),
522
        _skip_nodes(false), _skip_arcs(false) {}
523 523

	
... ...
@@ -525,15 +525,15 @@
525 525
    ~DigraphReader() {
526
      for (typename NodeMaps::iterator it = _node_maps.begin(); 
527
	   it != _node_maps.end(); ++it) {
528
	delete it->second;
526
      for (typename NodeMaps::iterator it = _node_maps.begin();
527
           it != _node_maps.end(); ++it) {
528
        delete it->second;
529 529
      }
530 530

	
531
      for (typename ArcMaps::iterator it = _arc_maps.begin(); 
532
	   it != _arc_maps.end(); ++it) {
533
	delete it->second;
531
      for (typename ArcMaps::iterator it = _arc_maps.begin();
532
           it != _arc_maps.end(); ++it) {
533
        delete it->second;
534 534
      }
535 535

	
536
      for (typename Attributes::iterator it = _attributes.begin(); 
537
	   it != _attributes.end(); ++it) {
538
	delete it->second;
536
      for (typename Attributes::iterator it = _attributes.begin();
537
           it != _attributes.end(); ++it) {
538
        delete it->second;
539 539
      }
... ...
@@ -541,3 +541,3 @@
541 541
      if (local_is) {
542
	delete _is;
542
        delete _is;
543 543
      }
... ...
@@ -548,13 +548,13 @@
548 548

	
549
    friend DigraphReader<Digraph> digraphReader<>(std::istream& is, 
550
						  Digraph& digraph);    
551
    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn, 
552
						  Digraph& digraph);   
553
    friend DigraphReader<Digraph> digraphReader<>(const char *fn, 
554
						  Digraph& digraph);    
555

	
556
    DigraphReader(DigraphReader& other) 
549
    friend DigraphReader<Digraph> digraphReader<>(std::istream& is,
550
                                                  Digraph& digraph);
551
    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn,
552
                                                  Digraph& digraph);
553
    friend DigraphReader<Digraph> digraphReader<>(const char *fn,
554
                                                  Digraph& digraph);
555

	
556
    DigraphReader(DigraphReader& other)
557 557
      : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
558
	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
559
	_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
558
        _use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
559
        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
560 560

	
... ...
@@ -562,3 +562,3 @@
562 562
      other.local_is = false;
563
      
563

	
564 564
      _node_index.swap(other._node_index);
... ...
@@ -582,3 +582,3 @@
582 582
    /// @{
583
    
583

	
584 584
    /// \brief Node map reading rule
... ...
@@ -589,4 +589,4 @@
589 589
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
590
      _reader_bits::MapStorageBase<Node>* storage = 
591
	new _reader_bits::MapStorage<Node, Map>(map);
590
      _reader_bits::MapStorageBase<Node>* storage =
591
        new _reader_bits::MapStorage<Node, Map>(map);
592 592
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -600,7 +600,7 @@
600 600
    template <typename Map, typename Converter>
601
    DigraphReader& nodeMap(const std::string& caption, Map& map, 
602
			   const Converter& converter = Converter()) {
601
    DigraphReader& nodeMap(const std::string& caption, Map& map,
602
                           const Converter& converter = Converter()) {
603 603
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
604
      _reader_bits::MapStorageBase<Node>* storage = 
605
	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
604
      _reader_bits::MapStorageBase<Node>* storage =
605
        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
606 606
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -615,4 +615,4 @@
615 615
      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
616
      _reader_bits::MapStorageBase<Arc>* storage = 
617
	new _reader_bits::MapStorage<Arc, Map>(map);
616
      _reader_bits::MapStorageBase<Arc>* storage =
617
        new _reader_bits::MapStorage<Arc, Map>(map);
618 618
      _arc_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -626,7 +626,7 @@
626 626
    template <typename Map, typename Converter>
627
    DigraphReader& arcMap(const std::string& caption, Map& map, 
628
			  const Converter& converter = Converter()) {
627
    DigraphReader& arcMap(const std::string& caption, Map& map,
628
                          const Converter& converter = Converter()) {
629 629
      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
630
      _reader_bits::MapStorageBase<Arc>* storage = 
631
	new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
630
      _reader_bits::MapStorageBase<Arc>* storage =
631
        new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
632 632
      _arc_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -640,4 +640,4 @@
640 640
    DigraphReader& attribute(const std::string& caption, Value& value) {
641
      _reader_bits::ValueStorageBase* storage = 
642
	new _reader_bits::ValueStorage<Value>(value);
641
      _reader_bits::ValueStorageBase* storage =
642
        new _reader_bits::ValueStorage<Value>(value);
643 643
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -651,6 +651,6 @@
651 651
    template <typename Value, typename Converter>
652
    DigraphReader& attribute(const std::string& caption, Value& value, 
653
			     const Converter& converter = Converter()) {
654
      _reader_bits::ValueStorageBase* storage = 
655
	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
652
    DigraphReader& attribute(const std::string& caption, Value& value,
653
                             const Converter& converter = Converter()) {
654
      _reader_bits::ValueStorageBase* storage =
655
        new _reader_bits::ValueStorage<Value, Converter>(value, converter);
656 656
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -665,4 +665,4 @@
665 665
      Converter converter(_node_index);
666
      _reader_bits::ValueStorageBase* storage = 
667
	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
666
      _reader_bits::ValueStorageBase* storage =
667
        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
668 668
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -677,4 +677,4 @@
677 677
      Converter converter(_arc_index);
678
      _reader_bits::ValueStorageBase* storage = 
679
	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
678
      _reader_bits::ValueStorageBase* storage =
679
        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
680 680
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -724,3 +724,3 @@
724 724
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
725
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
725
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
726 726
      _use_nodes = true;
... ...
@@ -728,3 +728,3 @@
728 728
      for (NodeIt n(_digraph); n != INVALID; ++n) {
729
	_node_index.insert(std::make_pair(converter(map[n]), n));
729
        _node_index.insert(std::make_pair(converter(map[n]), n));
730 730
      }
... ...
@@ -739,9 +739,9 @@
739 739
    template <typename Map, typename Converter>
740
    DigraphReader& useNodes(const Map& map, 
741
			    const Converter& converter = Converter()) {
740
    DigraphReader& useNodes(const Map& map,
741
                            const Converter& converter = Converter()) {
742 742
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
743
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
743
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
744 744
      _use_nodes = true;
745 745
      for (NodeIt n(_digraph); n != INVALID; ++n) {
746
	_node_index.insert(std::make_pair(converter(map[n]), n));
746
        _node_index.insert(std::make_pair(converter(map[n]), n));
747 747
      }
... ...
@@ -761,3 +761,3 @@
761 761
      for (ArcIt a(_digraph); a != INVALID; ++a) {
762
	_arc_index.insert(std::make_pair(converter(map[a]), a));
762
        _arc_index.insert(std::make_pair(converter(map[a]), a));
763 763
      }
... ...
@@ -772,9 +772,9 @@
772 772
    template <typename Map, typename Converter>
773
    DigraphReader& useArcs(const Map& map, 
774
			   const Converter& converter = Converter()) {
773
    DigraphReader& useArcs(const Map& map,
774
                           const Converter& converter = Converter()) {
775 775
      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
776
      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member"); 
776
      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member");
777 777
      _use_arcs = true;
778 778
      for (ArcIt a(_digraph); a != INVALID; ++a) {
779
	_arc_index.insert(std::make_pair(converter(map[a]), a));
779
        _arc_index.insert(std::make_pair(converter(map[a]), a));
780 780
      }
... ...
@@ -792,3 +792,3 @@
792 792
    DigraphReader& skipNodes() {
793
      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set"); 
793
      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
794 794
      _skip_nodes = true;
... ...
@@ -803,3 +803,3 @@
803 803
    DigraphReader& skipArcs() {
804
      LEMON_ASSERT(!_skip_arcs, "Skip arcs already set"); 
804
      LEMON_ASSERT(!_skip_arcs, "Skip arcs already set");
805 805
      _skip_arcs = true;
... ...
@@ -815,8 +815,8 @@
815 815
      while(++line_num, std::getline(*_is, str)) {
816
	line.clear(); line.str(str);
817
	char c;
818
	if (line >> std::ws >> c && c != '#') {
819
	  line.putback(c);
820
	  return true;
821
	}
816
        line.clear(); line.str(str);
817
        char c;
818
        if (line >> std::ws >> c && c != '#') {
819
          line.putback(c);
820
          return true;
821
        }
822 822
      }
... ...
@@ -828,3 +828,3 @@
828 828
    }
829
    
829

	
830 830
    void skipSection() {
... ...
@@ -832,3 +832,3 @@
832 832
      while (readSuccess() && line >> c && c != '@') {
833
	readLine();
833
        readLine();
834 834
      }
... ...
@@ -844,6 +844,6 @@
844 844
      if (!readLine() || !(line >> c) || c == '@') {
845
	if (readSuccess() && line) line.putback(c);
846
	if (!_node_maps.empty()) 
847
	  throw DataFormatError("Cannot find map names");
848
	return;
845
        if (readSuccess() && line) line.putback(c);
846
        if (!_node_maps.empty())
847
          throw DataFormatError("Cannot find map names");
848
        return;
849 849
      }
... ...
@@ -852,36 +852,36 @@
852 852
      {
853
	std::map<std::string, int> maps;
854
	
855
	std::string map;
856
	int index = 0;
857
	while (_reader_bits::readToken(line, map)) {
858
	  if (maps.find(map) != maps.end()) {
859
	    std::ostringstream msg;
860
	    msg << "Multiple occurence of node map: " << map;
861
	    throw DataFormatError(msg.str().c_str());
862
	  }
863
	  maps.insert(std::make_pair(map, index));
864
	  ++index;
865
	}
866
	
867
	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
868
	  std::map<std::string, int>::iterator jt = 
869
	    maps.find(_node_maps[i].first);
870
	  if (jt == maps.end()) {
871
	    std::ostringstream msg;
872
	    msg << "Map not found in file: " << _node_maps[i].first;
873
	    throw DataFormatError(msg.str().c_str());
874
	  }
875
	  map_index[i] = jt->second;
876
	}
877

	
878
	{
879
	  std::map<std::string, int>::iterator jt = maps.find("label");
880
	  if (jt != maps.end()) {
881
	    label_index = jt->second;
882
	  } else {
883
	    label_index = -1;
884
	  }
885
	}
886
	map_num = maps.size();
853
        std::map<std::string, int> maps;
854

	
855
        std::string map;
856
        int index = 0;
857
        while (_reader_bits::readToken(line, map)) {
858
          if (maps.find(map) != maps.end()) {
859
            std::ostringstream msg;
860
            msg << "Multiple occurence of node map: " << map;
861
            throw DataFormatError(msg.str().c_str());
862
          }
863
          maps.insert(std::make_pair(map, index));
864
          ++index;
865
        }
866

	
867
        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
868
          std::map<std::string, int>::iterator jt =
869
            maps.find(_node_maps[i].first);
870
          if (jt == maps.end()) {
871
            std::ostringstream msg;
872
            msg << "Map not found in file: " << _node_maps[i].first;
873
            throw DataFormatError(msg.str().c_str());
874
          }
875
          map_index[i] = jt->second;
876
        }
877

	
878
        {
879
          std::map<std::string, int>::iterator jt = maps.find("label");
880
          if (jt != maps.end()) {
881
            label_index = jt->second;
882
          } else {
883
            label_index = -1;
884
          }
885
        }
886
        map_num = maps.size();
887 887
      }
... ...
@@ -889,36 +889,36 @@
889 889
      while (readLine() && line >> c && c != '@') {
890
	line.putback(c);
891

	
892
	std::vector<std::string> tokens(map_num);
893
	for (int i = 0; i < map_num; ++i) {
894
	  if (!_reader_bits::readToken(line, tokens[i])) {
895
	    std::ostringstream msg;
896
	    msg << "Column not found (" << i + 1 << ")";
897
	    throw DataFormatError(msg.str().c_str());
898
	  }
899
	}
900
	if (line >> std::ws >> c)
901
	  throw DataFormatError("Extra character on the end of line");
902
	
903
	Node n;
904
	if (!_use_nodes) {
905
	  n = _digraph.addNode();
906
	  if (label_index != -1)
907
	    _node_index.insert(std::make_pair(tokens[label_index], n));
908
	} else {
909
	  if (label_index == -1) 
910
	    throw DataFormatError("Label map not found in file");
911
	  typename std::map<std::string, Node>::iterator it =
912
	    _node_index.find(tokens[label_index]);
913
	  if (it == _node_index.end()) {
914
	    std::ostringstream msg;
915
	    msg << "Node with label not found: " << tokens[label_index];
916
	    throw DataFormatError(msg.str().c_str());	    
917
	  }
918
	  n = it->second;
919
	}
920

	
921
	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
922
	  _node_maps[i].second->set(n, tokens[map_index[i]]);
923
	}
890
        line.putback(c);
891

	
892
        std::vector<std::string> tokens(map_num);
893
        for (int i = 0; i < map_num; ++i) {
894
          if (!_reader_bits::readToken(line, tokens[i])) {
895
            std::ostringstream msg;
896
            msg << "Column not found (" << i + 1 << ")";
897
            throw DataFormatError(msg.str().c_str());
898
          }
899
        }
900
        if (line >> std::ws >> c)
901
          throw DataFormatError("Extra character on the end of line");
902

	
903
        Node n;
904
        if (!_use_nodes) {
905
          n = _digraph.addNode();
906
          if (label_index != -1)
907
            _node_index.insert(std::make_pair(tokens[label_index], n));
908
        } else {
909
          if (label_index == -1)
910
            throw DataFormatError("Label map not found in file");
911
          typename std::map<std::string, Node>::iterator it =
912
            _node_index.find(tokens[label_index]);
913
          if (it == _node_index.end()) {
914
            std::ostringstream msg;
915
            msg << "Node with label not found: " << tokens[label_index];
916
            throw DataFormatError(msg.str().c_str());
917
          }
918
          n = it->second;
919
        }
920

	
921
        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
922
          _node_maps[i].second->set(n, tokens[map_index[i]]);
923
        }
924 924

	
... ...
@@ -926,3 +926,3 @@
926 926
      if (readSuccess()) {
927
	line.putback(c);
927
        line.putback(c);
928 928
      }
... ...
@@ -937,44 +937,44 @@
937 937
      if (!readLine() || !(line >> c) || c == '@') {
938
	if (readSuccess() && line) line.putback(c);
939
	if (!_arc_maps.empty()) 
940
	  throw DataFormatError("Cannot find map names");
941
	return;
938
        if (readSuccess() && line) line.putback(c);
939
        if (!_arc_maps.empty())
940
          throw DataFormatError("Cannot find map names");
941
        return;
942 942
      }
943 943
      line.putback(c);
944
      
944

	
945 945
      {
946
	std::map<std::string, int> maps;
947
	
948
	std::string map;
949
	int index = 0;
950
	while (_reader_bits::readToken(line, map)) {
951
	  if (maps.find(map) != maps.end()) {
952
	    std::ostringstream msg;
953
	    msg << "Multiple occurence of arc map: " << map;
954
	    throw DataFormatError(msg.str().c_str());
955
	  }
956
	  maps.insert(std::make_pair(map, index));
957
	  ++index;
958
	}
959
	
960
	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
961
	  std::map<std::string, int>::iterator jt = 
962
	    maps.find(_arc_maps[i].first);
963
	  if (jt == maps.end()) {
964
	    std::ostringstream msg;
965
	    msg << "Map not found in file: " << _arc_maps[i].first;
966
	    throw DataFormatError(msg.str().c_str());
967
	  }
968
	  map_index[i] = jt->second;
969
	}
970

	
971
	{
972
	  std::map<std::string, int>::iterator jt = maps.find("label");
973
	  if (jt != maps.end()) {
974
	    label_index = jt->second;
975
	  } else {
976
	    label_index = -1;
977
	  }
978
	}
979
	map_num = maps.size();
946
        std::map<std::string, int> maps;
947

	
948
        std::string map;
949
        int index = 0;
950
        while (_reader_bits::readToken(line, map)) {
951
          if (maps.find(map) != maps.end()) {
952
            std::ostringstream msg;
953
            msg << "Multiple occurence of arc map: " << map;
954
            throw DataFormatError(msg.str().c_str());
955
          }
956
          maps.insert(std::make_pair(map, index));
957
          ++index;
958
        }
959

	
960
        for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
961
          std::map<std::string, int>::iterator jt =
962
            maps.find(_arc_maps[i].first);
963
          if (jt == maps.end()) {
964
            std::ostringstream msg;
965
            msg << "Map not found in file: " << _arc_maps[i].first;
966
            throw DataFormatError(msg.str().c_str());
967
          }
968
          map_index[i] = jt->second;
969
        }
970

	
971
        {
972
          std::map<std::string, int>::iterator jt = maps.find("label");
973
          if (jt != maps.end()) {
974
            label_index = jt->second;
975
          } else {
976
            label_index = -1;
977
          }
978
        }
979
        map_num = maps.size();
980 980
      }
... ...
@@ -982,29 +982,29 @@
982 982
      while (readLine() && line >> c && c != '@') {
983
	line.putback(c);
984

	
985
	std::string source_token;
986
	std::string target_token;
987

	
988
	if (!_reader_bits::readToken(line, source_token))
989
	  throw DataFormatError("Source not found");
990

	
991
	if (!_reader_bits::readToken(line, target_token))
992
	  throw DataFormatError("Target not found");
993
	
994
	std::vector<std::string> tokens(map_num);
995
	for (int i = 0; i < map_num; ++i) {
996
	  if (!_reader_bits::readToken(line, tokens[i])) {
997
	    std::ostringstream msg;
998
	    msg << "Column not found (" << i + 1 << ")";
999
	    throw DataFormatError(msg.str().c_str());
1000
	  }
1001
	}
1002
	if (line >> std::ws >> c)
1003
	  throw DataFormatError("Extra character on the end of line");
1004
	
1005
	Arc a;
1006
	if (!_use_arcs) {
983
        line.putback(c);
984

	
985
        std::string source_token;
986
        std::string target_token;
987

	
988
        if (!_reader_bits::readToken(line, source_token))
989
          throw DataFormatError("Source not found");
990

	
991
        if (!_reader_bits::readToken(line, target_token))
992
          throw DataFormatError("Target not found");
993

	
994
        std::vector<std::string> tokens(map_num);
995
        for (int i = 0; i < map_num; ++i) {
996
          if (!_reader_bits::readToken(line, tokens[i])) {
997
            std::ostringstream msg;
998
            msg << "Column not found (" << i + 1 << ")";
999
            throw DataFormatError(msg.str().c_str());
1000
          }
1001
        }
1002
        if (line >> std::ws >> c)
1003
          throw DataFormatError("Extra character on the end of line");
1004

	
1005
        Arc a;
1006
        if (!_use_arcs) {
1007 1007

	
1008 1008
          typename NodeIndex::iterator it;
1009
 
1009

	
1010 1010
          it = _node_index.find(source_token);
... ...
@@ -1018,28 +1018,28 @@
1018 1018
          it = _node_index.find(target_token);
1019
          if (it == _node_index.end()) {       
1020
            std::ostringstream msg;            
1019
          if (it == _node_index.end()) {
1020
            std::ostringstream msg;
1021 1021
            msg << "Item not found: " << target_token;
1022 1022
            throw DataFormatError(msg.str().c_str());
1023
          }                                          
1024
          Node target = it->second;                            
1025

	
1026
	  a = _digraph.addArc(source, target);
1027
	  if (label_index != -1) 
1028
	    _arc_index.insert(std::make_pair(tokens[label_index], a));
1029
	} else {
1030
	  if (label_index == -1) 
1031
	    throw DataFormatError("Label map not found in file");
1032
	  typename std::map<std::string, Arc>::iterator it =
1033
	    _arc_index.find(tokens[label_index]);
1034
	  if (it == _arc_index.end()) {
1035
	    std::ostringstream msg;
1036
	    msg << "Arc with label not found: " << tokens[label_index];
1037
	    throw DataFormatError(msg.str().c_str());	    
1038
	  }
1039
	  a = it->second;
1040
	}
1041

	
1042
	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
1043
	  _arc_maps[i].second->set(a, tokens[map_index[i]]);
1044
	}
1023
          }
1024
          Node target = it->second;
1025

	
1026
          a = _digraph.addArc(source, target);
1027
          if (label_index != -1)
1028
            _arc_index.insert(std::make_pair(tokens[label_index], a));
1029
        } else {
1030
          if (label_index == -1)
1031
            throw DataFormatError("Label map not found in file");
1032
          typename std::map<std::string, Arc>::iterator it =
1033
            _arc_index.find(tokens[label_index]);
1034
          if (it == _arc_index.end()) {
1035
            std::ostringstream msg;
1036
            msg << "Arc with label not found: " << tokens[label_index];
1037
            throw DataFormatError(msg.str().c_str());
1038
          }
1039
          a = it->second;
1040
        }
1041

	
1042
        for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
1043
          _arc_maps[i].second->set(a, tokens[map_index[i]]);
1044
        }
1045 1045

	
... ...
@@ -1047,3 +1047,3 @@
1047 1047
      if (readSuccess()) {
1048
	line.putback(c);
1048
        line.putback(c);
1049 1049
      }
... ...
@@ -1057,29 +1057,29 @@
1057 1057
      while (readLine() && line >> c && c != '@') {
1058
	line.putback(c);
1059
	
1060
	std::string attr, token;
1061
	if (!_reader_bits::readToken(line, attr))
1062
	  throw DataFormatError("Attribute name not found");
1063
	if (!_reader_bits::readToken(line, token))
1064
	  throw DataFormatError("Attribute value not found");
1065
	if (line >> c)
1066
	  throw DataFormatError("Extra character on the end of line");	  
1067

	
1068
	{
1069
	  std::set<std::string>::iterator it = read_attr.find(attr);
1070
	  if (it != read_attr.end()) {
1071
	    std::ostringstream msg;
1072
	    msg << "Multiple occurence of attribute " << attr;
1073
	    throw DataFormatError(msg.str().c_str());
1074
	  }
1075
	  read_attr.insert(attr);
1076
	}
1077
	
1078
	{
1079
	  typename Attributes::iterator it = _attributes.lower_bound(attr);
1080
	  while (it != _attributes.end() && it->first == attr) {
1081
	    it->second->set(token);
1082
	    ++it;
1083
	  }
1084
	}
1058
        line.putback(c);
1059

	
1060
        std::string attr, token;
1061
        if (!_reader_bits::readToken(line, attr))
1062
          throw DataFormatError("Attribute name not found");
1063
        if (!_reader_bits::readToken(line, token))
1064
          throw DataFormatError("Attribute value not found");
1065
        if (line >> c)
1066
          throw DataFormatError("Extra character on the end of line");
1067

	
1068
        {
1069
          std::set<std::string>::iterator it = read_attr.find(attr);
1070
          if (it != read_attr.end()) {
1071
            std::ostringstream msg;
1072
            msg << "Multiple occurence of attribute " << attr;
1073
            throw DataFormatError(msg.str().c_str());
1074
          }
1075
          read_attr.insert(attr);
1076
        }
1077

	
1078
        {
1079
          typename Attributes::iterator it = _attributes.lower_bound(attr);
1080
          while (it != _attributes.end() && it->first == attr) {
1081
            it->second->set(token);
1082
            ++it;
1083
          }
1084
        }
1085 1085

	
... ...
@@ -1087,11 +1087,11 @@
1087 1087
      if (readSuccess()) {
1088
	line.putback(c);
1088
        line.putback(c);
1089 1089
      }
1090 1090
      for (typename Attributes::iterator it = _attributes.begin();
1091
	   it != _attributes.end(); ++it) {
1092
	if (read_attr.find(it->first) == read_attr.end()) {
1093
	  std::ostringstream msg;
1094
	  msg << "Attribute not found in file: " << it->first;
1095
	  throw DataFormatError(msg.str().c_str());
1096
	}	
1091
           it != _attributes.end(); ++it) {
1092
        if (read_attr.find(it->first) == read_attr.end()) {
1093
          std::ostringstream msg;
1094
          msg << "Attribute not found in file: " << it->first;
1095
          throw DataFormatError(msg.str().c_str());
1096
        }
1097 1097
      }
... ...
@@ -1101,3 +1101,3 @@
1101 1101

	
1102
    /// \name Execution of the reader    
1102
    /// \name Execution of the reader
1103 1103
    /// @{
... ...
@@ -1110,5 +1110,5 @@
1110 1110
      if (!*_is) {
1111
	throw DataFormatError("Cannot find file");
1111
        throw DataFormatError("Cannot find file");
1112 1112
      }
1113
      
1113

	
1114 1114
      bool nodes_done = _skip_nodes;
... ...
@@ -1117,3 +1117,3 @@
1117 1117

	
1118
      line_num = 0;      
1118
      line_num = 0;
1119 1119
      readLine();
... ...
@@ -1122,36 +1122,36 @@
1122 1122
      while (readSuccess()) {
1123
	try {
1124
	  char c;
1125
	  std::string section, caption;
1126
	  line >> c;
1127
	  _reader_bits::readToken(line, section);
1128
	  _reader_bits::readToken(line, caption);
1129

	
1130
	  if (line >> c) 
1131
	    throw DataFormatError("Extra character on the end of line");
1132

	
1133
	  if (section == "nodes" && !nodes_done) {
1134
	    if (_nodes_caption.empty() || _nodes_caption == caption) {
1135
	      readNodes();
1136
	      nodes_done = true;
1137
	    }
1138
	  } else if ((section == "arcs" || section == "edges") && 
1139
		     !arcs_done) {
1140
	    if (_arcs_caption.empty() || _arcs_caption == caption) {
1141
	      readArcs();
1142
	      arcs_done = true;
1143
	    }
1144
	  } else if (section == "attributes" && !attributes_done) {
1145
	    if (_attributes_caption.empty() || _attributes_caption == caption) {
1146
	      readAttributes();
1147
	      attributes_done = true;
1148
	    }
1149
	  } else {
1150
	    readLine();
1151
	    skipSection();
1152
	  }
1153
	} catch (DataFormatError& error) {
1154
	  error.line(line_num);
1155
	  throw;
1156
	}	
1123
        try {
1124
          char c;
1125
          std::string section, caption;
1126
          line >> c;
1127
          _reader_bits::readToken(line, section);
1128
          _reader_bits::readToken(line, caption);
1129

	
1130
          if (line >> c)
1131
            throw DataFormatError("Extra character on the end of line");
1132

	
1133
          if (section == "nodes" && !nodes_done) {
1134
            if (_nodes_caption.empty() || _nodes_caption == caption) {
1135
              readNodes();
1136
              nodes_done = true;
1137
            }
1138
          } else if ((section == "arcs" || section == "edges") &&
1139
                     !arcs_done) {
1140
            if (_arcs_caption.empty() || _arcs_caption == caption) {
1141
              readArcs();
1142
              arcs_done = true;
1143
            }
1144
          } else if (section == "attributes" && !attributes_done) {
1145
            if (_attributes_caption.empty() || _attributes_caption == caption) {
1146
              readAttributes();
1147
              attributes_done = true;
1148
            }
1149
          } else {
1150
            readLine();
1151
            skipSection();
1152
          }
1153
        } catch (DataFormatError& error) {
1154
          error.line(line_num);
1155
          throw;
1156
        }
1157 1157
      }
... ...
@@ -1159,3 +1159,3 @@
1159 1159
      if (!nodes_done) {
1160
	throw DataFormatError("Section @nodes not found");
1160
        throw DataFormatError("Section @nodes not found");
1161 1161
      }
... ...
@@ -1163,3 +1163,3 @@
1163 1163
      if (!arcs_done) {
1164
	throw DataFormatError("Section @arcs not found");
1164
        throw DataFormatError("Section @arcs not found");
1165 1165
      }
... ...
@@ -1167,3 +1167,3 @@
1167 1167
      if (!attributes_done && !_attributes.empty()) {
1168
	throw DataFormatError("Section @attributes not found");
1168
        throw DataFormatError("Section @attributes not found");
1169 1169
      }
... ...
@@ -1173,3 +1173,3 @@
1173 1173
    /// @}
1174
    
1174

	
1175 1175
  };
... ...
@@ -1177,3 +1177,3 @@
1177 1177
  /// \brief Return a \ref DigraphReader class
1178
  /// 
1178
  ///
1179 1179
  /// This function just returns a \ref DigraphReader class.
... ...
@@ -1187,3 +1187,3 @@
1187 1187
  /// \brief Return a \ref DigraphReader class
1188
  /// 
1188
  ///
1189 1189
  /// This function just returns a \ref DigraphReader class.
... ...
@@ -1191,4 +1191,4 @@
1191 1191
  template <typename Digraph>
1192
  DigraphReader<Digraph> digraphReader(const std::string& fn, 
1193
				       Digraph& digraph) {
1192
  DigraphReader<Digraph> digraphReader(const std::string& fn,
1193
                                       Digraph& digraph) {
1194 1194
    DigraphReader<Digraph> tmp(fn, digraph);
... ...
@@ -1198,3 +1198,3 @@
1198 1198
  /// \brief Return a \ref DigraphReader class
1199
  /// 
1199
  ///
1200 1200
  /// This function just returns a \ref DigraphReader class.
... ...
@@ -1211,12 +1211,12 @@
1211 1211
  template <typename Graph>
1212
  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);    
1212
  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);
1213 1213

	
1214 1214
  template <typename Graph>
1215
  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);   
1215
  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);
1216 1216

	
1217 1217
  template <typename Graph>
1218
  GraphReader<Graph> graphReader(const char *fn, Graph& graph);    
1218
  GraphReader<Graph> graphReader(const char *fn, Graph& graph);
1219 1219

	
1220 1220
  /// \ingroup lemon_io
1221
  ///  
1221
  ///
1222 1222
  /// \brief \ref lgf-format "LGF" reader for undirected graphs
... ...
@@ -1240,3 +1240,3 @@
1240 1240
    TEMPLATE_GRAPH_TYPEDEFS(Graph);
1241
    
1241

	
1242 1242
  private:
... ...
@@ -1256,6 +1256,6 @@
1256 1256
    EdgeIndex _edge_index;
1257
    
1258
    typedef std::vector<std::pair<std::string, 
1259
      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
1260
    NodeMaps _node_maps; 
1257

	
1258
    typedef std::vector<std::pair<std::string,
1259
      _reader_bits::MapStorageBase<Node>*> > NodeMaps;
1260
    NodeMaps _node_maps;
1261 1261

	
... ...
@@ -1265,3 +1265,3 @@
1265 1265

	
1266
    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
1266
    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*>
1267 1267
      Attributes;
... ...
@@ -1284,6 +1284,6 @@
1284 1284
    /// input stream.
1285
    GraphReader(std::istream& is, Graph& graph) 
1285
    GraphReader(std::istream& is, Graph& graph)
1286 1286
      : _is(&is), local_is(false), _graph(graph),
1287
	_use_nodes(false), _use_edges(false),
1288
	_skip_nodes(false), _skip_edges(false) {}
1287
        _use_nodes(false), _use_edges(false),
1288
        _skip_nodes(false), _skip_edges(false) {}
1289 1289

	
... ...
@@ -1293,7 +1293,7 @@
1293 1293
    /// file.
1294
    GraphReader(const std::string& fn, Graph& graph) 
1294
    GraphReader(const std::string& fn, Graph& graph)
1295 1295
      : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph),
1296
    	_use_nodes(false), _use_edges(false),
1297
	_skip_nodes(false), _skip_edges(false) {}
1298
    
1296
            _use_nodes(false), _use_edges(false),
1297
        _skip_nodes(false), _skip_edges(false) {}
1298

	
1299 1299
    /// \brief Constructor
... ...
@@ -1302,6 +1302,6 @@
1302 1302
    /// file.
1303
    GraphReader(const char* fn, Graph& graph) 
1303
    GraphReader(const char* fn, Graph& graph)
1304 1304
      : _is(new std::ifstream(fn)), local_is(true), _graph(graph),
1305
    	_use_nodes(false), _use_edges(false),
1306
	_skip_nodes(false), _skip_edges(false) {}
1305
            _use_nodes(false), _use_edges(false),
1306
        _skip_nodes(false), _skip_edges(false) {}
1307 1307

	
... ...
@@ -1309,15 +1309,15 @@
1309 1309
    ~GraphReader() {
1310
      for (typename NodeMaps::iterator it = _node_maps.begin(); 
1311
	   it != _node_maps.end(); ++it) {
1312
	delete it->second;
1310
      for (typename NodeMaps::iterator it = _node_maps.begin();
1311
           it != _node_maps.end(); ++it) {
1312
        delete it->second;
1313 1313
      }
1314 1314

	
1315
      for (typename EdgeMaps::iterator it = _edge_maps.begin(); 
1316
	   it != _edge_maps.end(); ++it) {
1317
	delete it->second;
1315
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
1316
           it != _edge_maps.end(); ++it) {
1317
        delete it->second;
1318 1318
      }
1319 1319

	
1320
      for (typename Attributes::iterator it = _attributes.begin(); 
1321
	   it != _attributes.end(); ++it) {
1322
	delete it->second;
1320
      for (typename Attributes::iterator it = _attributes.begin();
1321
           it != _attributes.end(); ++it) {
1322
        delete it->second;
1323 1323
      }
... ...
@@ -1325,3 +1325,3 @@
1325 1325
      if (local_is) {
1326
	delete _is;
1326
        delete _is;
1327 1327
      }
... ...
@@ -1331,11 +1331,11 @@
1331 1331
  private:
1332
    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);    
1333
    friend GraphReader<Graph> graphReader<>(const std::string& fn, 
1334
					    Graph& graph);   
1335
    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);    
1336

	
1337
    GraphReader(GraphReader& other) 
1332
    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);
1333
    friend GraphReader<Graph> graphReader<>(const std::string& fn,
1334
                                            Graph& graph);
1335
    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);
1336

	
1337
    GraphReader(GraphReader& other)
1338 1338
      : _is(other._is), local_is(other.local_is), _graph(other._graph),
1339
	_use_nodes(other._use_nodes), _use_edges(other._use_edges),
1340
	_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
1339
        _use_nodes(other._use_nodes), _use_edges(other._use_edges),
1340
        _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
1341 1341

	
... ...
@@ -1343,3 +1343,3 @@
1343 1343
      other.local_is = false;
1344
      
1344

	
1345 1345
      _node_index.swap(other._node_index);
... ...
@@ -1363,3 +1363,3 @@
1363 1363
    /// @{
1364
    
1364

	
1365 1365
    /// \brief Node map reading rule
... ...
@@ -1370,4 +1370,4 @@
1370 1370
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
1371
      _reader_bits::MapStorageBase<Node>* storage = 
1372
	new _reader_bits::MapStorage<Node, Map>(map);
1371
      _reader_bits::MapStorageBase<Node>* storage =
1372
        new _reader_bits::MapStorage<Node, Map>(map);
1373 1373
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1381,7 +1381,7 @@
1381 1381
    template <typename Map, typename Converter>
1382
    GraphReader& nodeMap(const std::string& caption, Map& map, 
1383
			   const Converter& converter = Converter()) {
1382
    GraphReader& nodeMap(const std::string& caption, Map& map,
1383
                           const Converter& converter = Converter()) {
1384 1384
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
1385
      _reader_bits::MapStorageBase<Node>* storage = 
1386
	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
1385
      _reader_bits::MapStorageBase<Node>* storage =
1386
        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
1387 1387
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1396,4 +1396,4 @@
1396 1396
      checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
1397
      _reader_bits::MapStorageBase<Edge>* storage = 
1398
	new _reader_bits::MapStorage<Edge, Map>(map);
1397
      _reader_bits::MapStorageBase<Edge>* storage =
1398
        new _reader_bits::MapStorage<Edge, Map>(map);
1399 1399
      _edge_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1407,7 +1407,7 @@
1407 1407
    template <typename Map, typename Converter>
1408
    GraphReader& edgeMap(const std::string& caption, Map& map, 
1409
			  const Converter& converter = Converter()) {
1408
    GraphReader& edgeMap(const std::string& caption, Map& map,
1409
                          const Converter& converter = Converter()) {
1410 1410
      checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
1411
      _reader_bits::MapStorageBase<Edge>* storage = 
1412
	new _reader_bits::MapStorage<Edge, Map, Converter>(map, converter);
1411
      _reader_bits::MapStorageBase<Edge>* storage =
1412
        new _reader_bits::MapStorage<Edge, Map, Converter>(map, converter);
1413 1413
      _edge_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1422,7 +1422,7 @@
1422 1422
      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
1423
      _reader_bits::MapStorageBase<Edge>* forward_storage = 
1424
	new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
1423
      _reader_bits::MapStorageBase<Edge>* forward_storage =
1424
        new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
1425 1425
      _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
1426
      _reader_bits::MapStorageBase<Edge>* backward_storage = 
1427
	new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
1426
      _reader_bits::MapStorageBase<Edge>* backward_storage =
1427
        new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
1428 1428
      _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
... ...
@@ -1436,12 +1436,12 @@
1436 1436
    template <typename Map, typename Converter>
1437
    GraphReader& arcMap(const std::string& caption, Map& map, 
1438
			  const Converter& converter = Converter()) {
1437
    GraphReader& arcMap(const std::string& caption, Map& map,
1438
                          const Converter& converter = Converter()) {
1439 1439
      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
1440
      _reader_bits::MapStorageBase<Edge>* forward_storage = 
1441
	new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
1442
	(_graph, map, converter);
1440
      _reader_bits::MapStorageBase<Edge>* forward_storage =
1441
        new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
1442
        (_graph, map, converter);
1443 1443
      _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
1444
      _reader_bits::MapStorageBase<Edge>* backward_storage = 
1445
	new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
1446
	(_graph, map, converter);
1444
      _reader_bits::MapStorageBase<Edge>* backward_storage =
1445
        new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
1446
        (_graph, map, converter);
1447 1447
      _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
... ...
@@ -1455,4 +1455,4 @@
1455 1455
    GraphReader& attribute(const std::string& caption, Value& value) {
1456
      _reader_bits::ValueStorageBase* storage = 
1457
	new _reader_bits::ValueStorage<Value>(value);
1456
      _reader_bits::ValueStorageBase* storage =
1457
        new _reader_bits::ValueStorage<Value>(value);
1458 1458
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -1466,6 +1466,6 @@
1466 1466
    template <typename Value, typename Converter>
1467
    GraphReader& attribute(const std::string& caption, Value& value, 
1468
			     const Converter& converter = Converter()) {
1469
      _reader_bits::ValueStorageBase* storage = 
1470
	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
1467
    GraphReader& attribute(const std::string& caption, Value& value,
1468
                             const Converter& converter = Converter()) {
1469
      _reader_bits::ValueStorageBase* storage =
1470
        new _reader_bits::ValueStorage<Value, Converter>(value, converter);
1471 1471
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -1480,4 +1480,4 @@
1480 1480
      Converter converter(_node_index);
1481
      _reader_bits::ValueStorageBase* storage = 
1482
	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
1481
      _reader_bits::ValueStorageBase* storage =
1482
        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
1483 1483
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -1492,4 +1492,4 @@
1492 1492
      Converter converter(_edge_index);
1493
      _reader_bits::ValueStorageBase* storage = 
1494
	new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
1493
      _reader_bits::ValueStorageBase* storage =
1494
        new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
1495 1495
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -1504,4 +1504,4 @@
1504 1504
      Converter converter(_graph, _edge_index);
1505
      _reader_bits::ValueStorageBase* storage = 
1506
	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
1505
      _reader_bits::ValueStorageBase* storage =
1506
        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
1507 1507
      _attributes.insert(std::make_pair(caption, storage));
... ...
@@ -1551,3 +1551,3 @@
1551 1551
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1552
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
1552
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
1553 1553
      _use_nodes = true;
... ...
@@ -1555,3 +1555,3 @@
1555 1555
      for (NodeIt n(_graph); n != INVALID; ++n) {
1556
	_node_index.insert(std::make_pair(converter(map[n]), n));
1556
        _node_index.insert(std::make_pair(converter(map[n]), n));
1557 1557
      }
... ...
@@ -1566,9 +1566,9 @@
1566 1566
    template <typename Map, typename Converter>
1567
    GraphReader& useNodes(const Map& map, 
1568
			    const Converter& converter = Converter()) {
1567
    GraphReader& useNodes(const Map& map,
1568
                            const Converter& converter = Converter()) {
1569 1569
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1570
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
1570
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
1571 1571
      _use_nodes = true;
1572 1572
      for (NodeIt n(_graph); n != INVALID; ++n) {
1573
	_node_index.insert(std::make_pair(converter(map[n]), n));
1573
        _node_index.insert(std::make_pair(converter(map[n]), n));
1574 1574
      }
... ...
@@ -1588,3 +1588,3 @@
1588 1588
      for (EdgeIt a(_graph); a != INVALID; ++a) {
1589
	_edge_index.insert(std::make_pair(converter(map[a]), a));
1589
        _edge_index.insert(std::make_pair(converter(map[a]), a));
1590 1590
      }
... ...
@@ -1599,9 +1599,9 @@
1599 1599
    template <typename Map, typename Converter>
1600
    GraphReader& useEdges(const Map& map, 
1601
			    const Converter& converter = Converter()) {
1600
    GraphReader& useEdges(const Map& map,
1601
                            const Converter& converter = Converter()) {
1602 1602
      checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
1603
      LEMON_ASSERT(!_use_edges, "Multiple usage of useEdges() member"); 
1603
      LEMON_ASSERT(!_use_edges, "Multiple usage of useEdges() member");
1604 1604
      _use_edges = true;
1605 1605
      for (EdgeIt a(_graph); a != INVALID; ++a) {
1606
	_edge_index.insert(std::make_pair(converter(map[a]), a));
1606
        _edge_index.insert(std::make_pair(converter(map[a]), a));
1607 1607
      }
... ...
@@ -1620,3 +1620,3 @@
1620 1620
    GraphReader& skipNodes() {
1621
      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set"); 
1621
      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
1622 1622
      _skip_nodes = true;
... ...
@@ -1631,3 +1631,3 @@
1631 1631
    GraphReader& skipEdges() {
1632
      LEMON_ASSERT(!_skip_edges, "Skip edges already set"); 
1632
      LEMON_ASSERT(!_skip_edges, "Skip edges already set");
1633 1633
      _skip_edges = true;
... ...
@@ -1643,8 +1643,8 @@
1643 1643
      while(++line_num, std::getline(*_is, str)) {
1644
	line.clear(); line.str(str);
1645
	char c;
1646
	if (line >> std::ws >> c && c != '#') {
1647
	  line.putback(c);
1648
	  return true;
1649
	}
1644
        line.clear(); line.str(str);
1645
        char c;
1646
        if (line >> std::ws >> c && c != '#') {
1647
          line.putback(c);
1648
          return true;
1649
        }
1650 1650
      }
... ...
@@ -1656,3 +1656,3 @@
1656 1656
    }
1657
    
1657

	
1658 1658
    void skipSection() {
... ...
@@ -1660,3 +1660,3 @@
1660 1660
      while (readSuccess() && line >> c && c != '@') {
1661
	readLine();
1661
        readLine();
1662 1662
      }
... ...
@@ -1672,44 +1672,44 @@
1672 1672
      if (!readLine() || !(line >> c) || c == '@') {
1673
	if (readSuccess() && line) line.putback(c);
1674
	if (!_node_maps.empty()) 
1675
	  throw DataFormatError("Cannot find map names");
1676
	return;
1673
        if (readSuccess() && line) line.putback(c);
1674
        if (!_node_maps.empty())
1675
          throw DataFormatError("Cannot find map names");
1676
        return;
1677 1677
      }
1678 1678
      line.putback(c);
1679
      
1679

	
1680 1680
      {
1681
	std::map<std::string, int> maps;
1682
	
1683
	std::string map;
1684
	int index = 0;
1685
	while (_reader_bits::readToken(line, map)) {
1686
	  if (maps.find(map) != maps.end()) {
1687
	    std::ostringstream msg;
1688
	    msg << "Multiple occurence of node map: " << map;
1689
	    throw DataFormatError(msg.str().c_str());
1690
	  }
1691
	  maps.insert(std::make_pair(map, index));
1692
	  ++index;
1693
	}
1694
	
1695
	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
1696
	  std::map<std::string, int>::iterator jt = 
1697
	    maps.find(_node_maps[i].first);
1698
	  if (jt == maps.end()) {
1699
	    std::ostringstream msg;
1700
	    msg << "Map not found in file: " << _node_maps[i].first;
1701
	    throw DataFormatError(msg.str().c_str());
1702
	  }
1703
	  map_index[i] = jt->second;
1704
	}
1705

	
1706
	{
1707
	  std::map<std::string, int>::iterator jt = maps.find("label");
1708
	  if (jt != maps.end()) {
1709
	    label_index = jt->second;
1710
	  } else {
1711
	    label_index = -1;
1712
	  }
1713
	}
1714
	map_num = maps.size();
1681
        std::map<std::string, int> maps;
1682

	
1683
        std::string map;
1684
        int index = 0;
1685
        while (_reader_bits::readToken(line, map)) {
1686
          if (maps.find(map) != maps.end()) {
1687
            std::ostringstream msg;
1688
            msg << "Multiple occurence of node map: " << map;
1689
            throw DataFormatError(msg.str().c_str());
1690
          }
1691
          maps.insert(std::make_pair(map, index));
1692
          ++index;
1693
        }
1694

	
1695
        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
1696
          std::map<std::string, int>::iterator jt =
1697
            maps.find(_node_maps[i].first);
1698
          if (jt == maps.end()) {
1699
            std::ostringstream msg;
1700
            msg << "Map not found in file: " << _node_maps[i].first;
1701
            throw DataFormatError(msg.str().c_str());
1702
          }
1703
          map_index[i] = jt->second;
1704
        }
1705

	
1706
        {
1707
          std::map<std::string, int>::iterator jt = maps.find("label");
1708
          if (jt != maps.end()) {
1709
            label_index = jt->second;
1710
          } else {
1711
            label_index = -1;
1712
          }
1713
        }
1714
        map_num = maps.size();
1715 1715
      }
... ...
@@ -1717,36 +1717,36 @@
1717 1717
      while (readLine() && line >> c && c != '@') {
1718
	line.putback(c);
1719

	
1720
	std::vector<std::string> tokens(map_num);
1721
	for (int i = 0; i < map_num; ++i) {
1722
	  if (!_reader_bits::readToken(line, tokens[i])) {
1723
	    std::ostringstream msg;
1724
	    msg << "Column not found (" << i + 1 << ")";
1725
	    throw DataFormatError(msg.str().c_str());
1726
	  }
1727
	}
1728
	if (line >> std::ws >> c)
1729
	  throw DataFormatError("Extra character on the end of line");
1730
	
1731
	Node n;
1732
	if (!_use_nodes) {
1733
	  n = _graph.addNode();
1734
	  if (label_index != -1) 
1735
	    _node_index.insert(std::make_pair(tokens[label_index], n));
1736
	} else {
1737
	  if (label_index == -1) 
1738
	    throw DataFormatError("Label map not found in file");
1739
	  typename std::map<std::string, Node>::iterator it =
1740
	    _node_index.find(tokens[label_index]);
1741
	  if (it == _node_index.end()) {
1742
	    std::ostringstream msg;
1743
	    msg << "Node with label not found: " << tokens[label_index];
1744
	    throw DataFormatError(msg.str().c_str());	    
1745
	  }
1746
	  n = it->second;
1747
	}
1748

	
1749
	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
1750
	  _node_maps[i].second->set(n, tokens[map_index[i]]);
1751
	}
1718
        line.putback(c);
1719

	
1720
        std::vector<std::string> tokens(map_num);
1721
        for (int i = 0; i < map_num; ++i) {
1722
          if (!_reader_bits::readToken(line, tokens[i])) {
1723
            std::ostringstream msg;
1724
            msg << "Column not found (" << i + 1 << ")";
1725
            throw DataFormatError(msg.str().c_str());
1726
          }
1727
        }
1728
        if (line >> std::ws >> c)
1729
          throw DataFormatError("Extra character on the end of line");
1730

	
1731
        Node n;
1732
        if (!_use_nodes) {
1733
          n = _graph.addNode();
1734
          if (label_index != -1)
1735
            _node_index.insert(std::make_pair(tokens[label_index], n));
1736
        } else {
1737
          if (label_index == -1)
1738
            throw DataFormatError("Label map not found in file");
1739
          typename std::map<std::string, Node>::iterator it =
1740
            _node_index.find(tokens[label_index]);
1741
          if (it == _node_index.end()) {
1742
            std::ostringstream msg;
1743
            msg << "Node with label not found: " << tokens[label_index];
1744
            throw DataFormatError(msg.str().c_str());
1745
          }
1746
          n = it->second;
1747
        }
1748

	
1749
        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
1750
          _node_maps[i].second->set(n, tokens[map_index[i]]);
1751
        }
1752 1752

	
... ...
@@ -1754,3 +1754,3 @@
1754 1754
      if (readSuccess()) {
1755
	line.putback(c);
1755
        line.putback(c);
1756 1756
      }
... ...
@@ -1765,44 +1765,44 @@
1765 1765
      if (!readLine() || !(line >> c) || c == '@') {
1766
	if (readSuccess() && line) line.putback(c);
1767
	if (!_edge_maps.empty()) 
1768
	  throw DataFormatError("Cannot find map names");
1769
	return;
1766
        if (readSuccess() && line) line.putback(c);
1767
        if (!_edge_maps.empty())
1768
          throw DataFormatError("Cannot find map names");
1769
        return;
1770 1770
      }
1771 1771
      line.putback(c);
1772
      
1772

	
1773 1773
      {
1774
	std::map<std::string, int> maps;
1775
	
1776
	std::string map;
1777
	int index = 0;
1778
	while (_reader_bits::readToken(line, map)) {
1779
	  if (maps.find(map) != maps.end()) {
1780
	    std::ostringstream msg;
1781
	    msg << "Multiple occurence of edge map: " << map;
1782
	    throw DataFormatError(msg.str().c_str());
1783
	  }
1784
	  maps.insert(std::make_pair(map, index));
1785
	  ++index;
1786
	}
1787
	
1788
	for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
1789
	  std::map<std::string, int>::iterator jt = 
1790
	    maps.find(_edge_maps[i].first);
1791
	  if (jt == maps.end()) {
1792
	    std::ostringstream msg;
1793
	    msg << "Map not found in file: " << _edge_maps[i].first;
1794
	    throw DataFormatError(msg.str().c_str());
1795
	  }
1796
	  map_index[i] = jt->second;
1797
	}
1798

	
1799
	{
1800
	  std::map<std::string, int>::iterator jt = maps.find("label");
1801
	  if (jt != maps.end()) {
1802
	    label_index = jt->second;
1803
	  } else {
1804
	    label_index = -1;
1805
	  }
1806
	}
1807
	map_num = maps.size();
1774
        std::map<std::string, int> maps;
1775

	
1776
        std::string map;
1777
        int index = 0;
1778
        while (_reader_bits::readToken(line, map)) {
1779
          if (maps.find(map) != maps.end()) {
1780
            std::ostringstream msg;
1781
            msg << "Multiple occurence of edge map: " << map;
1782
            throw DataFormatError(msg.str().c_str());
1783
          }
1784
          maps.insert(std::make_pair(map, index));
1785
          ++index;
1786
        }
1787

	
1788
        for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
1789
          std::map<std::string, int>::iterator jt =
1790
            maps.find(_edge_maps[i].first);
1791
          if (jt == maps.end()) {
1792
            std::ostringstream msg;
1793
            msg << "Map not found in file: " << _edge_maps[i].first;
1794
            throw DataFormatError(msg.str().c_str());
1795
          }
1796
          map_index[i] = jt->second;
1797
        }
1798

	
1799
        {
1800
          std::map<std::string, int>::iterator jt = maps.find("label");
1801
          if (jt != maps.end()) {
1802
            label_index = jt->second;
1803
          } else {
1804
            label_index = -1;
1805
          }
1806
        }
1807
        map_num = maps.size();
1808 1808
      }
... ...
@@ -1810,29 +1810,29 @@
1810 1810
      while (readLine() && line >> c && c != '@') {
1811
	line.putback(c);
1812

	
1813
	std::string source_token;
1814
	std::string target_token;
1815

	
1816
	if (!_reader_bits::readToken(line, source_token))
1817
	  throw DataFormatError("Node u not found");
1818

	
1819
	if (!_reader_bits::readToken(line, target_token))
1820
	  throw DataFormatError("Node v not found");
1821
	
1822
	std::vector<std::string> tokens(map_num);
1823
	for (int i = 0; i < map_num; ++i) {
1824
	  if (!_reader_bits::readToken(line, tokens[i])) {
1825
	    std::ostringstream msg;
1826
	    msg << "Column not found (" << i + 1 << ")";
1827
	    throw DataFormatError(msg.str().c_str());
1828
	  }
1829
	}
1830
	if (line >> std::ws >> c)
1831
	  throw DataFormatError("Extra character on the end of line");
1832
	
1833
	Edge e;
1834
	if (!_use_edges) {
1811
        line.putback(c);
1812

	
1813
        std::string source_token;
1814
        std::string target_token;
1815

	
1816
        if (!_reader_bits::readToken(line, source_token))
1817
          throw DataFormatError("Node u not found");
1818

	
1819
        if (!_reader_bits::readToken(line, target_token))
1820
          throw DataFormatError("Node v not found");
1821

	
1822
        std::vector<std::string> tokens(map_num);
1823
        for (int i = 0; i < map_num; ++i) {
1824
          if (!_reader_bits::readToken(line, tokens[i])) {
1825
            std::ostringstream msg;
1826
            msg << "Column not found (" << i + 1 << ")";
1827
            throw DataFormatError(msg.str().c_str());
1828
          }
1829
        }
1830
        if (line >> std::ws >> c)
1831
          throw DataFormatError("Extra character on the end of line");
1832

	
1833
        Edge e;
1834
        if (!_use_edges) {
1835 1835

	
1836 1836
          typename NodeIndex::iterator it;
1837
 
1837

	
1838 1838
          it = _node_index.find(source_token);
... ...
@@ -1846,28 +1846,28 @@
1846 1846
          it = _node_index.find(target_token);
1847
          if (it == _node_index.end()) {       
1848
            std::ostringstream msg;            
1847
          if (it == _node_index.end()) {
1848
            std::ostringstream msg;
1849 1849
            msg << "Item not found: " << target_token;
1850 1850
            throw DataFormatError(msg.str().c_str());
1851
          }                                          
1852
          Node target = it->second;                            
1853

	
1854
	  e = _graph.addEdge(source, target);
1855
	  if (label_index != -1) 
1856
	    _edge_index.insert(std::make_pair(tokens[label_index], e));
1857
	} else {
1858
	  if (label_index == -1) 
1859
	    throw DataFormatError("Label map not found in file");
1860
	  typename std::map<std::string, Edge>::iterator it =
1861
	    _edge_index.find(tokens[label_index]);
1862
	  if (it == _edge_index.end()) {
1863
	    std::ostringstream msg;
1864
	    msg << "Edge with label not found: " << tokens[label_index];
1865
	    throw DataFormatError(msg.str().c_str());	    
1866
	  }
1867
	  e = it->second;
1868
	}
1869

	
1870
	for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
1871
	  _edge_maps[i].second->set(e, tokens[map_index[i]]);
1872
	}
1851
          }
1852
          Node target = it->second;
1853

	
1854
          e = _graph.addEdge(source, target);
1855
          if (label_index != -1)
1856
            _edge_index.insert(std::make_pair(tokens[label_index], e));
1857
        } else {
1858
          if (label_index == -1)
1859
            throw DataFormatError("Label map not found in file");
1860
          typename std::map<std::string, Edge>::iterator it =
1861
            _edge_index.find(tokens[label_index]);
1862
          if (it == _edge_index.end()) {
1863
            std::ostringstream msg;
1864
            msg << "Edge with label not found: " << tokens[label_index];
1865
            throw DataFormatError(msg.str().c_str());
1866
          }
1867
          e = it->second;
1868
        }
1869

	
1870
        for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
1871
          _edge_maps[i].second->set(e, tokens[map_index[i]]);
1872
        }
1873 1873

	
... ...
@@ -1875,3 +1875,3 @@
1875 1875
      if (readSuccess()) {
1876
	line.putback(c);
1876
        line.putback(c);
1877 1877
      }
... ...
@@ -1885,29 +1885,29 @@
1885 1885
      while (readLine() && line >> c && c != '@') {
1886
	line.putback(c);
1887
	
1888
	std::string attr, token;
1889
	if (!_reader_bits::readToken(line, attr))
1890
	  throw DataFormatError("Attribute name not found");
1891
	if (!_reader_bits::readToken(line, token))
1892
	  throw DataFormatError("Attribute value not found");
1893
	if (line >> c)
1894
	  throw DataFormatError("Extra character on the end of line");	  
1895

	
1896
	{
1897
	  std::set<std::string>::iterator it = read_attr.find(attr);
1898
	  if (it != read_attr.end()) {
1899
	    std::ostringstream msg;
1900
	    msg << "Multiple occurence of attribute " << attr;
1901
	    throw DataFormatError(msg.str().c_str());
1902
	  }
1903
	  read_attr.insert(attr);
1904
	}
1905
	
1906
	{
1907
	  typename Attributes::iterator it = _attributes.lower_bound(attr);
1908
	  while (it != _attributes.end() && it->first == attr) {
1909
	    it->second->set(token);
1910
	    ++it;
1911
	  }
1912
	}
1886
        line.putback(c);
1887

	
1888
        std::string attr, token;
1889
        if (!_reader_bits::readToken(line, attr))
1890
          throw DataFormatError("Attribute name not found");
1891
        if (!_reader_bits::readToken(line, token))
1892
          throw DataFormatError("Attribute value not found");
1893
        if (line >> c)
1894
          throw DataFormatError("Extra character on the end of line");
1895

	
1896
        {
1897
          std::set<std::string>::iterator it = read_attr.find(attr);
1898
          if (it != read_attr.end()) {
1899
            std::ostringstream msg;
1900
            msg << "Multiple occurence of attribute " << attr;
1901
            throw DataFormatError(msg.str().c_str());
1902
          }
1903
          read_attr.insert(attr);
1904
        }
1905

	
1906
        {
1907
          typename Attributes::iterator it = _attributes.lower_bound(attr);
1908
          while (it != _attributes.end() && it->first == attr) {
1909
            it->second->set(token);
1910
            ++it;
1911
          }
1912
        }
1913 1913

	
... ...
@@ -1915,11 +1915,11 @@
1915 1915
      if (readSuccess()) {
1916
	line.putback(c);
1916
        line.putback(c);
1917 1917
      }
1918 1918
      for (typename Attributes::iterator it = _attributes.begin();
1919
	   it != _attributes.end(); ++it) {
1920
	if (read_attr.find(it->first) == read_attr.end()) {
1921
	  std::ostringstream msg;
1922
	  msg << "Attribute not found in file: " << it->first;
1923
	  throw DataFormatError(msg.str().c_str());
1924
	}	
1919
           it != _attributes.end(); ++it) {
1920
        if (read_attr.find(it->first) == read_attr.end()) {
1921
          std::ostringstream msg;
1922
          msg << "Attribute not found in file: " << it->first;
1923
          throw DataFormatError(msg.str().c_str());
1924
        }
1925 1925
      }
... ...
@@ -1929,3 +1929,3 @@
1929 1929

	
1930
    /// \name Execution of the reader    
1930
    /// \name Execution of the reader
1931 1931
    /// @{
... ...
@@ -1936,5 +1936,5 @@
1936 1936
    void run() {
1937
      
1937

	
1938 1938
      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
1939
      
1939

	
1940 1940
      bool nodes_done = _skip_nodes;
... ...
@@ -1943,3 +1943,3 @@
1943 1943

	
1944
      line_num = 0;      
1944
      line_num = 0;
1945 1945
      readLine();
... ...
@@ -1948,36 +1948,36 @@
1948 1948
      while (readSuccess()) {
1949
	try {
1950
	  char c;
1951
	  std::string section, caption;
1952
	  line >> c;
1953
	  _reader_bits::readToken(line, section);
1954
	  _reader_bits::readToken(line, caption);
1955

	
1956
	  if (line >> c) 
1957
	    throw DataFormatError("Extra character on the end of line");
1958

	
1959
	  if (section == "nodes" && !nodes_done) {
1960
	    if (_nodes_caption.empty() || _nodes_caption == caption) {
1961
	      readNodes();
1962
	      nodes_done = true;
1963
	    }
1964
	  } else if ((section == "edges" || section == "arcs") && 
1965
		     !edges_done) {
1966
	    if (_edges_caption.empty() || _edges_caption == caption) {
1967
	      readEdges();
1968
	      edges_done = true;
1969
	    }
1970
	  } else if (section == "attributes" && !attributes_done) {
1971
	    if (_attributes_caption.empty() || _attributes_caption == caption) {
1972
	      readAttributes();
1973
	      attributes_done = true;
1974
	    }
1975
	  } else {
1976
	    readLine();
1977
	    skipSection();
1978
	  }
1979
	} catch (DataFormatError& error) {
1980
	  error.line(line_num);
1981
	  throw;
1982
	}	
1949
        try {
1950
          char c;
1951
          std::string section, caption;
1952
          line >> c;
1953
          _reader_bits::readToken(line, section);
1954
          _reader_bits::readToken(line, caption);
1955

	
1956
          if (line >> c)
1957
            throw DataFormatError("Extra character on the end of line");
1958

	
1959
          if (section == "nodes" && !nodes_done) {
1960
            if (_nodes_caption.empty() || _nodes_caption == caption) {
1961
              readNodes();
1962
              nodes_done = true;
1963
            }
1964
          } else if ((section == "edges" || section == "arcs") &&
1965
                     !edges_done) {
1966
            if (_edges_caption.empty() || _edges_caption == caption) {
1967
              readEdges();
1968
              edges_done = true;
1969
            }
1970
          } else if (section == "attributes" && !attributes_done) {
1971
            if (_attributes_caption.empty() || _attributes_caption == caption) {
1972
              readAttributes();
1973
              attributes_done = true;
1974
            }
1975
          } else {
1976
            readLine();
1977
            skipSection();
1978
          }
1979
        } catch (DataFormatError& error) {
1980
          error.line(line_num);
1981
          throw;
1982
        }
1983 1983
      }
... ...
@@ -1985,3 +1985,3 @@
1985 1985
      if (!nodes_done) {
1986
	throw DataFormatError("Section @nodes not found");
1986
        throw DataFormatError("Section @nodes not found");
1987 1987
      }
... ...
@@ -1989,3 +1989,3 @@
1989 1989
      if (!edges_done) {
1990
	throw DataFormatError("Section @edges not found");
1990
        throw DataFormatError("Section @edges not found");
1991 1991
      }
... ...
@@ -1993,3 +1993,3 @@
1993 1993
      if (!attributes_done && !_attributes.empty()) {
1994
	throw DataFormatError("Section @attributes not found");
1994
        throw DataFormatError("Section @attributes not found");
1995 1995
      }
... ...
@@ -1999,3 +1999,3 @@
1999 1999
    /// @}
2000
    
2000

	
2001 2001
  };
... ...
@@ -2003,3 +2003,3 @@
2003 2003
  /// \brief Return a \ref GraphReader class
2004
  /// 
2004
  ///
2005 2005
  /// This function just returns a \ref GraphReader class.
... ...
@@ -2013,3 +2013,3 @@
2013 2013
  /// \brief Return a \ref GraphReader class
2014
  /// 
2014
  ///
2015 2015
  /// This function just returns a \ref GraphReader class.
... ...
@@ -2017,4 +2017,4 @@
2017 2017
  template <typename Graph>
2018
  GraphReader<Graph> graphReader(const std::string& fn, 
2019
				       Graph& graph) {
2018
  GraphReader<Graph> graphReader(const std::string& fn,
2019
                                       Graph& graph) {
2020 2020
    GraphReader<Graph> tmp(fn, graph);
... ...
@@ -2024,3 +2024,3 @@
2024 2024
  /// \brief Return a \ref GraphReader class
2025
  /// 
2025
  ///
2026 2026
  /// This function just returns a \ref GraphReader class.
... ...
@@ -2038,3 +2038,3 @@
2038 2038
  SectionReader sectionReader(const char* fn);
2039
  
2039

	
2040 2040
  /// \ingroup lemon_io
... ...
@@ -2043,5 +2043,5 @@
2043 2043
  ///
2044
  /// In the \ref lgf-format "LGF" file extra sections can be placed, 
2044
  /// In the \ref lgf-format "LGF" file extra sections can be placed,
2045 2045
  /// which contain any data in arbitrary format. Such sections can be
2046
  /// read with this class. A reading rule can be added to the class 
2046
  /// read with this class. A reading rule can be added to the class
2047 2047
  /// with two different functions. With the \c sectionLines() function a
... ...
@@ -2052,3 +2052,3 @@
2052 2052
  private:
2053
    
2053

	
2054 2054
    std::istream* _is;
... ...
@@ -2068,3 +2068,3 @@
2068 2068
    /// stream.
2069
    SectionReader(std::istream& is) 
2069
    SectionReader(std::istream& is)
2070 2070
      : _is(&is), local_is(false) {}
... ...
@@ -2074,5 +2074,5 @@
2074 2074
    /// Construct a section reader, which reads from the given file.
2075
    SectionReader(const std::string& fn) 
2075
    SectionReader(const std::string& fn)
2076 2076
      : _is(new std::ifstream(fn.c_str())), local_is(true) {}
2077
    
2077

	
2078 2078
    /// \brief Constructor
... ...
@@ -2080,3 +2080,3 @@
2080 2080
    /// Construct a section reader, which reads from the given file.
2081
    SectionReader(const char* fn) 
2081
    SectionReader(const char* fn)
2082 2082
      : _is(new std::ifstream(fn)), local_is(true) {}
... ...
@@ -2085,5 +2085,5 @@
2085 2085
    ~SectionReader() {
2086
      for (Sections::iterator it = _sections.begin(); 
2087
	   it != _sections.end(); ++it) {
2088
	delete it->second;
2086
      for (Sections::iterator it = _sections.begin();
2087
           it != _sections.end(); ++it) {
2088
        delete it->second;
2089 2089
      }
... ...
@@ -2091,3 +2091,3 @@
2091 2091
      if (local_is) {
2092
	delete _is;
2092
        delete _is;
2093 2093
      }
... ...
@@ -2102,3 +2102,3 @@
2102 2102

	
2103
    SectionReader(SectionReader& other) 
2103
    SectionReader(SectionReader& other)
2104 2104
      : _is(other._is), local_is(other.local_is) {
... ...
@@ -2107,6 +2107,6 @@
2107 2107
      other.local_is = false;
2108
      
2108

	
2109 2109
      _sections.swap(other._sections);
2110 2110
    }
2111
    
2111

	
2112 2112
    SectionReader& operator=(const SectionReader&);
... ...
@@ -2150,3 +2150,3 @@
2150 2150
    ///
2151
    ///  reader.sectionLines("numbers", NumberSection(vec));  
2151
    ///  reader.sectionLines("numbers", NumberSection(vec));
2152 2152
    ///\endcode
... ...
@@ -2155,5 +2155,5 @@
2155 2155
      LEMON_ASSERT(!type.empty(), "Type is empty.");
2156
      LEMON_ASSERT(_sections.find(type) == _sections.end(), 
2157
		   "Multiple reading of section.");
2158
      _sections.insert(std::make_pair(type, 
2156
      LEMON_ASSERT(_sections.find(type) == _sections.end(),
2157
                   "Multiple reading of section.");
2158
      _sections.insert(std::make_pair(type,
2159 2159
        new _reader_bits::LineSection<Functor>(functor)));
... ...
@@ -2173,9 +2173,9 @@
2173 2173
      LEMON_ASSERT(!type.empty(), "Type is empty.");
2174
      LEMON_ASSERT(_sections.find(type) == _sections.end(), 
2175
		   "Multiple reading of section.");
2176
      _sections.insert(std::make_pair(type, 
2177
	 new _reader_bits::StreamSection<Functor>(functor)));
2174
      LEMON_ASSERT(_sections.find(type) == _sections.end(),
2175
                   "Multiple reading of section.");
2176
      _sections.insert(std::make_pair(type,
2177
         new _reader_bits::StreamSection<Functor>(functor)));
2178 2178
      return *this;
2179
    }    
2180
    
2179
    }
2180

	
2181 2181
    /// @}
... ...
@@ -2187,8 +2187,8 @@
2187 2187
      while(++line_num, std::getline(*_is, str)) {
2188
	line.clear(); line.str(str);
2189
	char c;
2190
	if (line >> std::ws >> c && c != '#') {
2191
	  line.putback(c);
2192
	  return true;
2193
	}
2188
        line.clear(); line.str(str);
2189
        char c;
2190
        if (line >> std::ws >> c && c != '#') {
2191
          line.putback(c);
2192
          return true;
2193
        }
2194 2194
      }
... ...
@@ -2200,3 +2200,3 @@
2200 2200
    }
2201
    
2201

	
2202 2202
    void skipSection() {
... ...
@@ -2204,3 +2204,3 @@
2204 2204
      while (readSuccess() && line >> c && c != '@') {
2205
	readLine();
2205
        readLine();
2206 2206
      }
... ...
@@ -2212,3 +2212,3 @@
2212 2212

	
2213
    /// \name Execution of the reader    
2213
    /// \name Execution of the reader
2214 2214
    /// @{
... ...
@@ -2219,8 +2219,8 @@
2219 2219
    void run() {
2220
      
2220

	
2221 2221
      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
2222
      
2222

	
2223 2223
      std::set<std::string> extra_sections;
2224 2224

	
2225
      line_num = 0;      
2225
      line_num = 0;
2226 2226
      readLine();
... ...
@@ -2229,36 +2229,36 @@
2229 2229
      while (readSuccess()) {
2230
	try {
2231
	  char c;
2232
	  std::string section, caption;
2233
	  line >> c;
2234
	  _reader_bits::readToken(line, section);
2235
	  _reader_bits::readToken(line, caption);
2236

	
2237
	  if (line >> c) 
2238
	    throw DataFormatError("Extra character on the end of line");
2239

	
2240
	  if (extra_sections.find(section) != extra_sections.end()) {
2241
	    std::ostringstream msg;
2242
	    msg << "Multiple occurence of section " << section;
2243
	    throw DataFormatError(msg.str().c_str());
2244
	  }
2245
	  Sections::iterator it = _sections.find(section);
2246
	  if (it != _sections.end()) {
2247
	    extra_sections.insert(section);
2248
	    it->second->process(*_is, line_num);
2249
	  }
2250
	  readLine();
2251
	  skipSection();
2252
	} catch (DataFormatError& error) {
2253
	  error.line(line_num);
2254
	  throw;
2255
	}	
2230
        try {
2231
          char c;
2232
          std::string section, caption;
2233
          line >> c;
2234
          _reader_bits::readToken(line, section);
2235
          _reader_bits::readToken(line, caption);
2236

	
2237
          if (line >> c)
2238
            throw DataFormatError("Extra character on the end of line");
2239

	
2240
          if (extra_sections.find(section) != extra_sections.end()) {
2241
            std::ostringstream msg;
2242
            msg << "Multiple occurence of section " << section;
2243
            throw DataFormatError(msg.str().c_str());
2244
          }
2245
          Sections::iterator it = _sections.find(section);
2246
          if (it != _sections.end()) {
2247
            extra_sections.insert(section);
2248
            it->second->process(*_is, line_num);
2249
          }
2250
          readLine();
2251
          skipSection();
2252
        } catch (DataFormatError& error) {
2253
          error.line(line_num);
2254
          throw;
2255
        }
2256 2256
      }
2257 2257
      for (Sections::iterator it = _sections.begin();
2258
	   it != _sections.end(); ++it) {
2259
	if (extra_sections.find(it->first) == extra_sections.end()) {
2260
	  std::ostringstream os;
2261
	  os << "Cannot find section: " << it->first;
2262
	  throw DataFormatError(os.str().c_str());
2263
	}
2258
           it != _sections.end(); ++it) {
2259
        if (extra_sections.find(it->first) == extra_sections.end()) {
2260
          std::ostringstream os;
2261
          os << "Cannot find section: " << it->first;
2262
          throw DataFormatError(os.str().c_str());
2263
        }
2264 2264
      }
... ...
@@ -2267,3 +2267,3 @@
2267 2267
    /// @}
2268
        
2268

	
2269 2269
  };
... ...
@@ -2271,3 +2271,3 @@
2271 2271
  /// \brief Return a \ref SectionReader class
2272
  /// 
2272
  ///
2273 2273
  /// This function just returns a \ref SectionReader class.
... ...
@@ -2280,3 +2280,3 @@
2280 2280
  /// \brief Return a \ref SectionReader class
2281
  /// 
2281
  ///
2282 2282
  /// This function just returns a \ref SectionReader class.
... ...
@@ -2289,3 +2289,3 @@
2289 2289
  /// \brief Return a \ref SectionReader class
2290
  /// 
2290
  ///
2291 2291
  /// This function just returns a \ref SectionReader class.
... ...
@@ -2299,3 +2299,3 @@
2299 2299
  ///
2300
  /// \brief Reader for the contents of the \ref lgf-format "LGF" file 
2300
  /// \brief Reader for the contents of the \ref lgf-format "LGF" file
2301 2301
  ///
... ...
@@ -2309,4 +2309,4 @@
2309 2309
  ///
2310
  ///\code 
2311
  /// LgfContents contents("graph.lgf"); 
2310
  ///\code
2311
  /// LgfContents contents("graph.lgf");
2312 2312
  /// contents.run();
... ...
@@ -2318,10 +2318,10 @@
2318 2318
  /// }
2319
  /// std::cout << "The name of the default node section: " 
2319
  /// std::cout << "The name of the default node section: "
2320 2320
  ///           << contents.nodeSection(0) << std::endl;
2321
  /// std::cout << "The number of the arc maps: " 
2321
  /// std::cout << "The number of the arc maps: "
2322 2322
  ///           << contents.arcMaps(0).size() << std::endl;
2323
  /// std::cout << "The name of second arc map: " 
2323
  /// std::cout << "The name of second arc map: "
2324 2324
  ///           << contents.arcMaps(0)[1] << std::endl;
2325 2325
  ///\endcode
2326
  class LgfContents {    
2326
  class LgfContents {
2327 2327
  private:
... ...
@@ -2346,3 +2346,3 @@
2346 2346
    std::istringstream line;
2347
    
2347

	
2348 2348
  public:
... ...
@@ -2353,3 +2353,3 @@
2353 2353
    /// input stream.
2354
    LgfContents(std::istream& is) 
2354
    LgfContents(std::istream& is)
2355 2355
      : _is(&is), local_is(false) {}
... ...
@@ -2360,3 +2360,3 @@
2360 2360
    /// file.
2361
    LgfContents(const std::string& fn) 
2361
    LgfContents(const std::string& fn)
2362 2362
      : _is(new std::ifstream(fn.c_str())), local_is(true) {}
... ...
@@ -2369,3 +2369,3 @@
2369 2369
      : _is(new std::ifstream(fn)), local_is(true) {}
2370
    
2370

	
2371 2371
    /// \brief Destructor
... ...
@@ -2376,3 +2376,3 @@
2376 2376
  private:
2377
    
2377

	
2378 2378
    LgfContents(const LgfContents&);
... ...
@@ -2393,5 +2393,5 @@
2393 2393

	
2394
    /// \brief Returns the node section name at the given position. 
2394
    /// \brief Returns the node section name at the given position.
2395 2395
    ///
2396
    /// Returns the node section name at the given position. 
2396
    /// Returns the node section name at the given position.
2397 2397
    const std::string& nodeSection(int i) const {
... ...
@@ -2409,3 +2409,3 @@
2409 2409

	
2410
    /// \name Arc/Edge sections 
2410
    /// \name Arc/Edge sections
2411 2411
    /// @{
... ...
@@ -2420,5 +2420,5 @@
2420 2420

	
2421
    /// \brief Returns the arc/edge section name at the given position. 
2421
    /// \brief Returns the arc/edge section name at the given position.
2422 2422
    ///
2423
    /// Returns the arc/edge section name at the given position. 
2423
    /// Returns the arc/edge section name at the given position.
2424 2424
    /// \note It is synonym of \c edgeSection().
... ...
@@ -2449,5 +2449,5 @@
2449 2449

	
2450
    /// \brief Returns the section name at the given position. 
2450
    /// \brief Returns the section name at the given position.
2451 2451
    ///
2452
    /// Returns the section name at the given position. 
2452
    /// Returns the section name at the given position.
2453 2453
    /// \note It is synonym of \c arcSection().
... ...
@@ -2467,3 +2467,3 @@
2467 2467

	
2468
    /// \name Attribute sections   
2468
    /// \name Attribute sections
2469 2469
    /// @{
... ...
@@ -2477,5 +2477,5 @@
2477 2477

	
2478
    /// \brief Returns the attribute section name at the given position. 
2478
    /// \brief Returns the attribute section name at the given position.
2479 2479
    ///
2480
    /// Returns the attribute section name at the given position. 
2480
    /// Returns the attribute section name at the given position.
2481 2481
    const std::string& attributeSectionNames(int i) const {
... ...
@@ -2493,3 +2493,3 @@
2493 2493

	
2494
    /// \name Extra sections   
2494
    /// \name Extra sections
2495 2495
    /// @{
... ...
@@ -2503,5 +2503,5 @@
2503 2503

	
2504
    /// \brief Returns the extra section type at the given position. 
2504
    /// \brief Returns the extra section type at the given position.
2505 2505
    ///
2506
    /// Returns the section type at the given position. 
2506
    /// Returns the section type at the given position.
2507 2507
    const std::string& extraSection(int i) const {
... ...
@@ -2517,8 +2517,8 @@
2517 2517
      while(++line_num, std::getline(*_is, str)) {
2518
	line.clear(); line.str(str);
2519
	char c;
2520
	if (line >> std::ws >> c && c != '#') {
2521
	  line.putback(c);
2522
	  return true;
2523
	}
2518
        line.clear(); line.str(str);
2519
        char c;
2520
        if (line >> std::ws >> c && c != '#') {
2521
          line.putback(c);
2522
          return true;
2523
        }
2524 2524
      }
... ...
@@ -2534,3 +2534,3 @@
2534 2534
      while (readSuccess() && line >> c && c != '@') {
2535
	readLine();
2535
        readLine();
2536 2536
      }
... ...
@@ -2542,4 +2542,4 @@
2542 2542
      if (!readLine() || !(line >> c) || c == '@') {
2543
	if (readSuccess() && line) line.putback(c);
2544
	return;
2543
        if (readSuccess() && line) line.putback(c);
2544
        return;
2545 2545
      }
... ...
@@ -2548,3 +2548,3 @@
2548 2548
      while (_reader_bits::readToken(line, map)) {
2549
	maps.push_back(map);
2549
        maps.push_back(map);
2550 2550
      }
... ...
@@ -2556,7 +2556,7 @@
2556 2556
      while (readSuccess() && line >> c && c != '@') {
2557
	line.putback(c);
2558
	std::string attr;
2559
	_reader_bits::readToken(line, attr);
2560
	attrs.push_back(attr);
2561
	readLine();
2557
        line.putback(c);
2558
        std::string attr;
2559
        _reader_bits::readToken(line, attr);
2560
        attrs.push_back(attr);
2561
        readLine();
2562 2562
      }
... ...
@@ -2567,3 +2567,3 @@
2567 2567

	
2568
    /// \name Execution of the contents reader    
2568
    /// \name Execution of the contents reader
2569 2569
    /// @{
... ...
@@ -2580,28 +2580,28 @@
2580 2580

	
2581
	char c;
2582
	line >> c;
2583

	
2584
	std::string section, caption;
2585
	_reader_bits::readToken(line, section);
2586
	_reader_bits::readToken(line, caption);
2587

	
2588
	if (section == "nodes") {
2589
	  _node_sections.push_back(caption);
2590
	  _node_maps.push_back(std::vector<std::string>());
2591
	  readMaps(_node_maps.back());
2592
	  readLine(); skipSection();
2593
	} else if (section == "arcs" || section == "edges") {
2594
	  _edge_sections.push_back(caption);
2595
	  _arc_sections.push_back(section == "arcs");
2596
	  _edge_maps.push_back(std::vector<std::string>());
2597
	  readMaps(_edge_maps.back());
2598
	  readLine(); skipSection();
2599
	} else if (section == "attributes") {
2600
	  _attribute_sections.push_back(caption);
2601
	  _attributes.push_back(std::vector<std::string>());
2602
	  readAttributes(_attributes.back());
2603
	} else {
2604
	  _extra_sections.push_back(section);
2605
	  readLine(); skipSection();
2606
	}
2581
        char c;
2582
        line >> c;
2583

	
2584
        std::string section, caption;
2585
        _reader_bits::readToken(line, section);
2586
        _reader_bits::readToken(line, caption);
2587

	
2588
        if (section == "nodes") {
2589
          _node_sections.push_back(caption);
2590
          _node_maps.push_back(std::vector<std::string>());
2591
          readMaps(_node_maps.back());
2592
          readLine(); skipSection();
2593
        } else if (section == "arcs" || section == "edges") {
2594
          _edge_sections.push_back(caption);
2595
          _arc_sections.push_back(section == "arcs");
2596
          _edge_maps.push_back(std::vector<std::string>());
2597
          readMaps(_edge_maps.back());
2598
          readLine(); skipSection();
2599
        } else if (section == "attributes") {
2600
          _attribute_sections.push_back(caption);
2601
          _attributes.push_back(std::vector<std::string>());
2602
          readAttributes(_attributes.back());
2603
        } else {
2604
          _extra_sections.push_back(section);
2605
          readLine(); skipSection();
2606
        }
2607 2607
      }
... ...
@@ -2610,3 +2610,3 @@
2610 2610
    /// @}
2611
    
2611

	
2612 2612
  };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -45,5 +45,5 @@
45 45
      std::string operator()(const Value& value) {
46
	std::ostringstream os;
47
	os << value;
48
	return os.str();
46
        std::ostringstream os;
47
        os << value;
48
        return os.str();
49 49
      }
... ...
@@ -64,3 +64,3 @@
64 64
      const Map& _map;
65
      
65

	
66 66
    public:
... ...
@@ -69,3 +69,3 @@
69 69
      bool operator()(const Item& left, const Item& right) {
70
	return _map[left] < _map[right];
70
        return _map[left] < _map[right];
71 71
      }
... ...
@@ -83,10 +83,10 @@
83 83
      const Map& _map;
84
      
84

	
85 85
    public:
86
      GraphArcMapLess(const Graph& graph, const Map& map) 
87
	: _graph(graph), _map(map) {}
86
      GraphArcMapLess(const Graph& graph, const Map& map)
87
        : _graph(graph), _map(map) {}
88 88

	
89 89
      bool operator()(const Item& left, const Item& right) {
90
	return _map[_graph.direct(left, _dir)] < 
91
	  _map[_graph.direct(right, _dir)];
90
        return _map[_graph.direct(left, _dir)] <
91
          _map[_graph.direct(right, _dir)];
92 92
      }
... ...
@@ -94,3 +94,3 @@
94 94

	
95
    template <typename _Item>    
95
    template <typename _Item>
96 96
    class MapStorageBase {
... ...
@@ -107,4 +107,4 @@
107 107

	
108
    template <typename _Item, typename _Map, 
109
	      typename _Converter = DefaultConverter<typename _Map::Value> >
108
    template <typename _Item, typename _Map,
109
              typename _Converter = DefaultConverter<typename _Map::Value> >
110 110
    class MapStorage : public MapStorageBase<_Item> {
... ...
@@ -114,3 +114,3 @@
114 114
      typedef _Item Item;
115
      
115

	
116 116
    private:
... ...
@@ -120,4 +120,4 @@
120 120
    public:
121
      MapStorage(const Map& map, const Converter& converter = Converter()) 
122
	: _map(map), _converter(converter) {}
121
      MapStorage(const Map& map, const Converter& converter = Converter())
122
        : _map(map), _converter(converter) {}
123 123
      virtual ~MapStorage() {}
... ...
@@ -125,7 +125,7 @@
125 125
      virtual std::string get(const Item& item) {
126
	return _converter(_map[item]);
126
        return _converter(_map[item]);
127 127
      }
128 128
      virtual void sort(std::vector<Item>& items) {
129
	MapLess<Map> less(_map);
130
	std::sort(items.begin(), items.end(), less);
129
        MapLess<Map> less(_map);
130
        std::sort(items.begin(), items.end(), less);
131 131
      }
... ...
@@ -133,4 +133,4 @@
133 133

	
134
    template <typename _Graph, bool _dir, typename _Map, 
135
	      typename _Converter = DefaultConverter<typename _Map::Value> >
134
    template <typename _Graph, bool _dir, typename _Map,
135
              typename _Converter = DefaultConverter<typename _Map::Value> >
136 136
    class GraphArcMapStorage : public MapStorageBase<typename _Graph::Edge> {
... ...
@@ -142,3 +142,3 @@
142 142
      static const bool dir = _dir;
143
      
143

	
144 144
    private:
... ...
@@ -149,5 +149,5 @@
149 149
    public:
150
      GraphArcMapStorage(const Graph& graph, const Map& map,  
151
			 const Converter& converter = Converter()) 
152
	: _graph(graph), _map(map), _converter(converter) {}
150
      GraphArcMapStorage(const Graph& graph, const Map& map,
151
                         const Converter& converter = Converter())
152
        : _graph(graph), _map(map), _converter(converter) {}
153 153
      virtual ~GraphArcMapStorage() {}
... ...
@@ -155,7 +155,7 @@
155 155
      virtual std::string get(const Item& item) {
156
	return _converter(_map[_graph.direct(item, dir)]);
156
        return _converter(_map[_graph.direct(item, dir)]);
157 157
      }
158 158
      virtual void sort(std::vector<Item>& items) {
159
	GraphArcMapLess<Graph, dir, Map> less(_graph, _map);
160
	std::sort(items.begin(), items.end(), less);
159
        GraphArcMapLess<Graph, dir, Map> less(_graph, _map);
160
        std::sort(items.begin(), items.end(), less);
161 161
      }
... ...
@@ -168,3 +168,3 @@
168 168

	
169
      virtual std::string get() = 0;      
169
      virtual std::string get() = 0;
170 170
    };
... ...
@@ -183,6 +183,6 @@
183 183
      ValueStorage(const Value& value, const Converter& converter = Converter())
184
 	: _value(value), _converter(converter) {}
184
         : _value(value), _converter(converter) {}
185 185

	
186 186
      virtual std::string get() {
187
	return _converter(_value);
187
        return _converter(_value);
188 188
      }
... ...
@@ -193,13 +193,13 @@
193 193
      const std::map<Value, std::string>& _map;
194
      
195
      MapLookUpConverter(const std::map<Value, std::string>& map) 
196
	: _map(map) {}
197
      
194

	
195
      MapLookUpConverter(const std::map<Value, std::string>& map)
196
        : _map(map) {}
197

	
198 198
      std::string operator()(const Value& str) {
199
	typename std::map<Value, std::string>::const_iterator it = 
200
	  _map.find(str);
201
	if (it == _map.end()) {
202
	  throw DataFormatError("Item not found");
203
	}
204
	return it->second;
199
        typename std::map<Value, std::string>::const_iterator it =
200
          _map.find(str);
201
        if (it == _map.end()) {
202
          throw DataFormatError("Item not found");
203
        }
204
        return it->second;
205 205
      }
... ...
@@ -211,15 +211,15 @@
211 211
      const std::map<typename Graph::Edge, std::string>& _map;
212
      
213
      GraphArcLookUpConverter(const Graph& graph, 
214
			      const std::map<typename Graph::Edge, 
215
			                     std::string>& map) 
216
	: _graph(graph), _map(map) {}
217
      
212

	
213
      GraphArcLookUpConverter(const Graph& graph,
214
                              const std::map<typename Graph::Edge,
215
                                             std::string>& map)
216
        : _graph(graph), _map(map) {}
217

	
218 218
      std::string operator()(const typename Graph::Arc& val) {
219
	typename std::map<typename Graph::Edge, std::string>
220
	  ::const_iterator it = _map.find(val);
221
	if (it == _map.end()) {
222
	  throw DataFormatError("Item not found");
223
	}
224
	return (_graph.direction(val) ? '+' : '-') + it->second;
219
        typename std::map<typename Graph::Edge, std::string>
220
          ::const_iterator it = _map.find(val);
221
        if (it == _map.end()) {
222
          throw DataFormatError("Item not found");
223
        }
224
        return (_graph.direction(val) ? '+' : '-') + it->second;
225 225
      }
... ...
@@ -228,4 +228,4 @@
228 228
    inline bool isWhiteSpace(char c) {
229
      return c == ' ' || c == '\t' || c == '\v' || 
230
        c == '\n' || c == '\r' || c == '\f'; 
229
      return c == ' ' || c == '\t' || c == '\v' ||
230
        c == '\n' || c == '\r' || c == '\f';
231 231
    }
... ...
@@ -233,4 +233,4 @@
233 233
    inline bool isEscaped(char c) {
234
      return c == '\\' || c == '\"' || c == '\'' || 
235
	c == '\a' || c == '\b';
234
      return c == '\\' || c == '\"' || c == '\'' ||
235
        c == '\a' || c == '\b';
236 236
    }
... ...
@@ -240,38 +240,38 @@
240 240
      case '\\':
241
	os << "\\\\";
242
	return;
241
        os << "\\\\";
242
        return;
243 243
      case '\"':
244
	os << "\\\"";
245
	return;
244
        os << "\\\"";
245
        return;
246 246
      case '\a':
247
	os << "\\a";
248
	return;
247
        os << "\\a";
248
        return;
249 249
      case '\b':
250
	os << "\\b";
251
	return;
250
        os << "\\b";
251
        return;
252 252
      case '\f':
253
	os << "\\f";
254
	return;
253
        os << "\\f";
254
        return;
255 255
      case '\r':
256
	os << "\\r";
257
	return;
256
        os << "\\r";
257
        return;
258 258
      case '\n':
259
	os << "\\n";
260
	return;
259
        os << "\\n";
260
        return;
261 261
      case '\t':
262
	os << "\\t";
263
	return;
262
        os << "\\t";
263
        return;
264 264
      case '\v':
265
	os << "\\v";
266
	return;
265
        os << "\\v";
266
        return;
267 267
      default:
268
	if (c < 0x20) {
269
	  std::ios::fmtflags flags = os.flags();
270
	  os << '\\' << std::oct << static_cast<int>(c);
271
	  os.flags(flags);
272
	} else {
273
	  os << c;
274
	}
275
	return;
276
      }     
268
        if (c < 0x20) {
269
          std::ios::fmtflags flags = os.flags();
270
          os << '\\' << std::oct << static_cast<int>(c);
271
          os.flags(flags);
272
        } else {
273
          os << c;
274
        }
275
        return;
276
      }
277 277
    }
... ...
@@ -283,5 +283,5 @@
283 283
      while (is.get(c)) {
284
	if (isWhiteSpace(c) || isEscaped(c)) {
285
	  return true;
286
	}
284
        if (isWhiteSpace(c) || isEscaped(c)) {
285
          return true;
286
        }
287 287
      }
... ...
@@ -289,3 +289,3 @@
289 289
    }
290
    
290

	
291 291
    inline std::ostream& writeToken(std::ostream& os, const std::string& str) {
... ...
@@ -293,10 +293,10 @@
293 293
      if (requireEscape(str)) {
294
	os << '\"';
295
	for (std::string::const_iterator it = str.begin(); 
296
	     it != str.end(); ++it) {
297
	  writeEscape(os, *it);
298
	}	
299
	os << '\"';
294
        os << '\"';
295
        for (std::string::const_iterator it = str.begin();
296
             it != str.end(); ++it) {
297
          writeEscape(os, *it);
298
        }
299
        os << '\"';
300 300
      } else {
301
	os << str;
301
        os << str;
302 302
      }
... ...
@@ -311,15 +311,15 @@
311 311
  template <typename Digraph>
312
  DigraphWriter<Digraph> digraphWriter(std::ostream& os, 
313
				       const Digraph& digraph);
312
  DigraphWriter<Digraph> digraphWriter(std::ostream& os,
313
                                       const Digraph& digraph);
314 314

	
315 315
  template <typename Digraph>
316
  DigraphWriter<Digraph> digraphWriter(const std::string& fn, 
317
				       const Digraph& digraph);
316
  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
317
                                       const Digraph& digraph);
318 318

	
319 319
  template <typename Digraph>
320
  DigraphWriter<Digraph> digraphWriter(const char *fn, 
321
				       const Digraph& digraph);
322
  
320
  DigraphWriter<Digraph> digraphWriter(const char *fn,
321
                                       const Digraph& digraph);
322

	
323 323
  /// \ingroup lemon_io
324
  ///  
324
  ///
325 325
  /// \brief \ref lgf-format "LGF" writer for directed graphs
... ...
@@ -372,3 +372,3 @@
372 372
    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
373
    
373

	
374 374
  private:
... ...
@@ -384,3 +384,3 @@
384 384
    std::string _attributes_caption;
385
    
385

	
386 386
    typedef std::map<Node, std::string> NodeIndex;
... ...
@@ -390,7 +390,7 @@
390 390

	
391
    typedef std::vector<std::pair<std::string, 
392
      _writer_bits::MapStorageBase<Node>* > > NodeMaps;    
393
    NodeMaps _node_maps; 
391
    typedef std::vector<std::pair<std::string,
392
      _writer_bits::MapStorageBase<Node>* > > NodeMaps;
393
    NodeMaps _node_maps;
394 394

	
395
    typedef std::vector<std::pair<std::string, 
395
    typedef std::vector<std::pair<std::string,
396 396
      _writer_bits::MapStorageBase<Arc>* > >ArcMaps;
... ...
@@ -398,3 +398,3 @@
398 398

	
399
    typedef std::vector<std::pair<std::string, 
399
    typedef std::vector<std::pair<std::string,
400 400
      _writer_bits::ValueStorageBase*> > Attributes;
... ...
@@ -411,5 +411,5 @@
411 411
    /// output stream.
412
    DigraphWriter(std::ostream& is, const Digraph& digraph) 
412
    DigraphWriter(std::ostream& is, const Digraph& digraph)
413 413
      : _os(&is), local_os(false), _digraph(digraph),
414
	_skip_nodes(false), _skip_arcs(false) {}
414
        _skip_nodes(false), _skip_arcs(false) {}
415 415

	
... ...
@@ -419,5 +419,5 @@
419 419
    /// output file.
420
    DigraphWriter(const std::string& fn, const Digraph& digraph) 
420
    DigraphWriter(const std::string& fn, const Digraph& digraph)
421 421
      : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
422
	_skip_nodes(false), _skip_arcs(false) {}
422
        _skip_nodes(false), _skip_arcs(false) {}
423 423

	
... ...
@@ -427,5 +427,5 @@
427 427
    /// output file.
428
    DigraphWriter(const char* fn, const Digraph& digraph) 
428
    DigraphWriter(const char* fn, const Digraph& digraph)
429 429
      : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
430
	_skip_nodes(false), _skip_arcs(false) {}
430
        _skip_nodes(false), _skip_arcs(false) {}
431 431

	
... ...
@@ -433,15 +433,15 @@
433 433
    ~DigraphWriter() {
434
      for (typename NodeMaps::iterator it = _node_maps.begin(); 
435
	   it != _node_maps.end(); ++it) {
436
	delete it->second;
434
      for (typename NodeMaps::iterator it = _node_maps.begin();
435
           it != _node_maps.end(); ++it) {
436
        delete it->second;
437 437
      }
438 438

	
439
      for (typename ArcMaps::iterator it = _arc_maps.begin(); 
440
	   it != _arc_maps.end(); ++it) {
441
	delete it->second;
439
      for (typename ArcMaps::iterator it = _arc_maps.begin();
440
           it != _arc_maps.end(); ++it) {
441
        delete it->second;
442 442
      }
443 443

	
444
      for (typename Attributes::iterator it = _attributes.begin(); 
445
	   it != _attributes.end(); ++it) {
446
	delete it->second;
444
      for (typename Attributes::iterator it = _attributes.begin();
445
           it != _attributes.end(); ++it) {
446
        delete it->second;
447 447
      }
... ...
@@ -449,3 +449,3 @@
449 449
      if (local_os) {
450
	delete _os;
450
        delete _os;
451 451
      }
... ...
@@ -455,12 +455,12 @@
455 455

	
456
    friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os, 
457
						  const Digraph& digraph);
458
    friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn, 
459
						  const Digraph& digraph);   
460
    friend DigraphWriter<Digraph> digraphWriter<>(const char *fn, 
461
						  const Digraph& digraph);
456
    friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os,
457
                                                  const Digraph& digraph);
458
    friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn,
459
                                                  const Digraph& digraph);
460
    friend DigraphWriter<Digraph> digraphWriter<>(const char *fn,
461
                                                  const Digraph& digraph);
462 462

	
463
    DigraphWriter(DigraphWriter& other) 
463
    DigraphWriter(DigraphWriter& other)
464 464
      : _os(other._os), local_os(other.local_os), _digraph(other._digraph),
465
	_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
465
        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
466 466

	
... ...
@@ -480,3 +480,3 @@
480 480
    }
481
    
481

	
482 482
    DigraphWriter& operator=(const DigraphWriter&);
... ...
@@ -487,3 +487,3 @@
487 487
    /// @{
488
    
488

	
489 489
    /// \brief Node map writing rule
... ...
@@ -494,4 +494,4 @@
494 494
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
495
      _writer_bits::MapStorageBase<Node>* storage = 
496
	new _writer_bits::MapStorage<Node, Map>(map);
495
      _writer_bits::MapStorageBase<Node>* storage =
496
        new _writer_bits::MapStorage<Node, Map>(map);
497 497
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -505,7 +505,7 @@
505 505
    template <typename Map, typename Converter>
506
    DigraphWriter& nodeMap(const std::string& caption, const Map& map, 
507
			   const Converter& converter = Converter()) {
506
    DigraphWriter& nodeMap(const std::string& caption, const Map& map,
507
                           const Converter& converter = Converter()) {
508 508
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
509
      _writer_bits::MapStorageBase<Node>* storage = 
510
	new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
509
      _writer_bits::MapStorageBase<Node>* storage =
510
        new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
511 511
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -520,4 +520,4 @@
520 520
      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
521
      _writer_bits::MapStorageBase<Arc>* storage = 
522
	new _writer_bits::MapStorage<Arc, Map>(map);
521
      _writer_bits::MapStorageBase<Arc>* storage =
522
        new _writer_bits::MapStorage<Arc, Map>(map);
523 523
      _arc_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -531,7 +531,7 @@
531 531
    template <typename Map, typename Converter>
532
    DigraphWriter& arcMap(const std::string& caption, const Map& map, 
533
			  const Converter& converter = Converter()) {
532
    DigraphWriter& arcMap(const std::string& caption, const Map& map,
533
                          const Converter& converter = Converter()) {
534 534
      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
535
      _writer_bits::MapStorageBase<Arc>* storage = 
536
	new _writer_bits::MapStorage<Arc, Map, Converter>(map, converter);
535
      _writer_bits::MapStorageBase<Arc>* storage =
536
        new _writer_bits::MapStorage<Arc, Map, Converter>(map, converter);
537 537
      _arc_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -545,4 +545,4 @@
545 545
    DigraphWriter& attribute(const std::string& caption, const Value& value) {
546
      _writer_bits::ValueStorageBase* storage = 
547
	new _writer_bits::ValueStorage<Value>(value);
546
      _writer_bits::ValueStorageBase* storage =
547
        new _writer_bits::ValueStorage<Value>(value);
548 548
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -556,6 +556,6 @@
556 556
    template <typename Value, typename Converter>
557
    DigraphWriter& attribute(const std::string& caption, const Value& value, 
558
			     const Converter& converter = Converter()) {
559
      _writer_bits::ValueStorageBase* storage = 
560
	new _writer_bits::ValueStorage<Value, Converter>(value, converter);
557
    DigraphWriter& attribute(const std::string& caption, const Value& value,
558
                             const Converter& converter = Converter()) {
559
      _writer_bits::ValueStorageBase* storage =
560
        new _writer_bits::ValueStorage<Value, Converter>(value, converter);
561 561
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -570,4 +570,4 @@
570 570
      Converter converter(_node_index);
571
      _writer_bits::ValueStorageBase* storage = 
572
	new _writer_bits::ValueStorage<Node, Converter>(node, converter);
571
      _writer_bits::ValueStorageBase* storage =
572
        new _writer_bits::ValueStorage<Node, Converter>(node, converter);
573 573
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -582,4 +582,4 @@
582 582
      Converter converter(_arc_index);
583
      _writer_bits::ValueStorageBase* storage = 
584
	new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
583
      _writer_bits::ValueStorageBase* storage =
584
        new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
585 585
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -643,7 +643,7 @@
643 643
      for (typename NodeMaps::iterator it = _node_maps.begin();
644
	   it != _node_maps.end(); ++it) {
644
           it != _node_maps.end(); ++it) {
645 645
        if (it->first == "label") {
646
	  label = it->second;
647
	  break;
648
	}
646
          label = it->second;
647
          break;
648
        }
649 649
      }
... ...
@@ -652,3 +652,3 @@
652 652
      if (!_nodes_caption.empty()) {
653
	_writer_bits::writeToken(*_os << ' ', _nodes_caption);
653
        _writer_bits::writeToken(*_os << ' ', _nodes_caption);
654 654
      }
... ...
@@ -657,7 +657,7 @@
657 657
      if (label == 0) {
658
	*_os << "label" << '\t';
658
        *_os << "label" << '\t';
659 659
      }
660 660
      for (typename NodeMaps::iterator it = _node_maps.begin();
661
	   it != _node_maps.end(); ++it) {
662
	_writer_bits::writeToken(*_os, it->first) << '\t';
661
           it != _node_maps.end(); ++it) {
662
        _writer_bits::writeToken(*_os, it->first) << '\t';
663 663
      }
... ...
@@ -667,11 +667,11 @@
667 667
      for (NodeIt n(_digraph); n != INVALID; ++n) {
668
	nodes.push_back(n);
668
        nodes.push_back(n);
669 669
      }
670
      
670

	
671 671
      if (label == 0) {
672
	IdMap<Digraph, Node> id_map(_digraph);
673
	_writer_bits::MapLess<IdMap<Digraph, Node> > id_less(id_map);
674
	std::sort(nodes.begin(), nodes.end(), id_less);
672
        IdMap<Digraph, Node> id_map(_digraph);
673
        _writer_bits::MapLess<IdMap<Digraph, Node> > id_less(id_map);
674
        std::sort(nodes.begin(), nodes.end(), id_less);
675 675
      } else {
676
	label->sort(nodes);
676
        label->sort(nodes);
677 677
      }
... ...
@@ -679,20 +679,20 @@
679 679
      for (int i = 0; i < static_cast<int>(nodes.size()); ++i) {
680
	Node n = nodes[i];
681
	if (label == 0) {
682
	  std::ostringstream os;
683
	  os << _digraph.id(n);
684
	  _writer_bits::writeToken(*_os, os.str());
685
	  *_os << '\t';
686
	  _node_index.insert(std::make_pair(n, os.str()));
687
	}
688
	for (typename NodeMaps::iterator it = _node_maps.begin();
689
	     it != _node_maps.end(); ++it) {
690
	  std::string value = it->second->get(n);
691
	  _writer_bits::writeToken(*_os, value);
692
	  if (it->first == "label") {
693
	    _node_index.insert(std::make_pair(n, value));
694
	  }
695
	  *_os << '\t';
696
	}
697
	*_os << std::endl;
680
        Node n = nodes[i];
681
        if (label == 0) {
682
          std::ostringstream os;
683
          os << _digraph.id(n);
684
          _writer_bits::writeToken(*_os, os.str());
685
          *_os << '\t';
686
          _node_index.insert(std::make_pair(n, os.str()));
687
        }
688
        for (typename NodeMaps::iterator it = _node_maps.begin();
689
             it != _node_maps.end(); ++it) {
690
          std::string value = it->second->get(n);
691
          _writer_bits::writeToken(*_os, value);
692
          if (it->first == "label") {
693
            _node_index.insert(std::make_pair(n, value));
694
          }
695
          *_os << '\t';
696
        }
697
        *_os << std::endl;
698 698
      }
... ...
@@ -703,7 +703,7 @@
703 703
      for (typename NodeMaps::iterator it = _node_maps.begin();
704
	   it != _node_maps.end(); ++it) {
704
           it != _node_maps.end(); ++it) {
705 705
        if (it->first == "label") {
706
	  label = it->second;
707
	  break;
708
	}
706
          label = it->second;
707
          break;
708
        }
709 709
      }
... ...
@@ -711,12 +711,12 @@
711 711
      if (label == 0) {
712
	for (NodeIt n(_digraph); n != INVALID; ++n) {
713
	  std::ostringstream os;
714
	  os << _digraph.id(n);
715
	  _node_index.insert(std::make_pair(n, os.str()));	  
716
	}	
712
        for (NodeIt n(_digraph); n != INVALID; ++n) {
713
          std::ostringstream os;
714
          os << _digraph.id(n);
715
          _node_index.insert(std::make_pair(n, os.str()));
716
        }
717 717
      } else {
718
	for (NodeIt n(_digraph); n != INVALID; ++n) {
719
	  std::string value = label->get(n);	  
720
	  _node_index.insert(std::make_pair(n, value));
721
	}
718
        for (NodeIt n(_digraph); n != INVALID; ++n) {
719
          std::string value = label->get(n);
720
          _node_index.insert(std::make_pair(n, value));
721
        }
722 722
      }
... ...
@@ -727,7 +727,7 @@
727 727
      for (typename ArcMaps::iterator it = _arc_maps.begin();
728
	   it != _arc_maps.end(); ++it) {
728
           it != _arc_maps.end(); ++it) {
729 729
        if (it->first == "label") {
730
	  label = it->second;
731
	  break;
732
	}
730
          label = it->second;
731
          break;
732
        }
733 733
      }
... ...
@@ -736,3 +736,3 @@
736 736
      if (!_arcs_caption.empty()) {
737
	_writer_bits::writeToken(*_os << ' ', _arcs_caption);
737
        _writer_bits::writeToken(*_os << ' ', _arcs_caption);
738 738
      }
... ...
@@ -742,7 +742,7 @@
742 742
      if (label == 0) {
743
	*_os << "label" << '\t';
743
        *_os << "label" << '\t';
744 744
      }
745 745
      for (typename ArcMaps::iterator it = _arc_maps.begin();
746
	   it != _arc_maps.end(); ++it) {
747
	_writer_bits::writeToken(*_os, it->first) << '\t';
746
           it != _arc_maps.end(); ++it) {
747
        _writer_bits::writeToken(*_os, it->first) << '\t';
748 748
      }
... ...
@@ -752,11 +752,11 @@
752 752
      for (ArcIt n(_digraph); n != INVALID; ++n) {
753
	arcs.push_back(n);
753
        arcs.push_back(n);
754 754
      }
755
      
755

	
756 756
      if (label == 0) {
757
	IdMap<Digraph, Arc> id_map(_digraph);
758
	_writer_bits::MapLess<IdMap<Digraph, Arc> > id_less(id_map);
759
	std::sort(arcs.begin(), arcs.end(), id_less);
757
        IdMap<Digraph, Arc> id_map(_digraph);
758
        _writer_bits::MapLess<IdMap<Digraph, Arc> > id_less(id_map);
759
        std::sort(arcs.begin(), arcs.end(), id_less);
760 760
      } else {
761
	label->sort(arcs);
761
        label->sort(arcs);
762 762
      }
... ...
@@ -764,26 +764,26 @@
764 764
      for (int i = 0; i < static_cast<int>(arcs.size()); ++i) {
765
	Arc a = arcs[i];
766
	_writer_bits::writeToken(*_os, _node_index.
767
				 find(_digraph.source(a))->second);
768
	*_os << '\t';
769
	_writer_bits::writeToken(*_os, _node_index.
770
				 find(_digraph.target(a))->second);
771
	*_os << '\t';
772
	if (label == 0) {
773
	  std::ostringstream os;
774
	  os << _digraph.id(a);
775
	  _writer_bits::writeToken(*_os, os.str());
776
	  *_os << '\t';
777
	  _arc_index.insert(std::make_pair(a, os.str()));
778
	}
779
	for (typename ArcMaps::iterator it = _arc_maps.begin();
780
	     it != _arc_maps.end(); ++it) {
781
	  std::string value = it->second->get(a);
782
	  _writer_bits::writeToken(*_os, value);
783
	  if (it->first == "label") {
784
	    _arc_index.insert(std::make_pair(a, value));
785
	  }
786
	  *_os << '\t';
787
	}
788
	*_os << std::endl;
765
        Arc a = arcs[i];
766
        _writer_bits::writeToken(*_os, _node_index.
767
                                 find(_digraph.source(a))->second);
768
        *_os << '\t';
769
        _writer_bits::writeToken(*_os, _node_index.
770
                                 find(_digraph.target(a))->second);
771
        *_os << '\t';
772
        if (label == 0) {
773
          std::ostringstream os;
774
          os << _digraph.id(a);
775
          _writer_bits::writeToken(*_os, os.str());
776
          *_os << '\t';
777
          _arc_index.insert(std::make_pair(a, os.str()));
778
        }
779
        for (typename ArcMaps::iterator it = _arc_maps.begin();
780
             it != _arc_maps.end(); ++it) {
781
          std::string value = it->second->get(a);
782
          _writer_bits::writeToken(*_os, value);
783
          if (it->first == "label") {
784
            _arc_index.insert(std::make_pair(a, value));
785
          }
786
          *_os << '\t';
787
        }
788
        *_os << std::endl;
789 789
      }
... ...
@@ -794,7 +794,7 @@
794 794
      for (typename ArcMaps::iterator it = _arc_maps.begin();
795
	   it != _arc_maps.end(); ++it) {
795
           it != _arc_maps.end(); ++it) {
796 796
        if (it->first == "label") {
797
	  label = it->second;
798
	  break;
799
	}
797
          label = it->second;
798
          break;
799
        }
800 800
      }
... ...
@@ -802,12 +802,12 @@
802 802
      if (label == 0) {
803
	for (ArcIt a(_digraph); a != INVALID; ++a) {
804
	  std::ostringstream os;
805
	  os << _digraph.id(a);
806
	  _arc_index.insert(std::make_pair(a, os.str()));	  
807
	}	
803
        for (ArcIt a(_digraph); a != INVALID; ++a) {
804
          std::ostringstream os;
805
          os << _digraph.id(a);
806
          _arc_index.insert(std::make_pair(a, os.str()));
807
        }
808 808
      } else {
809
	for (ArcIt a(_digraph); a != INVALID; ++a) {
810
	  std::string value = label->get(a);	  
811
	  _arc_index.insert(std::make_pair(a, value));
812
	}
809
        for (ArcIt a(_digraph); a != INVALID; ++a) {
810
          std::string value = label->get(a);
811
          _arc_index.insert(std::make_pair(a, value));
812
        }
813 813
      }
... ...
@@ -819,3 +819,3 @@
819 819
      if (!_attributes_caption.empty()) {
820
	_writer_bits::writeToken(*_os << ' ', _attributes_caption);
820
        _writer_bits::writeToken(*_os << ' ', _attributes_caption);
821 821
      }
... ...
@@ -823,12 +823,12 @@
823 823
      for (typename Attributes::iterator it = _attributes.begin();
824
	   it != _attributes.end(); ++it) {
825
	_writer_bits::writeToken(*_os, it->first) << ' ';
826
	_writer_bits::writeToken(*_os, it->second->get());
827
	*_os << std::endl;
824
           it != _attributes.end(); ++it) {
825
        _writer_bits::writeToken(*_os, it->first) << ' ';
826
        _writer_bits::writeToken(*_os, it->second->get());
827
        *_os << std::endl;
828 828
      }
829 829
    }
830
    
830

	
831 831
  public:
832
    
833
    /// \name Execution of the writer    
832

	
833
    /// \name Execution of the writer
834 834
    /// @{
... ...
@@ -840,10 +840,10 @@
840 840
      if (!_skip_nodes) {
841
	writeNodes();
841
        writeNodes();
842 842
      } else {
843
	createNodeIndex();
843
        createNodeIndex();
844 844
      }
845
      if (!_skip_arcs) {      
846
	writeArcs();
845
      if (!_skip_arcs) {
846
        writeArcs();
847 847
      } else {
848
	createArcIndex();
848
        createArcIndex();
849 849
      }
... ...
@@ -863,3 +863,3 @@
863 863
  /// \brief Return a \ref DigraphWriter class
864
  /// 
864
  ///
865 865
  /// This function just returns a \ref DigraphWriter class.
... ...
@@ -867,4 +867,4 @@
867 867
  template <typename Digraph>
868
  DigraphWriter<Digraph> digraphWriter(std::ostream& os, 
869
				       const Digraph& digraph) {
868
  DigraphWriter<Digraph> digraphWriter(std::ostream& os,
869
                                       const Digraph& digraph) {
870 870
    DigraphWriter<Digraph> tmp(os, digraph);
... ...
@@ -874,3 +874,3 @@
874 874
  /// \brief Return a \ref DigraphWriter class
875
  /// 
875
  ///
876 876
  /// This function just returns a \ref DigraphWriter class.
... ...
@@ -878,4 +878,4 @@
878 878
  template <typename Digraph>
879
  DigraphWriter<Digraph> digraphWriter(const std::string& fn, 
880
				       const Digraph& digraph) {
879
  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
880
                                       const Digraph& digraph) {
881 881
    DigraphWriter<Digraph> tmp(fn, digraph);
... ...
@@ -885,3 +885,3 @@
885 885
  /// \brief Return a \ref DigraphWriter class
886
  /// 
886
  ///
887 887
  /// This function just returns a \ref DigraphWriter class.
... ...
@@ -889,4 +889,4 @@
889 889
  template <typename Digraph>
890
  DigraphWriter<Digraph> digraphWriter(const char* fn, 
891
				       const Digraph& digraph) {
890
  DigraphWriter<Digraph> digraphWriter(const char* fn,
891
                                       const Digraph& digraph) {
892 892
    DigraphWriter<Digraph> tmp(fn, digraph);
... ...
@@ -899,12 +899,12 @@
899 899
  template <typename Graph>
900
  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph);    
900
  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph);
901 901

	
902 902
  template <typename Graph>
903
  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph);   
903
  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph);
904 904

	
905 905
  template <typename Graph>
906
  GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph);    
906
  GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph);
907 907

	
908 908
  /// \ingroup lemon_io
909
  ///  
909
  ///
910 910
  /// \brief \ref lgf-format "LGF" writer for directed graphs
... ...
@@ -928,3 +928,3 @@
928 928
    TEMPLATE_GRAPH_TYPEDEFS(Graph);
929
    
929

	
930 930
  private:
... ...
@@ -940,3 +940,3 @@
940 940
    std::string _attributes_caption;
941
    
941

	
942 942
    typedef std::map<Node, std::string> NodeIndex;
... ...
@@ -946,7 +946,7 @@
946 946

	
947
    typedef std::vector<std::pair<std::string, 
948
      _writer_bits::MapStorageBase<Node>* > > NodeMaps;    
949
    NodeMaps _node_maps; 
947
    typedef std::vector<std::pair<std::string,
948
      _writer_bits::MapStorageBase<Node>* > > NodeMaps;
949
    NodeMaps _node_maps;
950 950

	
951
    typedef std::vector<std::pair<std::string, 
951
    typedef std::vector<std::pair<std::string,
952 952
      _writer_bits::MapStorageBase<Edge>* > >EdgeMaps;
... ...
@@ -954,3 +954,3 @@
954 954

	
955
    typedef std::vector<std::pair<std::string, 
955
    typedef std::vector<std::pair<std::string,
956 956
      _writer_bits::ValueStorageBase*> > Attributes;
... ...
@@ -967,5 +967,5 @@
967 967
    /// output stream.
968
    GraphWriter(std::ostream& is, const Graph& graph) 
968
    GraphWriter(std::ostream& is, const Graph& graph)
969 969
      : _os(&is), local_os(false), _graph(graph),
970
	_skip_nodes(false), _skip_edges(false) {}
970
        _skip_nodes(false), _skip_edges(false) {}
971 971

	
... ...
@@ -975,5 +975,5 @@
975 975
    /// output file.
976
    GraphWriter(const std::string& fn, const Graph& graph) 
976
    GraphWriter(const std::string& fn, const Graph& graph)
977 977
      : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
978
	_skip_nodes(false), _skip_edges(false) {}
978
        _skip_nodes(false), _skip_edges(false) {}
979 979

	
... ...
@@ -983,5 +983,5 @@
983 983
    /// output file.
984
    GraphWriter(const char* fn, const Graph& graph) 
984
    GraphWriter(const char* fn, const Graph& graph)
985 985
      : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
986
	_skip_nodes(false), _skip_edges(false) {}
986
        _skip_nodes(false), _skip_edges(false) {}
987 987

	
... ...
@@ -989,15 +989,15 @@
989 989
    ~GraphWriter() {
990
      for (typename NodeMaps::iterator it = _node_maps.begin(); 
991
	   it != _node_maps.end(); ++it) {
992
	delete it->second;
990
      for (typename NodeMaps::iterator it = _node_maps.begin();
991
           it != _node_maps.end(); ++it) {
992
        delete it->second;
993 993
      }
994 994

	
995
      for (typename EdgeMaps::iterator it = _edge_maps.begin(); 
996
	   it != _edge_maps.end(); ++it) {
997
	delete it->second;
995
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
996
           it != _edge_maps.end(); ++it) {
997
        delete it->second;
998 998
      }
999 999

	
1000
      for (typename Attributes::iterator it = _attributes.begin(); 
1001
	   it != _attributes.end(); ++it) {
1002
	delete it->second;
1000
      for (typename Attributes::iterator it = _attributes.begin();
1001
           it != _attributes.end(); ++it) {
1002
        delete it->second;
1003 1003
      }
... ...
@@ -1005,18 +1005,18 @@
1005 1005
      if (local_os) {
1006
	delete _os;
1006
        delete _os;
1007 1007
      }
1008 1008
    }
1009
    
1009

	
1010 1010
  private:
1011 1011

	
1012
    friend GraphWriter<Graph> graphWriter<>(std::ostream& os, 
1013
					    const Graph& graph);    
1014
    friend GraphWriter<Graph> graphWriter<>(const std::string& fn, 
1015
					    const Graph& graph);   
1016
    friend GraphWriter<Graph> graphWriter<>(const char *fn, 
1017
					    const Graph& graph);    
1012
    friend GraphWriter<Graph> graphWriter<>(std::ostream& os,
1013
                                            const Graph& graph);
1014
    friend GraphWriter<Graph> graphWriter<>(const std::string& fn,
1015
                                            const Graph& graph);
1016
    friend GraphWriter<Graph> graphWriter<>(const char *fn,
1017
                                            const Graph& graph);
1018 1018

	
1019
    GraphWriter(GraphWriter& other) 
1019
    GraphWriter(GraphWriter& other)
1020 1020
      : _os(other._os), local_os(other.local_os), _graph(other._graph),
1021
	_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
1021
        _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
1022 1022

	
... ...
@@ -1043,3 +1043,3 @@
1043 1043
    /// @{
1044
    
1044

	
1045 1045
    /// \brief Node map writing rule
... ...
@@ -1050,4 +1050,4 @@
1050 1050
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1051
      _writer_bits::MapStorageBase<Node>* storage = 
1052
	new _writer_bits::MapStorage<Node, Map>(map);
1051
      _writer_bits::MapStorageBase<Node>* storage =
1052
        new _writer_bits::MapStorage<Node, Map>(map);
1053 1053
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1061,7 +1061,7 @@
1061 1061
    template <typename Map, typename Converter>
1062
    GraphWriter& nodeMap(const std::string& caption, const Map& map, 
1063
			   const Converter& converter = Converter()) {
1062
    GraphWriter& nodeMap(const std::string& caption, const Map& map,
1063
                           const Converter& converter = Converter()) {
1064 1064
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1065
      _writer_bits::MapStorageBase<Node>* storage = 
1066
	new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
1065
      _writer_bits::MapStorageBase<Node>* storage =
1066
        new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
1067 1067
      _node_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1076,4 +1076,4 @@
1076 1076
      checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
1077
      _writer_bits::MapStorageBase<Edge>* storage = 
1078
	new _writer_bits::MapStorage<Edge, Map>(map);
1077
      _writer_bits::MapStorageBase<Edge>* storage =
1078
        new _writer_bits::MapStorage<Edge, Map>(map);
1079 1079
      _edge_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1087,7 +1087,7 @@
1087 1087
    template <typename Map, typename Converter>
1088
    GraphWriter& edgeMap(const std::string& caption, const Map& map, 
1089
			  const Converter& converter = Converter()) {
1088
    GraphWriter& edgeMap(const std::string& caption, const Map& map,
1089
                          const Converter& converter = Converter()) {
1090 1090
      checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
1091
      _writer_bits::MapStorageBase<Edge>* storage = 
1092
	new _writer_bits::MapStorage<Edge, Map, Converter>(map, converter);
1091
      _writer_bits::MapStorageBase<Edge>* storage =
1092
        new _writer_bits::MapStorage<Edge, Map, Converter>(map, converter);
1093 1093
      _edge_maps.push_back(std::make_pair(caption, storage));
... ...
@@ -1102,7 +1102,7 @@
1102 1102
      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
1103
      _writer_bits::MapStorageBase<Edge>* forward_storage = 
1104
	new _writer_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
1103
      _writer_bits::MapStorageBase<Edge>* forward_storage =
1104
        new _writer_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
1105 1105
      _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
1106
      _writer_bits::MapStorageBase<Edge>* backward_storage = 
1107
	new _writer_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
1106
      _writer_bits::MapStorageBase<Edge>* backward_storage =
1107
        new _writer_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
1108 1108
      _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
... ...
@@ -1116,12 +1116,12 @@
1116 1116
    template <typename Map, typename Converter>
1117
    GraphWriter& arcMap(const std::string& caption, const Map& map, 
1118
			  const Converter& converter = Converter()) {
1117
    GraphWriter& arcMap(const std::string& caption, const Map& map,
1118
                          const Converter& converter = Converter()) {
1119 1119
      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
1120
      _writer_bits::MapStorageBase<Edge>* forward_storage = 
1121
	new _writer_bits::GraphArcMapStorage<Graph, true, Map, Converter>
1122
	(_graph, map, converter);
1120
      _writer_bits::MapStorageBase<Edge>* forward_storage =
1121
        new _writer_bits::GraphArcMapStorage<Graph, true, Map, Converter>
1122
        (_graph, map, converter);
1123 1123
      _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
1124
      _writer_bits::MapStorageBase<Edge>* backward_storage = 
1125
	new _writer_bits::GraphArcMapStorage<Graph, false, Map, Converter>
1126
	(_graph, map, converter);
1124
      _writer_bits::MapStorageBase<Edge>* backward_storage =
1125
        new _writer_bits::GraphArcMapStorage<Graph, false, Map, Converter>
1126
        (_graph, map, converter);
1127 1127
      _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
... ...
@@ -1135,4 +1135,4 @@
1135 1135
    GraphWriter& attribute(const std::string& caption, const Value& value) {
1136
      _writer_bits::ValueStorageBase* storage = 
1137
	new _writer_bits::ValueStorage<Value>(value);
1136
      _writer_bits::ValueStorageBase* storage =
1137
        new _writer_bits::ValueStorage<Value>(value);
1138 1138
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -1146,6 +1146,6 @@
1146 1146
    template <typename Value, typename Converter>
1147
    GraphWriter& attribute(const std::string& caption, const Value& value, 
1148
			     const Converter& converter = Converter()) {
1149
      _writer_bits::ValueStorageBase* storage = 
1150
	new _writer_bits::ValueStorage<Value, Converter>(value, converter);
1147
    GraphWriter& attribute(const std::string& caption, const Value& value,
1148
                             const Converter& converter = Converter()) {
1149
      _writer_bits::ValueStorageBase* storage =
1150
        new _writer_bits::ValueStorage<Value, Converter>(value, converter);
1151 1151
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -1160,4 +1160,4 @@
1160 1160
      Converter converter(_node_index);
1161
      _writer_bits::ValueStorageBase* storage = 
1162
	new _writer_bits::ValueStorage<Node, Converter>(node, converter);
1161
      _writer_bits::ValueStorageBase* storage =
1162
        new _writer_bits::ValueStorage<Node, Converter>(node, converter);
1163 1163
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -1172,4 +1172,4 @@
1172 1172
      Converter converter(_edge_index);
1173
      _writer_bits::ValueStorageBase* storage = 
1174
	new _writer_bits::ValueStorage<Edge, Converter>(edge, converter);
1173
      _writer_bits::ValueStorageBase* storage =
1174
        new _writer_bits::ValueStorage<Edge, Converter>(edge, converter);
1175 1175
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -1184,4 +1184,4 @@
1184 1184
      Converter converter(_graph, _edge_index);
1185
      _writer_bits::ValueStorageBase* storage = 
1186
	new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
1185
      _writer_bits::ValueStorageBase* storage =
1186
        new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
1187 1187
      _attributes.push_back(std::make_pair(caption, storage));
... ...
@@ -1245,7 +1245,7 @@
1245 1245
      for (typename NodeMaps::iterator it = _node_maps.begin();
1246
	   it != _node_maps.end(); ++it) {
1246
           it != _node_maps.end(); ++it) {
1247 1247
        if (it->first == "label") {
1248
	  label = it->second;
1249
	  break;
1250
	}
1248
          label = it->second;
1249
          break;
1250
        }
1251 1251
      }
... ...
@@ -1254,3 +1254,3 @@
1254 1254
      if (!_nodes_caption.empty()) {
1255
	_writer_bits::writeToken(*_os << ' ', _nodes_caption);
1255
        _writer_bits::writeToken(*_os << ' ', _nodes_caption);
1256 1256
      }
... ...
@@ -1259,7 +1259,7 @@
1259 1259
      if (label == 0) {
1260
	*_os << "label" << '\t';
1260
        *_os << "label" << '\t';
1261 1261
      }
1262 1262
      for (typename NodeMaps::iterator it = _node_maps.begin();
1263
	   it != _node_maps.end(); ++it) {
1264
	_writer_bits::writeToken(*_os, it->first) << '\t';
1263
           it != _node_maps.end(); ++it) {
1264
        _writer_bits::writeToken(*_os, it->first) << '\t';
1265 1265
      }
... ...
@@ -1269,11 +1269,11 @@
1269 1269
      for (NodeIt n(_graph); n != INVALID; ++n) {
1270
	nodes.push_back(n);
1270
        nodes.push_back(n);
1271 1271
      }
1272
      
1272

	
1273 1273
      if (label == 0) {
1274
	IdMap<Graph, Node> id_map(_graph);
1275
	_writer_bits::MapLess<IdMap<Graph, Node> > id_less(id_map);
1276
	std::sort(nodes.begin(), nodes.end(), id_less);
1274
        IdMap<Graph, Node> id_map(_graph);
1275
        _writer_bits::MapLess<IdMap<Graph, Node> > id_less(id_map);
1276
        std::sort(nodes.begin(), nodes.end(), id_less);
1277 1277
      } else {
1278
	label->sort(nodes);
1278
        label->sort(nodes);
1279 1279
      }
... ...
@@ -1281,20 +1281,20 @@
1281 1281
      for (int i = 0; i < static_cast<int>(nodes.size()); ++i) {
1282
	Node n = nodes[i];
1283
	if (label == 0) {
1284
	  std::ostringstream os;
1285
	  os << _graph.id(n);
1286
	  _writer_bits::writeToken(*_os, os.str());
1287
	  *_os << '\t';
1288
	  _node_index.insert(std::make_pair(n, os.str()));
1289
	}
1290
	for (typename NodeMaps::iterator it = _node_maps.begin();
1291
	     it != _node_maps.end(); ++it) {
1292
	  std::string value = it->second->get(n);
1293
	  _writer_bits::writeToken(*_os, value);
1294
	  if (it->first == "label") {
1295
	    _node_index.insert(std::make_pair(n, value));
1296
	  }
1297
	  *_os << '\t';
1298
	}
1299
	*_os << std::endl;
1282
        Node n = nodes[i];
1283
        if (label == 0) {
1284
          std::ostringstream os;
1285
          os << _graph.id(n);
1286
          _writer_bits::writeToken(*_os, os.str());
1287
          *_os << '\t';
1288
          _node_index.insert(std::make_pair(n, os.str()));
1289
        }
1290
        for (typename NodeMaps::iterator it = _node_maps.begin();
1291
             it != _node_maps.end(); ++it) {
1292
          std::string value = it->second->get(n);
1293
          _writer_bits::writeToken(*_os, value);
1294
          if (it->first == "label") {
1295
            _node_index.insert(std::make_pair(n, value));
1296
          }
1297
          *_os << '\t';
1298
        }
1299
        *_os << std::endl;
1300 1300
      }
... ...
@@ -1305,7 +1305,7 @@
1305 1305
      for (typename NodeMaps::iterator it = _node_maps.begin();
1306
	   it != _node_maps.end(); ++it) {
1306
           it != _node_maps.end(); ++it) {
1307 1307
        if (it->first == "label") {
1308
	  label = it->second;
1309
	  break;
1310
	}
1308
          label = it->second;
1309
          break;
1310
        }
1311 1311
      }
... ...
@@ -1313,12 +1313,12 @@
1313 1313
      if (label == 0) {
1314
	for (NodeIt n(_graph); n != INVALID; ++n) {
1315
	  std::ostringstream os;
1316
	  os << _graph.id(n);
1317
	  _node_index.insert(std::make_pair(n, os.str()));	  
1318
	}	
1314
        for (NodeIt n(_graph); n != INVALID; ++n) {
1315
          std::ostringstream os;
1316
          os << _graph.id(n);
1317
          _node_index.insert(std::make_pair(n, os.str()));
1318
        }
1319 1319
      } else {
1320
	for (NodeIt n(_graph); n != INVALID; ++n) {
1321
	  std::string value = label->get(n);	  
1322
	  _node_index.insert(std::make_pair(n, value));
1323
	}
1320
        for (NodeIt n(_graph); n != INVALID; ++n) {
1321
          std::string value = label->get(n);
1322
          _node_index.insert(std::make_pair(n, value));
1323
        }
1324 1324
      }
... ...
@@ -1329,7 +1329,7 @@
1329 1329
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
1330
	   it != _edge_maps.end(); ++it) {
1330
           it != _edge_maps.end(); ++it) {
1331 1331
        if (it->first == "label") {
1332
	  label = it->second;
1333
	  break;
1334
	}
1332
          label = it->second;
1333
          break;
1334
        }
1335 1335
      }
... ...
@@ -1338,3 +1338,3 @@
1338 1338
      if (!_edges_caption.empty()) {
1339
	_writer_bits::writeToken(*_os << ' ', _edges_caption);
1339
        _writer_bits::writeToken(*_os << ' ', _edges_caption);
1340 1340
      }
... ...
@@ -1344,7 +1344,7 @@
1344 1344
      if (label == 0) {
1345
	*_os << "label" << '\t';
1345
        *_os << "label" << '\t';
1346 1346
      }
1347 1347
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
1348
	   it != _edge_maps.end(); ++it) {
1349
	_writer_bits::writeToken(*_os, it->first) << '\t';
1348
           it != _edge_maps.end(); ++it) {
1349
        _writer_bits::writeToken(*_os, it->first) << '\t';
1350 1350
      }
... ...
@@ -1354,11 +1354,11 @@
1354 1354
      for (EdgeIt n(_graph); n != INVALID; ++n) {
1355
	edges.push_back(n);
1355
        edges.push_back(n);
1356 1356
      }
1357
      
1357

	
1358 1358
      if (label == 0) {
1359
	IdMap<Graph, Edge> id_map(_graph);
1360
	_writer_bits::MapLess<IdMap<Graph, Edge> > id_less(id_map);
1361
	std::sort(edges.begin(), edges.end(), id_less);
1359
        IdMap<Graph, Edge> id_map(_graph);
1360
        _writer_bits::MapLess<IdMap<Graph, Edge> > id_less(id_map);
1361
        std::sort(edges.begin(), edges.end(), id_less);
1362 1362
      } else {
1363
	label->sort(edges);
1363
        label->sort(edges);
1364 1364
      }
... ...
@@ -1366,26 +1366,26 @@
1366 1366
      for (int i = 0; i < static_cast<int>(edges.size()); ++i) {
1367
	Edge e = edges[i];
1368
	_writer_bits::writeToken(*_os, _node_index.
1369
				 find(_graph.u(e))->second);
1370
	*_os << '\t';
1371
	_writer_bits::writeToken(*_os, _node_index.
1372
				 find(_graph.v(e))->second);
1373
	*_os << '\t';
1374
	if (label == 0) {
1375
	  std::ostringstream os;
1376
	  os << _graph.id(e);
1377
	  _writer_bits::writeToken(*_os, os.str());
1378
	  *_os << '\t';
1379
	  _edge_index.insert(std::make_pair(e, os.str()));
1380
	}
1381
	for (typename EdgeMaps::iterator it = _edge_maps.begin();
1382
	     it != _edge_maps.end(); ++it) {
1383
	  std::string value = it->second->get(e);
1384
	  _writer_bits::writeToken(*_os, value);
1385
	  if (it->first == "label") {
1386
	    _edge_index.insert(std::make_pair(e, value));
1387
	  }
1388
	  *_os << '\t';
1389
	}
1390
	*_os << std::endl;
1367
        Edge e = edges[i];
1368
        _writer_bits::writeToken(*_os, _node_index.
1369
                                 find(_graph.u(e))->second);
1370
        *_os << '\t';
1371
        _writer_bits::writeToken(*_os, _node_index.
1372
                                 find(_graph.v(e))->second);
1373
        *_os << '\t';
1374
        if (label == 0) {
1375
          std::ostringstream os;
1376
          os << _graph.id(e);
1377
          _writer_bits::writeToken(*_os, os.str());
1378
          *_os << '\t';
1379
          _edge_index.insert(std::make_pair(e, os.str()));
1380
        }
1381
        for (typename EdgeMaps::iterator it = _edge_maps.begin();
1382
             it != _edge_maps.end(); ++it) {
1383
          std::string value = it->second->get(e);
1384
          _writer_bits::writeToken(*_os, value);
1385
          if (it->first == "label") {
1386
            _edge_index.insert(std::make_pair(e, value));
1387
          }
1388
          *_os << '\t';
1389
        }
1390
        *_os << std::endl;
1391 1391
      }
... ...
@@ -1396,7 +1396,7 @@
1396 1396
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
1397
	   it != _edge_maps.end(); ++it) {
1397
           it != _edge_maps.end(); ++it) {
1398 1398
        if (it->first == "label") {
1399
	  label = it->second;
1400
	  break;
1401
	}
1399
          label = it->second;
1400
          break;
1401
        }
1402 1402
      }
... ...
@@ -1404,12 +1404,12 @@
1404 1404
      if (label == 0) {
1405
	for (EdgeIt e(_graph); e != INVALID; ++e) {
1406
	  std::ostringstream os;
1407
	  os << _graph.id(e);
1408
	  _edge_index.insert(std::make_pair(e, os.str()));	  
1409
	}	
1405
        for (EdgeIt e(_graph); e != INVALID; ++e) {
1406
          std::ostringstream os;
1407
          os << _graph.id(e);
1408
          _edge_index.insert(std::make_pair(e, os.str()));
1409
        }
1410 1410
      } else {
1411
	for (EdgeIt e(_graph); e != INVALID; ++e) {
1412
	  std::string value = label->get(e);	  
1413
	  _edge_index.insert(std::make_pair(e, value));
1414
	}
1411
        for (EdgeIt e(_graph); e != INVALID; ++e) {
1412
          std::string value = label->get(e);
1413
          _edge_index.insert(std::make_pair(e, value));
1414
        }
1415 1415
      }
... ...
@@ -1421,3 +1421,3 @@
1421 1421
      if (!_attributes_caption.empty()) {
1422
	_writer_bits::writeToken(*_os << ' ', _attributes_caption);
1422
        _writer_bits::writeToken(*_os << ' ', _attributes_caption);
1423 1423
      }
... ...
@@ -1425,12 +1425,12 @@
1425 1425
      for (typename Attributes::iterator it = _attributes.begin();
1426
	   it != _attributes.end(); ++it) {
1427
	_writer_bits::writeToken(*_os, it->first) << ' ';
1428
	_writer_bits::writeToken(*_os, it->second->get());
1429
	*_os << std::endl;
1426
           it != _attributes.end(); ++it) {
1427
        _writer_bits::writeToken(*_os, it->first) << ' ';
1428
        _writer_bits::writeToken(*_os, it->second->get());
1429
        *_os << std::endl;
1430 1430
      }
1431 1431
    }
1432
    
1432

	
1433 1433
  public:
1434
    
1435
    /// \name Execution of the writer    
1434

	
1435
    /// \name Execution of the writer
1436 1436
    /// @{
... ...
@@ -1442,10 +1442,10 @@
1442 1442
      if (!_skip_nodes) {
1443
	writeNodes();
1443
        writeNodes();
1444 1444
      } else {
1445
	createNodeIndex();
1445
        createNodeIndex();
1446 1446
      }
1447
      if (!_skip_edges) {      
1448
	writeEdges();
1447
      if (!_skip_edges) {
1448
        writeEdges();
1449 1449
      } else {
1450
	createEdgeIndex();
1450
        createEdgeIndex();
1451 1451
      }
... ...
@@ -1465,3 +1465,3 @@
1465 1465
  /// \brief Return a \ref GraphWriter class
1466
  /// 
1466
  ///
1467 1467
  /// This function just returns a \ref GraphWriter class.
... ...
@@ -1475,3 +1475,3 @@
1475 1475
  /// \brief Return a \ref GraphWriter class
1476
  /// 
1476
  ///
1477 1477
  /// This function just returns a \ref GraphWriter class.
... ...
@@ -1485,3 +1485,3 @@
1485 1485
  /// \brief Return a \ref GraphWriter class
1486
  /// 
1486
  ///
1487 1487
  /// This function just returns a \ref GraphWriter class.
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -39,3 +39,3 @@
39 39
    };
40
 
40

	
41 41
    struct ArcT {
... ...
@@ -55,7 +55,7 @@
55 55
    int first_free_arc;
56
    
56

	
57 57
  public:
58
    
58

	
59 59
    typedef ListDigraphBase Digraph;
60
    
60

	
61 61
    class Node {
... ...
@@ -94,6 +94,6 @@
94 94
      : nodes(), first_node(-1),
95
	first_free_node(-1), arcs(), first_free_arc(-1) {}
95
        first_free_node(-1), arcs(), first_free_arc(-1) {}
96 96

	
97
    
98
    int maxNodeId() const { return nodes.size()-1; } 
97

	
98
    int maxNodeId() const { return nodes.size()-1; }
99 99
    int maxArcId() const { return arcs.size()-1; }
... ...
@@ -104,3 +104,3 @@
104 104

	
105
    void first(Node& node) const { 
105
    void first(Node& node) const {
106 106
      node.id = first_node;
... ...
@@ -113,7 +113,7 @@
113 113

	
114
    void first(Arc& arc) const { 
114
    void first(Arc& arc) const {
115 115
      int n;
116
      for(n = first_node; 
117
	  n!=-1 && nodes[n].first_in == -1; 
118
	  n = nodes[n].next) {}
116
      for(n = first_node;
117
          n!=-1 && nodes[n].first_in == -1;
118
          n = nodes[n].next) {}
119 119
      arc.id = (n == -1) ? -1 : nodes[n].first_in;
... ...
@@ -123,10 +123,10 @@
123 123
      if (arcs[arc.id].next_in != -1) {
124
	arc.id = arcs[arc.id].next_in;
124
        arc.id = arcs[arc.id].next_in;
125 125
      } else {
126
	int n;
127
	for(n = nodes[arcs[arc.id].target].next;
128
	    n!=-1 && nodes[n].first_in == -1; 
129
	    n = nodes[n].next) {}
130
	arc.id = (n == -1) ? -1 : nodes[n].first_in;
131
      }      
126
        int n;
127
        for(n = nodes[arcs[arc.id].target].next;
128
            n!=-1 && nodes[n].first_in == -1;
129
            n = nodes[n].next) {}
130
        arc.id = (n == -1) ? -1 : nodes[n].first_in;
131
      }
132 132
    }
... ...
@@ -147,3 +147,3 @@
147 147

	
148
    
148

	
149 149
    static int id(Node v) { return v.id; }
... ...
@@ -154,23 +154,23 @@
154 154

	
155
    bool valid(Node n) const { 
156
      return n.id >= 0 && n.id < static_cast<int>(nodes.size()) && 
157
	nodes[n.id].prev != -2;
155
    bool valid(Node n) const {
156
      return n.id >= 0 && n.id < static_cast<int>(nodes.size()) &&
157
        nodes[n.id].prev != -2;
158 158
    }
159 159

	
160
    bool valid(Arc a) const { 
161
      return a.id >= 0 && a.id < static_cast<int>(arcs.size()) && 
162
	arcs[a.id].prev_in != -2;
160
    bool valid(Arc a) const {
161
      return a.id >= 0 && a.id < static_cast<int>(arcs.size()) &&
162
        arcs[a.id].prev_in != -2;
163 163
    }
164 164

	
165
    Node addNode() {     
165
    Node addNode() {
166 166
      int n;
167
      
167

	
168 168
      if(first_free_node==-1) {
169
	n = nodes.size();
170
	nodes.push_back(NodeT());
169
        n = nodes.size();
170
        nodes.push_back(NodeT());
171 171
      } else {
172
	n = first_free_node;
173
	first_free_node = nodes[n].next;
172
        n = first_free_node;
173
        first_free_node = nodes[n].next;
174 174
      }
175
      
175

	
176 176
      nodes[n].next = first_node;
... ...
@@ -179,20 +179,20 @@
179 179
      nodes[n].prev = -1;
180
      
180

	
181 181
      nodes[n].first_in = nodes[n].first_out = -1;
182
      
182

	
183 183
      return Node(n);
184 184
    }
185
    
185

	
186 186
    Arc addArc(Node u, Node v) {
187
      int n;      
187
      int n;
188 188

	
189 189
      if (first_free_arc == -1) {
190
	n = arcs.size();
191
	arcs.push_back(ArcT());
190
        n = arcs.size();
191
        arcs.push_back(ArcT());
192 192
      } else {
193
	n = first_free_arc;
194
	first_free_arc = arcs[n].next_in;
193
        n = first_free_arc;
194
        first_free_arc = arcs[n].next_in;
195 195
      }
196
      
197
      arcs[n].source = u.id; 
196

	
197
      arcs[n].source = u.id;
198 198
      arcs[n].target = v.id;
... ...
@@ -201,12 +201,12 @@
201 201
      if(nodes[u.id].first_out != -1) {
202
	arcs[nodes[u.id].first_out].prev_out = n;
202
        arcs[nodes[u.id].first_out].prev_out = n;
203 203
      }
204
      
204

	
205 205
      arcs[n].next_in = nodes[v.id].first_in;
206 206
      if(nodes[v.id].first_in != -1) {
207
	arcs[nodes[v.id].first_in].prev_in = n;
207
        arcs[nodes[v.id].first_in].prev_in = n;
208 208
      }
209
      
209

	
210 210
      arcs[n].prev_in = arcs[n].prev_out = -1;
211
	
211

	
212 212
      nodes[u.id].first_out = nodes[v.id].first_in = n;
... ...
@@ -215,16 +215,16 @@
215 215
    }
216
    
216

	
217 217
    void erase(const Node& node) {
218 218
      int n = node.id;
219
      
219

	
220 220
      if(nodes[n].next != -1) {
221
	nodes[nodes[n].next].prev = nodes[n].prev;
221
        nodes[nodes[n].next].prev = nodes[n].prev;
222 222
      }
223
      
223

	
224 224
      if(nodes[n].prev != -1) {
225
	nodes[nodes[n].prev].next = nodes[n].next;
225
        nodes[nodes[n].prev].next = nodes[n].next;
226 226
      } else {
227
	first_node = nodes[n].next;
227
        first_node = nodes[n].next;
228 228
      }
229
      
229

	
230 230
      nodes[n].next = first_free_node;
... ...
@@ -234,8 +234,8 @@
234 234
    }
235
    
235

	
236 236
    void erase(const Arc& arc) {
237 237
      int n = arc.id;
238
      
238

	
239 239
      if(arcs[n].next_in!=-1) {
240
	arcs[arcs[n].next_in].prev_in = arcs[n].prev_in;
240
        arcs[arcs[n].next_in].prev_in = arcs[n].prev_in;
241 241
      }
... ...
@@ -243,18 +243,18 @@
243 243
      if(arcs[n].prev_in!=-1) {
244
	arcs[arcs[n].prev_in].next_in = arcs[n].next_in;
244
        arcs[arcs[n].prev_in].next_in = arcs[n].next_in;
245 245
      } else {
246
	nodes[arcs[n].target].first_in = arcs[n].next_in;
246
        nodes[arcs[n].target].first_in = arcs[n].next_in;
247 247
      }
248 248

	
249
      
249

	
250 250
      if(arcs[n].next_out!=-1) {
251
	arcs[arcs[n].next_out].prev_out = arcs[n].prev_out;
252
      } 
251
        arcs[arcs[n].next_out].prev_out = arcs[n].prev_out;
252
      }
253 253

	
254 254
      if(arcs[n].prev_out!=-1) {
255
	arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
255
        arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
256 256
      } else {
257
	nodes[arcs[n].source].first_out = arcs[n].next_out;
257
        nodes[arcs[n].source].first_out = arcs[n].next_out;
258 258
      }
259
      
259

	
260 260
      arcs[n].next_in = first_free_arc;
... ...
@@ -271,11 +271,11 @@
271 271
  protected:
272
    void changeTarget(Arc e, Node n) 
272
    void changeTarget(Arc e, Node n)
273 273
    {
274 274
      if(arcs[e.id].next_in != -1)
275
	arcs[arcs[e.id].next_in].prev_in = arcs[e.id].prev_in;
275
        arcs[arcs[e.id].next_in].prev_in = arcs[e.id].prev_in;
276 276
      if(arcs[e.id].prev_in != -1)
277
	arcs[arcs[e.id].prev_in].next_in = arcs[e.id].next_in;
277
        arcs[arcs[e.id].prev_in].next_in = arcs[e.id].next_in;
278 278
      else nodes[arcs[e.id].target].first_in = arcs[e.id].next_in;
279 279
      if (nodes[n.id].first_in != -1) {
280
	arcs[nodes[n.id].first_in].prev_in = e.id;
280
        arcs[nodes[n.id].first_in].prev_in = e.id;
281 281
      }
... ...
@@ -286,11 +286,11 @@
286 286
    }
287
    void changeSource(Arc e, Node n) 
287
    void changeSource(Arc e, Node n)
288 288
    {
289 289
      if(arcs[e.id].next_out != -1)
290
	arcs[arcs[e.id].next_out].prev_out = arcs[e.id].prev_out;
290
        arcs[arcs[e.id].next_out].prev_out = arcs[e.id].prev_out;
291 291
      if(arcs[e.id].prev_out != -1)
292
	arcs[arcs[e.id].prev_out].next_out = arcs[e.id].next_out;
292
        arcs[arcs[e.id].prev_out].next_out = arcs[e.id].next_out;
293 293
      else nodes[arcs[e.id].source].first_out = arcs[e.id].next_out;
294 294
      if (nodes[n.id].first_out != -1) {
295
	arcs[nodes[n.id].first_out].prev_out = e.id;
295
        arcs[nodes[n.id].first_out].prev_out = e.id;
296 296
      }
... ...
@@ -309,7 +309,7 @@
309 309

	
310
  ///A general directed graph structure. 
310
  ///A general directed graph structure.
311 311

	
312
  ///\ref ListDigraph is a simple and fast <em>directed graph</em> 
313
  ///implementation based on static linked lists that are stored in 
314
  ///\c std::vector structures.   
312
  ///\ref ListDigraph is a simple and fast <em>directed graph</em>
313
  ///implementation based on static linked lists that are stored in
314
  ///\c std::vector structures.
315 315
  ///
... ...
@@ -328,3 +328,3 @@
328 328
    ///ListDigraph is \e not copy constructible. Use copyDigraph() instead.
329
    
329

	
330 330
    ///ListDigraph is \e not copy constructible. Use copyDigraph() instead.
... ...
@@ -343,3 +343,3 @@
343 343
    /// Constructor
344
    
344

	
345 345
    /// Constructor.
... ...
@@ -349,3 +349,3 @@
349 349
    ///Add a new node to the digraph.
350
    
350

	
351 351
    ///Add a new node to the digraph.
... ...
@@ -355,3 +355,3 @@
355 355
    ///Add a new arc to the digraph.
356
    
356

	
357 357
    ///Add a new arc to the digraph with source node \c s
... ...
@@ -359,4 +359,4 @@
359 359
    ///\return the new arc.
360
    Arc addArc(const Node& s, const Node& t) { 
361
      return Parent::addArc(s, t); 
360
    Arc addArc(const Node& s, const Node& t) {
361
      return Parent::addArc(s, t);
362 362
    }
... ...
@@ -366,3 +366,3 @@
366 366
    /// This function gives back true if the given node is valid,
367
    /// ie. it is a real node of the graph.  
367
    /// ie. it is a real node of the graph.
368 368
    ///
... ...
@@ -376,3 +376,3 @@
376 376
    /// This function gives back true if the given arc is valid,
377
    /// ie. it is a real arc of the graph.  
377
    /// ie. it is a real arc of the graph.
378 378
    ///
... ...
@@ -393,4 +393,4 @@
393 393
    ///feature.
394
    void changeTarget(Arc e, Node n) { 
395
      Parent::changeTarget(e,n); 
394
    void changeTarget(Arc e, Node n) {
395
      Parent::changeTarget(e,n);
396 396
    }
... ...
@@ -406,3 +406,3 @@
406 406
    ///feature.
407
    void changeSource(Arc e, Node n) { 
407
    void changeSource(Arc e, Node n) {
408 408
      Parent::changeSource(e,n);
... ...
@@ -458,17 +458,17 @@
458 458
    ///feature.
459
    void contract(Node a, Node b, bool r = true) 
459
    void contract(Node a, Node b, bool r = true)
460 460
    {
461 461
      for(OutArcIt e(*this,b);e!=INVALID;) {
462
	OutArcIt f=e;
463
	++f;
464
	if(r && target(e)==a) erase(e);
465
	else changeSource(e,a);
466
	e=f;
462
        OutArcIt f=e;
463
        ++f;
464
        if(r && target(e)==a) erase(e);
465
        else changeSource(e,a);
466
        e=f;
467 467
      }
468 468
      for(InArcIt e(*this,b);e!=INVALID;) {
469
	InArcIt f=e;
470
	++f;
471
	if(r && source(e)==a) erase(e);
472
	else changeTarget(e,a);
473
	e=f;
469
        InArcIt f=e;
470
        ++f;
471
        if(r && source(e)==a) erase(e);
472
        else changeTarget(e,a);
473
        e=f;
474 474
      }
... ...
@@ -487,3 +487,3 @@
487 487
    ///valid. However <tt>InArcIt</tt>s and <tt>OutArcIt</tt>s may
488
    ///be invalidated.  
488
    ///be invalidated.
489 489
    ///
... ...
@@ -496,6 +496,6 @@
496 496
      for(OutArcIt e(*this,n);e!=INVALID;) {
497
 	OutArcIt f=e;
498
	++f;
499
	changeSource(e,b);
500
	e=f;
497
         OutArcIt f=e;
498
        ++f;
499
        changeSource(e,b);
500
        e=f;
501 501
      }
... ...
@@ -504,3 +504,3 @@
504 504
    }
505
      
505

	
506 506
    ///Split an arc.
... ...
@@ -521,3 +521,3 @@
521 521
    }
522
      
522

	
523 523
    /// \brief Class to make a snapshot of the digraph and restore
... ...
@@ -531,4 +531,4 @@
531 531
    /// \warning Arc and node deletions and other modifications (e.g.
532
    /// contracting, splitting, reversing arcs or nodes) cannot be 
533
    /// restored. These events invalidate the snapshot. 
532
    /// contracting, splitting, reversing arcs or nodes) cannot be
533
    /// restored. These events invalidate the snapshot.
534 534
    class Snapshot {
... ...
@@ -547,5 +547,5 @@
547 547
        using NodeNotifier::ObserverBase::attached;
548
        
548

	
549 549
      protected:
550
        
550

	
551 551
        virtual void add(const Node& node) {
... ...
@@ -569,3 +569,3 @@
569 569
          std::vector<Node> nodes;
570
          for (notifier()->first(node); node != INVALID; 
570
          for (notifier()->first(node); node != INVALID;
571 571
               notifier()->next(node)) {
... ...
@@ -579,3 +579,3 @@
579 579
          Node node;
580
          for (notifier()->first(node); node != INVALID; 
580
          for (notifier()->first(node); node != INVALID;
581 581
               notifier()->next(node)) {
... ...
@@ -597,3 +597,3 @@
597 597
        using ArcNotifier::ObserverBase::attached;
598
        
598

	
599 599
      protected:
... ...
@@ -619,3 +619,3 @@
619 619
          std::vector<Arc> arcs;
620
          for (notifier()->first(arc); arc != INVALID; 
620
          for (notifier()->first(arc); arc != INVALID;
621 621
               notifier()->next(arc)) {
... ...
@@ -629,3 +629,3 @@
629 629
          Arc arc;
630
          for (notifier()->first(arc); arc != INVALID; 
630
          for (notifier()->first(arc); arc != INVALID;
631 631
               notifier()->next(arc)) {
... ...
@@ -637,3 +637,3 @@
637 637
      };
638
      
638

	
639 639
      ListDigraph *digraph;
... ...
@@ -648,6 +648,6 @@
648 648
      void addNode(const Node& node) {
649
        added_nodes.push_front(node);        
649
        added_nodes.push_front(node);
650 650
      }
651 651
      void eraseNode(const Node& node) {
652
        std::list<Node>::iterator it = 
652
        std::list<Node>::iterator it =
653 653
          std::find(added_nodes.begin(), added_nodes.end(), node);
... ...
@@ -663,6 +663,6 @@
663 663
      void addArc(const Arc& arc) {
664
        added_arcs.push_front(arc);        
664
        added_arcs.push_front(arc);
665 665
      }
666 666
      void eraseArc(const Arc& arc) {
667
        std::list<Arc>::iterator it = 
667
        std::list<Arc>::iterator it =
668 668
          std::find(added_arcs.begin(), added_arcs.end(), arc);
... ...
@@ -670,3 +670,3 @@
670 670
          clear();
671
          node_observer_proxy.detach(); 
671
          node_observer_proxy.detach();
672 672
          throw ArcNotifier::ImmediateDetach();
... ...
@@ -674,3 +674,3 @@
674 674
          added_arcs.erase(it);
675
        }        
675
        }
676 676
      }
... ...
@@ -678,10 +678,10 @@
678 678
      void attach(ListDigraph &_digraph) {
679
	digraph = &_digraph;
680
	node_observer_proxy.attach(digraph->notifier(Node()));
679
        digraph = &_digraph;
680
        node_observer_proxy.attach(digraph->notifier(Node()));
681 681
        arc_observer_proxy.attach(digraph->notifier(Arc()));
682 682
      }
683
            
683

	
684 684
      void detach() {
685
	node_observer_proxy.detach();
686
	arc_observer_proxy.detach();
685
        node_observer_proxy.detach();
686
        arc_observer_proxy.detach();
687 687
      }
... ...
@@ -694,3 +694,3 @@
694 694
        added_nodes.clear();
695
        added_arcs.clear();        
695
        added_arcs.clear();
696 696
      }
... ...
@@ -703,16 +703,16 @@
703 703
      /// To actually make a snapshot you must call save().
704
      Snapshot() 
705
        : digraph(0), node_observer_proxy(*this), 
704
      Snapshot()
705
        : digraph(0), node_observer_proxy(*this),
706 706
          arc_observer_proxy(*this) {}
707
      
707

	
708 708
      /// \brief Constructor that immediately makes a snapshot.
709
      ///      
709
      ///
710 710
      /// This constructor immediately makes a snapshot of the digraph.
711 711
      /// \param _digraph The digraph we make a snapshot of.
712
      Snapshot(ListDigraph &_digraph) 
713
        : node_observer_proxy(*this), 
712
      Snapshot(ListDigraph &_digraph)
713
        : node_observer_proxy(*this),
714 714
          arc_observer_proxy(*this) {
715
	attach(_digraph);
715
        attach(_digraph);
716 716
      }
717
      
717

	
718 718
      /// \brief Make a snapshot.
... ...
@@ -731,16 +731,16 @@
731 731
      }
732
      
732

	
733 733
      /// \brief Undo the changes until the last snapshot.
734
      // 
734
      //
735 735
      /// Undo the changes until the last snapshot created by save().
736 736
      void restore() {
737
	detach();
738
	for(std::list<Arc>::iterator it = added_arcs.begin(); 
737
        detach();
738
        for(std::list<Arc>::iterator it = added_arcs.begin();
739 739
            it != added_arcs.end(); ++it) {
740
	  digraph->erase(*it);
741
	}
742
	for(std::list<Node>::iterator it = added_nodes.begin(); 
740
          digraph->erase(*it);
741
        }
742
        for(std::list<Node>::iterator it = added_nodes.begin();
743 743
            it != added_nodes.end(); ++it) {
744
	  digraph->erase(*it);
745
	}
744
          digraph->erase(*it);
745
        }
746 746
        clear();
... ...
@@ -755,3 +755,3 @@
755 755
    };
756
    
756

	
757 757
  };
... ...
@@ -768,3 +768,3 @@
768 768
    };
769
 
769

	
770 770
    struct ArcT {
... ...
@@ -783,5 +783,5 @@
783 783
    int first_free_arc;
784
    
784

	
785 785
  public:
786
    
786

	
787 787
    typedef ListGraphBase Digraph;
... ...
@@ -791,3 +791,3 @@
791 791
    class Edge;
792
    
792

	
793 793
    class Node {
... ...
@@ -843,6 +843,6 @@
843 843
      : nodes(), first_node(-1),
844
	first_free_node(-1), arcs(), first_free_arc(-1) {}
844
        first_free_node(-1), arcs(), first_free_arc(-1) {}
845 845

	
846
    
847
    int maxNodeId() const { return nodes.size()-1; } 
846

	
847
    int maxNodeId() const { return nodes.size()-1; }
848 848
    int maxEdgeId() const { return arcs.size() / 2 - 1; }
... ...
@@ -864,3 +864,3 @@
864 864

	
865
    void first(Node& node) const { 
865
    void first(Node& node) const {
866 866
      node.id = first_node;
... ...
@@ -872,3 +872,3 @@
872 872

	
873
    void first(Arc& e) const { 
873
    void first(Arc& e) const {
874 874
      int n = first_node;
... ...
@@ -882,5 +882,5 @@
882 882
      if (arcs[e.id].next_out != -1) {
883
	e.id = arcs[e.id].next_out;
883
        e.id = arcs[e.id].next_out;
884 884
      } else {
885
	int n = nodes[arcs[e.id ^ 1].target].next;
885
        int n = nodes[arcs[e.id ^ 1].target].next;
886 886
        while(n != -1 && nodes[n].first_out == -1) {
... ...
@@ -888,7 +888,7 @@
888 888
        }
889
	e.id = (n == -1) ? -1 : nodes[n].first_out;
890
      }      
889
        e.id = (n == -1) ? -1 : nodes[n].first_out;
890
      }
891 891
    }
892 892

	
893
    void first(Edge& e) const { 
893
    void first(Edge& e) const {
894 894
      int n = first_node;
... ...
@@ -902,3 +902,3 @@
902 902
          return;
903
        } 
903
        }
904 904
        n = nodes[n].next;
... ...
@@ -917,3 +917,3 @@
917 917
        return;
918
      } 
918
      }
919 919
      n = nodes[n].next;
... ...
@@ -927,3 +927,3 @@
927 927
          return;
928
        } 
928
        }
929 929
        n = nodes[n].next;
... ...
@@ -969,3 +969,3 @@
969 969
    }
970
    
970

	
971 971
    static int id(Node v) { return v.id; }
... ...
@@ -978,28 +978,28 @@
978 978

	
979
    bool valid(Node n) const { 
980
      return n.id >= 0 && n.id < static_cast<int>(nodes.size()) && 
981
	nodes[n.id].prev != -2;
979
    bool valid(Node n) const {
980
      return n.id >= 0 && n.id < static_cast<int>(nodes.size()) &&
981
        nodes[n.id].prev != -2;
982 982
    }
983 983

	
984
    bool valid(Arc a) const { 
985
      return a.id >= 0 && a.id < static_cast<int>(arcs.size()) && 
986
	arcs[a.id].prev_out != -2;
984
    bool valid(Arc a) const {
985
      return a.id >= 0 && a.id < static_cast<int>(arcs.size()) &&
986
        arcs[a.id].prev_out != -2;
987 987
    }
988 988

	
989
    bool valid(Edge e) const { 
990
      return e.id >= 0 && 2 * e.id < static_cast<int>(arcs.size()) && 
991
	arcs[2 * e.id].prev_out != -2;
989
    bool valid(Edge e) const {
990
      return e.id >= 0 && 2 * e.id < static_cast<int>(arcs.size()) &&
991
        arcs[2 * e.id].prev_out != -2;
992 992
    }
993 993

	
994
    Node addNode() {     
994
    Node addNode() {
995 995
      int n;
996
      
996

	
997 997
      if(first_free_node==-1) {
998
	n = nodes.size();
999
	nodes.push_back(NodeT());
998
        n = nodes.size();
999
        nodes.push_back(NodeT());
1000 1000
      } else {
1001
	n = first_free_node;
1002
	first_free_node = nodes[n].next;
1001
        n = first_free_node;
1002
        first_free_node = nodes[n].next;
1003 1003
      }
1004
      
1004

	
1005 1005
      nodes[n].next = first_node;
... ...
@@ -1008,20 +1008,20 @@
1008 1008
      nodes[n].prev = -1;
1009
      
1009

	
1010 1010
      nodes[n].first_out = -1;
1011
      
1011

	
1012 1012
      return Node(n);
1013 1013
    }
1014
    
1014

	
1015 1015
    Edge addEdge(Node u, Node v) {
1016
      int n;      
1016
      int n;
1017 1017

	
1018 1018
      if (first_free_arc == -1) {
1019
	n = arcs.size();
1020
	arcs.push_back(ArcT());
1021
	arcs.push_back(ArcT());
1019
        n = arcs.size();
1020
        arcs.push_back(ArcT());
1021
        arcs.push_back(ArcT());
1022 1022
      } else {
1023
	n = first_free_arc;
1024
	first_free_arc = arcs[n].next_out;
1023
        n = first_free_arc;
1024
        first_free_arc = arcs[n].next_out;
1025 1025
      }
1026
      
1026

	
1027 1027
      arcs[n].target = u.id;
... ...
@@ -1031,12 +1031,12 @@
1031 1031
      if (nodes[v.id].first_out != -1) {
1032
	arcs[nodes[v.id].first_out].prev_out = n;
1033
      }      
1032
        arcs[nodes[v.id].first_out].prev_out = n;
1033
      }
1034 1034
      arcs[n].prev_out = -1;
1035 1035
      nodes[v.id].first_out = n;
1036
      
1036

	
1037 1037
      arcs[n | 1].next_out = nodes[u.id].first_out;
1038 1038
      if (nodes[u.id].first_out != -1) {
1039
	arcs[nodes[u.id].first_out].prev_out = (n | 1);
1039
        arcs[nodes[u.id].first_out].prev_out = (n | 1);
1040 1040
      }
1041
      arcs[n | 1].prev_out = -1;      
1041
      arcs[n | 1].prev_out = -1;
1042 1042
      nodes[u.id].first_out = (n | 1);
... ...
@@ -1045,16 +1045,16 @@
1045 1045
    }
1046
    
1046

	
1047 1047
    void erase(const Node& node) {
1048 1048
      int n = node.id;
1049
      
1049

	
1050 1050
      if(nodes[n].next != -1) {
1051
	nodes[nodes[n].next].prev = nodes[n].prev;
1051
        nodes[nodes[n].next].prev = nodes[n].prev;
1052 1052
      }
1053
      
1053

	
1054 1054
      if(nodes[n].prev != -1) {
1055
	nodes[nodes[n].prev].next = nodes[n].next;
1055
        nodes[nodes[n].prev].next = nodes[n].next;
1056 1056
      } else {
1057
	first_node = nodes[n].next;
1057
        first_node = nodes[n].next;
1058 1058
      }
1059
      
1059

	
1060 1060
      nodes[n].next = first_free_node;
... ...
@@ -1063,14 +1063,14 @@
1063 1063
    }
1064
    
1064

	
1065 1065
    void erase(const Edge& edge) {
1066 1066
      int n = edge.id * 2;
1067
      
1067

	
1068 1068
      if (arcs[n].next_out != -1) {
1069
	arcs[arcs[n].next_out].prev_out = arcs[n].prev_out;
1070
      } 
1069
        arcs[arcs[n].next_out].prev_out = arcs[n].prev_out;
1070
      }
1071 1071

	
1072 1072
      if (arcs[n].prev_out != -1) {
1073
	arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
1073
        arcs[arcs[n].prev_out].next_out = arcs[n].next_out;
1074 1074
      } else {
1075
	nodes[arcs[n | 1].target].first_out = arcs[n].next_out;
1075
        nodes[arcs[n | 1].target].first_out = arcs[n].next_out;
1076 1076
      }
... ...
@@ -1078,13 +1078,13 @@
1078 1078
      if (arcs[n | 1].next_out != -1) {
1079
	arcs[arcs[n | 1].next_out].prev_out = arcs[n | 1].prev_out;
1080
      } 
1079
        arcs[arcs[n | 1].next_out].prev_out = arcs[n | 1].prev_out;
1080
      }
1081 1081

	
1082 1082
      if (arcs[n | 1].prev_out != -1) {
1083
	arcs[arcs[n | 1].prev_out].next_out = arcs[n | 1].next_out;
1083
        arcs[arcs[n | 1].prev_out].next_out = arcs[n | 1].next_out;
1084 1084
      } else {
1085
	nodes[arcs[n].target].first_out = arcs[n | 1].next_out;
1085
        nodes[arcs[n].target].first_out = arcs[n | 1].next_out;
1086 1086
      }
1087
      
1087

	
1088 1088
      arcs[n].next_out = first_free_arc;
1089
      first_free_arc = n;      
1089
      first_free_arc = n;
1090 1090
      arcs[n].prev_out = -2;
... ...
@@ -1104,9 +1104,9 @@
1104 1104
      if(arcs[2 * e.id].next_out != -1) {
1105
	arcs[arcs[2 * e.id].next_out].prev_out = arcs[2 * e.id].prev_out;
1105
        arcs[arcs[2 * e.id].next_out].prev_out = arcs[2 * e.id].prev_out;
1106 1106
      }
1107 1107
      if(arcs[2 * e.id].prev_out != -1) {
1108
	arcs[arcs[2 * e.id].prev_out].next_out = 
1108
        arcs[arcs[2 * e.id].prev_out].next_out =
1109 1109
          arcs[2 * e.id].next_out;
1110 1110
      } else {
1111
        nodes[arcs[(2 * e.id) | 1].target].first_out = 
1111
        nodes[arcs[(2 * e.id) | 1].target].first_out =
1112 1112
          arcs[2 * e.id].next_out;
... ...
@@ -1115,3 +1115,3 @@
1115 1115
      if (nodes[n.id].first_out != -1) {
1116
	arcs[nodes[n.id].first_out].prev_out = 2 * e.id;
1116
        arcs[nodes[n.id].first_out].prev_out = 2 * e.id;
1117 1117
      }
... ...
@@ -1125,3 +1125,3 @@
1125 1125
      if(arcs[(2 * e.id) | 1].next_out != -1) {
1126
	arcs[arcs[(2 * e.id) | 1].next_out].prev_out = 
1126
        arcs[arcs[(2 * e.id) | 1].next_out].prev_out =
1127 1127
          arcs[(2 * e.id) | 1].prev_out;
... ...
@@ -1129,6 +1129,6 @@
1129 1129
      if(arcs[(2 * e.id) | 1].prev_out != -1) {
1130
	arcs[arcs[(2 * e.id) | 1].prev_out].next_out = 
1130
        arcs[arcs[(2 * e.id) | 1].prev_out].next_out =
1131 1131
          arcs[(2 * e.id) | 1].next_out;
1132 1132
      } else {
1133
        nodes[arcs[2 * e.id].target].first_out = 
1133
        nodes[arcs[2 * e.id].target].first_out =
1134 1134
          arcs[(2 * e.id) | 1].next_out;
... ...
@@ -1137,3 +1137,3 @@
1137 1137
      if (nodes[n.id].first_out != -1) {
1138
	arcs[nodes[n.id].first_out].prev_out = ((2 * e.id) | 1);
1138
        arcs[nodes[n.id].first_out].prev_out = ((2 * e.id) | 1);
1139 1139
      }
... ...
@@ -1155,5 +1155,5 @@
1155 1155

	
1156
  ///\ref ListGraph is a simple and fast <em>undirected graph</em> 
1157
  ///implementation based on static linked lists that are stored in 
1158
  ///\c std::vector structures. 
1156
  ///\ref ListGraph is a simple and fast <em>undirected graph</em>
1157
  ///implementation based on static linked lists that are stored in
1158
  ///\c std::vector structures.
1159 1159
  ///
... ...
@@ -1184,3 +1184,3 @@
1184 1184
    /// Constructor
1185
    
1185

	
1186 1186
    /// Constructor.
... ...
@@ -1204,4 +1204,4 @@
1204 1204
    /// \return the new edge.
1205
    Edge addEdge(const Node& s, const Node& t) { 
1206
      return Parent::addEdge(s, t); 
1205
    Edge addEdge(const Node& s, const Node& t) {
1206
      return Parent::addEdge(s, t);
1207 1207
    }
... ...
@@ -1210,3 +1210,3 @@
1210 1210
    /// This function gives back true if the given node is valid,
1211
    /// ie. it is a real node of the graph.  
1211
    /// ie. it is a real node of the graph.
1212 1212
    ///
... ...
@@ -1219,3 +1219,3 @@
1219 1219
    /// This function gives back true if the given arc is valid,
1220
    /// ie. it is a real arc of the graph.  
1220
    /// ie. it is a real arc of the graph.
1221 1221
    ///
... ...
@@ -1228,3 +1228,3 @@
1228 1228
    /// This function gives back true if the given edge is valid,
1229
    /// ie. it is a real arc of the graph.  
1229
    /// ie. it is a real arc of the graph.
1230 1230
    ///
... ...
@@ -1244,5 +1244,5 @@
1244 1244
    ///Snapshot feature.
1245
    void changeSource(Edge e, Node n) { 
1246
      Parent::changeSource(e,n); 
1247
    }    
1245
    void changeSource(Edge e, Node n) {
1246
      Parent::changeSource(e,n);
1247
    }
1248 1248
    /// \brief Change the target of \c e to \c n
... ...
@@ -1256,4 +1256,4 @@
1256 1256
    ///Snapshot feature.
1257
    void changeTarget(Edge e, Node n) { 
1258
      Parent::changeTarget(e,n); 
1257
    void changeTarget(Edge e, Node n) {
1258
      Parent::changeTarget(e,n);
1259 1259
    }
... ...
@@ -1261,3 +1261,3 @@
1261 1261
    ///
1262
    /// This function changes the source of \c e to \c n. 
1262
    /// This function changes the source of \c e to \c n.
1263 1263
    /// It also changes the proper node of the represented edge.
... ...
@@ -1270,3 +1270,3 @@
1270 1270
    ///Snapshot feature.
1271
    void changeSource(Arc e, Node n) { 
1271
    void changeSource(Arc e, Node n) {
1272 1272
      if (Parent::direction(e)) {
... ...
@@ -1275,3 +1275,3 @@
1275 1275
        Parent::changeTarget(e,n);
1276
      } 
1276
      }
1277 1277
    }
... ...
@@ -1279,3 +1279,3 @@
1279 1279
    ///
1280
    /// This function changes the target of \c e to \c n. 
1280
    /// This function changes the target of \c e to \c n.
1281 1281
    /// It also changes the proper node of the represented edge.
... ...
@@ -1288,3 +1288,3 @@
1288 1288
    ///Snapshot feature.
1289
    void changeTarget(Arc e, Node n) { 
1289
    void changeTarget(Arc e, Node n) {
1290 1290
      if (Parent::direction(e)) {
... ...
@@ -1293,3 +1293,3 @@
1293 1293
        Parent::changeSource(e,n);
1294
      } 
1294
      }
1295 1295
    }
... ...
@@ -1310,11 +1310,11 @@
1310 1310
      for(IncEdgeIt e(*this, b); e!=INVALID;) {
1311
	IncEdgeIt f = e; ++f;
1312
	if (r && runningNode(e) == a) {
1313
	  erase(e);
1314
	} else if (source(e) == b) {
1315
	  changeSource(e, a);
1316
	} else {
1317
	  changeTarget(e, a);
1318
	}
1319
	e = f;
1311
        IncEdgeIt f = e; ++f;
1312
        if (r && runningNode(e) == a) {
1313
          erase(e);
1314
        } else if (source(e) == b) {
1315
          changeSource(e, a);
1316
        } else {
1317
          changeTarget(e, a);
1318
        }
1319
        e = f;
1320 1320
      }
... ...
@@ -1333,3 +1333,3 @@
1333 1333
    /// \warning Edge and node deletions and other modifications
1334
    /// (e.g. changing nodes of edges, contracting nodes) cannot be 
1334
    /// (e.g. changing nodes of edges, contracting nodes) cannot be
1335 1335
    /// restored. These events invalidate the snapshot.
... ...
@@ -1349,5 +1349,5 @@
1349 1349
        using NodeNotifier::ObserverBase::attached;
1350
        
1350

	
1351 1351
      protected:
1352
        
1352

	
1353 1353
        virtual void add(const Node& node) {
... ...
@@ -1371,3 +1371,3 @@
1371 1371
          std::vector<Node> nodes;
1372
          for (notifier()->first(node); node != INVALID; 
1372
          for (notifier()->first(node); node != INVALID;
1373 1373
               notifier()->next(node)) {
... ...
@@ -1381,3 +1381,3 @@
1381 1381
          Node node;
1382
          for (notifier()->first(node); node != INVALID; 
1382
          for (notifier()->first(node); node != INVALID;
1383 1383
               notifier()->next(node)) {
... ...
@@ -1399,3 +1399,3 @@
1399 1399
        using EdgeNotifier::ObserverBase::attached;
1400
        
1400

	
1401 1401
      protected:
... ...
@@ -1421,3 +1421,3 @@
1421 1421
          std::vector<Edge> edges;
1422
          for (notifier()->first(edge); edge != INVALID; 
1422
          for (notifier()->first(edge); edge != INVALID;
1423 1423
               notifier()->next(edge)) {
... ...
@@ -1431,3 +1431,3 @@
1431 1431
          Edge edge;
1432
          for (notifier()->first(edge); edge != INVALID; 
1432
          for (notifier()->first(edge); edge != INVALID;
1433 1433
               notifier()->next(edge)) {
... ...
@@ -1450,6 +1450,6 @@
1450 1450
      void addNode(const Node& node) {
1451
        added_nodes.push_front(node);        
1451
        added_nodes.push_front(node);
1452 1452
      }
1453 1453
      void eraseNode(const Node& node) {
1454
        std::list<Node>::iterator it = 
1454
        std::list<Node>::iterator it =
1455 1455
          std::find(added_nodes.begin(), added_nodes.end(), node);
... ...
@@ -1465,6 +1465,6 @@
1465 1465
      void addEdge(const Edge& edge) {
1466
        added_edges.push_front(edge);        
1466
        added_edges.push_front(edge);
1467 1467
      }
1468 1468
      void eraseEdge(const Edge& edge) {
1469
        std::list<Edge>::iterator it = 
1469
        std::list<Edge>::iterator it =
1470 1470
          std::find(added_edges.begin(), added_edges.end(), edge);
... ...
@@ -1480,10 +1480,10 @@
1480 1480
      void attach(ListGraph &_graph) {
1481
	graph = &_graph;
1482
	node_observer_proxy.attach(graph->notifier(Node()));
1481
        graph = &_graph;
1482
        node_observer_proxy.attach(graph->notifier(Node()));
1483 1483
        edge_observer_proxy.attach(graph->notifier(Edge()));
1484 1484
      }
1485
            
1485

	
1486 1486
      void detach() {
1487
	node_observer_proxy.detach();
1488
	edge_observer_proxy.detach();
1487
        node_observer_proxy.detach();
1488
        edge_observer_proxy.detach();
1489 1489
      }
... ...
@@ -1496,3 +1496,3 @@
1496 1496
        added_nodes.clear();
1497
        added_edges.clear();        
1497
        added_edges.clear();
1498 1498
      }
... ...
@@ -1505,16 +1505,16 @@
1505 1505
      /// To actually make a snapshot you must call save().
1506
      Snapshot() 
1507
        : graph(0), node_observer_proxy(*this), 
1506
      Snapshot()
1507
        : graph(0), node_observer_proxy(*this),
1508 1508
          edge_observer_proxy(*this) {}
1509
      
1509

	
1510 1510
      /// \brief Constructor that immediately makes a snapshot.
1511
      ///      
1511
      ///
1512 1512
      /// This constructor immediately makes a snapshot of the graph.
1513 1513
      /// \param _graph The graph we make a snapshot of.
1514
      Snapshot(ListGraph &_graph) 
1515
        : node_observer_proxy(*this), 
1514
      Snapshot(ListGraph &_graph)
1515
        : node_observer_proxy(*this),
1516 1516
          edge_observer_proxy(*this) {
1517
	attach(_graph);
1517
        attach(_graph);
1518 1518
      }
1519
      
1519

	
1520 1520
      /// \brief Make a snapshot.
... ...
@@ -1533,16 +1533,16 @@
1533 1533
      }
1534
      
1534

	
1535 1535
      /// \brief Undo the changes until the last snapshot.
1536
      // 
1536
      //
1537 1537
      /// Undo the changes until the last snapshot created by save().
1538 1538
      void restore() {
1539
	detach();
1540
	for(std::list<Edge>::iterator it = added_edges.begin(); 
1539
        detach();
1540
        for(std::list<Edge>::iterator it = added_edges.begin();
1541 1541
            it != added_edges.end(); ++it) {
1542
	  graph->erase(*it);
1543
	}
1544
	for(std::list<Node>::iterator it = added_nodes.begin(); 
1542
          graph->erase(*it);
1543
        }
1544
        for(std::list<Node>::iterator it = added_nodes.begin();
1545 1545
            it != added_nodes.end(); ++it) {
1546
	  graph->erase(*it);
1547
	}
1546
          graph->erase(*it);
1547
        }
1548 1548
        clear();
... ...
@@ -1558,6 +1558,6 @@
1558 1558
  };
1559
  
1560
  /// @}  
1559

	
1560
  /// @}
1561 1561
} //namespace lemon
1562
  
1562

	
1563 1563

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -406,5 +406,5 @@
406 406
      if (it != _map.end() && !_map.key_comp()(k, it->first))
407
	return it->second;
407
        return it->second;
408 408
      else
409
	return _map.insert(it, std::make_pair(k, _value))->second;
409
        return _map.insert(it, std::make_pair(k, _value))->second;
410 410
    }
... ...
@@ -415,5 +415,5 @@
415 415
      if (it != _map.end())
416
	return it->second;
416
        return it->second;
417 417
      else
418
	return _value;
418
        return _value;
419 419
    }
... ...
@@ -424,5 +424,5 @@
424 424
      if (it != _map.end() && !_map.key_comp()(k, it->first))
425
	it->second = v;
425
        it->second = v;
426 426
      else
427
	_map.insert(it, std::make_pair(k, v));
427
        _map.insert(it, std::make_pair(k, v));
428 428
    }
... ...
@@ -546,3 +546,3 @@
546 546
  template<typename M1, typename M2, typename F,
547
	   typename V = typename F::result_type>
547
           typename V = typename F::result_type>
548 548
  class CombineMap : public MapBase<typename M1::Key, V> {
... ...
@@ -617,4 +617,4 @@
617 617
  template<typename F,
618
	   typename K = typename F::argument_type,
619
	   typename V = typename F::result_type>
618
           typename K = typename F::argument_type,
619
           typename V = typename F::result_type>
620 620
  class FunctorToMap : public MapBase<K, V> {
... ...
@@ -1319,3 +1319,3 @@
1319 1319
  /// @}
1320
  
1320

	
1321 1321
  // Logical maps and map adaptors:
... ...
@@ -1717,3 +1717,3 @@
1717 1717
  template <typename It,
1718
	    typename Ke=typename _maps_bits::IteratorTraits<It>::Value>
1718
            typename Ke=typename _maps_bits::IteratorTraits<It>::Value>
1719 1719
#endif
... ...
@@ -1743,3 +1743,3 @@
1743 1743
      if (value) {
1744
	*_end++ = key;
1744
        *_end++ = key;
1745 1745
      }
... ...
@@ -1751,3 +1751,3 @@
1751 1751
  };
1752
  
1752

	
1753 1753
  /// Returns a \ref LoggerBoolMap class
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -35,3 +35,3 @@
35 35
  /// @{
36
  
36

	
37 37
  /// The Euler constant
... ...
@@ -56,3 +56,3 @@
56 56
  const long double SQRT1_2 = 0.7071067811865475244008443621048490L;
57
  
57

	
58 58

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -95,3 +95,3 @@
95 95
      /// \brief Initializate the iterator to the first arc of path
96
      ArcIt(const Path &_path) 
96
      ArcIt(const Path &_path)
97 97
        : path(&_path), idx(_path.empty() ? -1 : 0) {}
... ...
@@ -100,3 +100,3 @@
100 100

	
101
      ArcIt(const Path &_path, int _idx) 
101
      ArcIt(const Path &_path, int _idx)
102 102
        : path(&_path), idx(_idx) {}
... ...
@@ -111,6 +111,6 @@
111 111
      /// \brief Next arc
112
      ArcIt& operator++() { 
112
      ArcIt& operator++() {
113 113
        ++idx;
114
        if (idx >= path->length()) idx = -1; 
115
        return *this; 
114
        if (idx >= path->length()) idx = -1;
115
        return *this;
116 116
      }
... ...
@@ -286,3 +286,3 @@
286 286
      /// \brief Initializate the constructor to the first arc of path
287
      ArcIt(const SimplePath &_path) 
287
      ArcIt(const SimplePath &_path)
288 288
        : path(&_path), idx(_path.empty() ? -1 : 0) {}
... ...
@@ -292,3 +292,3 @@
292 292
      /// Constructor with starting point
293
      ArcIt(const SimplePath &_path, int _idx) 
293
      ArcIt(const SimplePath &_path, int _idx)
294 294
        : idx(_idx), path(&_path) {}
... ...
@@ -303,6 +303,6 @@
303 303
      /// Next arc
304
      ArcIt& operator++() { 
304
      ArcIt& operator++() {
305 305
        ++idx;
306
        if (idx >= path->length()) idx = -1; 
307
        return *this; 
306
        if (idx >= path->length()) idx = -1;
307
        return *this;
308 308
      }
... ...
@@ -415,3 +415,3 @@
415 415

	
416
    // the std::list<> is incompatible 
416
    // the std::list<> is incompatible
417 417
    // hard to create invalid iterator
... ...
@@ -427,3 +427,3 @@
427 427
  public:
428
 
428

	
429 429
    /// \brief Default constructor
... ...
@@ -472,3 +472,3 @@
472 472
      /// \brief Initializate the constructor to the first arc of path
473
      ArcIt(const ListPath &_path) 
473
      ArcIt(const ListPath &_path)
474 474
        : path(&_path), node(_path.first) {}
... ...
@@ -477,3 +477,3 @@
477 477

	
478
      ArcIt(const ListPath &_path, Node *_node) 
478
      ArcIt(const ListPath &_path, Node *_node)
479 479
        : path(&_path), node(_node) {}
... ...
@@ -489,5 +489,5 @@
489 489
      /// Next arc
490
      ArcIt& operator++() { 
490
      ArcIt& operator++() {
491 491
        node = node->next;
492
        return *this; 
492
        return *this;
493 493
      }
... ...
@@ -759,3 +759,3 @@
759 759
    StaticPath() : len(0), arcs(0) {}
760
    
760

	
761 761
    /// \brief Template copy constructor
... ...
@@ -798,3 +798,3 @@
798 798
      /// Initializate the constructor to the first arc of path
799
      ArcIt(const StaticPath &_path) 
799
      ArcIt(const StaticPath &_path)
800 800
        : path(&_path), idx(_path.empty() ? -1 : 0) {}
... ...
@@ -804,3 +804,3 @@
804 804
      /// Constructor with starting point
805
      ArcIt(const StaticPath &_path, int _idx) 
805
      ArcIt(const StaticPath &_path, int _idx)
806 806
        : idx(_idx), path(&_path) {}
... ...
@@ -815,6 +815,6 @@
815 815
      /// Next arc
816
      ArcIt& operator++() { 
816
      ArcIt& operator++() {
817 817
        ++idx;
818
        if (idx >= path->length()) idx = -1; 
819
        return *this; 
818
        if (idx >= path->length()) idx = -1;
819
        return *this;
820 820
      }
... ...
@@ -911,3 +911,3 @@
911 911
    struct RevPathTagIndicator<
912
      Path, 
912
      Path,
913 913
      typename enable_if<typename Path::RevPathTag, void>::type
... ...
@@ -924,3 +924,3 @@
924 924
    struct BuildTagIndicator<
925
      Path, 
925
      Path,
926 926
      typename enable_if<typename Path::BuildTag, void>::type
... ...
@@ -931,4 +931,4 @@
931 931
    template <typename Target, typename Source,
932
	      bool buildEnable = BuildTagIndicator<Target>::value, 
933
	      bool revEnable = RevPathTagIndicator<Source>::value>
932
              bool buildEnable = BuildTagIndicator<Target>::value,
933
              bool revEnable = RevPathTagIndicator<Source>::value>
934 934
    struct PathCopySelector {
... ...
@@ -983,4 +983,4 @@
983 983
  /// This function checks that the target of each arc is the same
984
  /// as the source of the next one. 
985
  /// 
984
  /// as the source of the next one.
985
  ///
986 986
  template <typename Digraph, typename Path>
... ...
@@ -1036,3 +1036,3 @@
1036 1036
    typedef typename Digraph::Node Node;
1037
    
1037

	
1038 1038
    /// Default constructor
... ...
@@ -1040,6 +1040,6 @@
1040 1040
    /// Invalid constructor
1041
    PathNodeIt(Invalid) 
1041
    PathNodeIt(Invalid)
1042 1042
      : _digraph(0), _it(INVALID), _nd(INVALID) {}
1043 1043
    /// Constructor
1044
    PathNodeIt(const Digraph& digraph, const Path& path) 
1044
    PathNodeIt(const Digraph& digraph, const Path& path)
1045 1045
      : _digraph(&digraph), _it(path) {
... ...
@@ -1048,3 +1048,3 @@
1048 1048
    /// Constructor
1049
    PathNodeIt(const Digraph& digraph, const Path& path, const Node& src) 
1049
    PathNodeIt(const Digraph& digraph, const Path& path, const Node& src)
1050 1050
      : _digraph(&digraph), _it(path), _nd(src) {}
... ...
@@ -1060,4 +1060,4 @@
1060 1060
      else {
1061
	_nd = _digraph->target(_it);
1062
	++_it;
1061
        _nd = _digraph->target(_it);
1062
        ++_it;
1063 1063
      }
... ...
@@ -1067,16 +1067,16 @@
1067 1067
    /// Comparison operator
1068
    bool operator==(const PathNodeIt& n) const { 
1069
      return _it == n._it && _nd == n._nd; 
1068
    bool operator==(const PathNodeIt& n) const {
1069
      return _it == n._it && _nd == n._nd;
1070 1070
    }
1071 1071
    /// Comparison operator
1072
    bool operator!=(const PathNodeIt& n) const { 
1073
      return _it != n._it || _nd != n._nd; 
1072
    bool operator!=(const PathNodeIt& n) const {
1073
      return _it != n._it || _nd != n._nd;
1074 1074
    }
1075 1075
    /// Comparison operator
1076
    bool operator<(const PathNodeIt& n) const { 
1076
    bool operator<(const PathNodeIt& n) const {
1077 1077
      return (_it < n._it && _nd != INVALID);
1078 1078
    }
1079
    
1079

	
1080 1080
  };
1081
  
1081

	
1082 1082
  ///@}
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -23,5 +23,5 @@
23 23
 * See the appropriate copyright notice below.
24
 * 
24
 *
25 25
 * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
26
 * All rights reserved.                          
26
 * All rights reserved.
27 27
 *
... ...
@@ -38,4 +38,4 @@
38 38
 *
39
 * 3. The names of its contributors may not be used to endorse or promote 
40
 *    products derived from this software without specific prior written 
39
 * 3. The names of its contributors may not be used to endorse or promote
40
 *    products derived from this software without specific prior written
41 41
 *    permission.
... ...
@@ -89,3 +89,3 @@
89 89
  namespace _random_bits {
90
    
90

	
91 91
    template <typename _Word, int _bits = std::numeric_limits<_Word>::digits>
... ...
@@ -101,3 +101,3 @@
101 101
      static const int shift = 397;
102
      
102

	
103 103
      static const Word mul = 0x6c078965u;
... ...
@@ -169,3 +169,3 @@
169 169
        };
170
    
170

	
171 171
        initState(seedArray, seedArray + 4);
... ...
@@ -177,3 +177,3 @@
177 177

	
178
        current = state; 
178
        current = state;
179 179

	
... ...
@@ -203,3 +203,3 @@
203 203
        while (num--) {
204
          curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1)) 
204
          curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
205 205
            + *it + cnt;
... ...
@@ -225,6 +225,6 @@
225 225
        }
226
        
226

	
227 227
        state[length - 1] = Word(1) << (bits - 1);
228 228
      }
229
      
229

	
230 230
      void copyState(const RandomCore& other) {
... ...
@@ -243,3 +243,3 @@
243 243

	
244
  
244

	
245 245
      void fillState() {
... ...
@@ -249,3 +249,3 @@
249 249

	
250
        current = state + length; 
250
        current = state + length;
251 251

	
... ...
@@ -253,3 +253,3 @@
253 253
        register long num;
254
      
254

	
255 255
        num = length - shift;
... ...
@@ -271,6 +271,6 @@
271 271

	
272
  
272

	
273 273
      Word *current;
274 274
      Word state[length];
275
      
275

	
276 276
    };
... ...
@@ -278,3 +278,3 @@
278 278

	
279
    template <typename Result, 
279
    template <typename Result,
280 280
              int shift = (std::numeric_limits<Result>::digits + 1) / 2>
... ...
@@ -286,3 +286,3 @@
286 286
    };
287
    
287

	
288 288
    template <typename Result>
... ...
@@ -294,4 +294,4 @@
294 294

	
295
    template <typename Result, typename Word, 
296
              int rest = std::numeric_limits<Result>::digits, int shift = 0, 
295
    template <typename Result, typename Word,
296
              int rest = std::numeric_limits<Result>::digits, int shift = 0,
297 297
              bool last = rest <= std::numeric_limits<Word>::digits>
... ...
@@ -299,3 +299,3 @@
299 299
      static const int bits = std::numeric_limits<Word>::digits;
300
    
300

	
301 301
      static Result convert(RandomCore<Word>& rnd) {
... ...
@@ -303,6 +303,6 @@
303 303
      }
304
      
305
    }; 
306 304

	
307
    template <typename Result, typename Word, int rest, int shift> 
305
    };
306

	
307
    template <typename Result, typename Word, int rest, int shift>
308 308
    struct IntConversion<Result, Word, rest, shift, false> {
... ...
@@ -311,3 +311,3 @@
311 311
      static Result convert(RandomCore<Word>& rnd) {
312
        return (static_cast<Result>(rnd()) << shift) | 
312
        return (static_cast<Result>(rnd()) << shift) |
313 313
          IntConversion<Result, Word, rest - bits, shift + bits>::convert(rnd);
... ...
@@ -318,4 +318,4 @@
318 318
    template <typename Result, typename Word,
319
              bool one_word = (std::numeric_limits<Word>::digits < 
320
			       std::numeric_limits<Result>::digits) >
319
              bool one_word = (std::numeric_limits<Word>::digits <
320
                               std::numeric_limits<Result>::digits) >
321 321
    struct Mapping {
... ...
@@ -326,3 +326,3 @@
326 326
        do {
327
          num = IntConversion<Result, Word>::convert(rnd) & mask; 
327
          num = IntConversion<Result, Word>::convert(rnd) & mask;
328 328
        } while (num > max);
... ...
@@ -352,3 +352,3 @@
352 352
        if ((exp & 1) == 1) res *= static_cast<Result>(2.0);
353
        return res; 
353
        return res;
354 354
      }
... ...
@@ -362,3 +362,3 @@
362 362
        if ((exp & 1) == 1) res *= static_cast<Result>(0.5);
363
        return res; 
363
        return res;
364 364
      }
... ...
@@ -369,3 +369,3 @@
369 369
      static const Result multiplier() {
370
        return static_cast<Result>(1.0); 
370
        return static_cast<Result>(1.0);
371 371
      }
... ...
@@ -376,6 +376,6 @@
376 376
      static const Result multiplier() {
377
        return static_cast<Result>(1.0/1048576.0); 
377
        return static_cast<Result>(1.0/1048576.0);
378 378
      }
379 379
    };
380
    
380

	
381 381
    template <typename Result>
... ...
@@ -383,3 +383,3 @@
383 383
      static const Result multiplier() {
384
        return static_cast<Result>(1.0/424967296.0); 
384
        return static_cast<Result>(1.0/424967296.0);
385 385
      }
... ...
@@ -390,3 +390,3 @@
390 390
      static const Result multiplier() {
391
        return static_cast<Result>(1.0/9007199254740992.0); 
391
        return static_cast<Result>(1.0/9007199254740992.0);
392 392
      }
... ...
@@ -397,3 +397,3 @@
397 397
      static const Result multiplier() {
398
        return static_cast<Result>(1.0/18446744073709551616.0); 
398
        return static_cast<Result>(1.0/18446744073709551616.0);
399 399
      }
... ...
@@ -409,5 +409,5 @@
409 409
    template <typename Result, typename Word,
410
              int rest = std::numeric_limits<Result>::digits, int shift = 0, 
410
              int rest = std::numeric_limits<Result>::digits, int shift = 0,
411 411
              bool last = rest <= std::numeric_limits<Word>::digits>
412
    struct RealConversion{ 
412
    struct RealConversion{
413 413
      static const int bits = std::numeric_limits<Word>::digits;
... ...
@@ -421,3 +421,3 @@
421 421
    template <typename Result, typename Word, int rest, int shift>
422
    struct RealConversion<Result, Word, rest, shift, false> { 
422
    struct RealConversion<Result, Word, rest, shift, false> {
423 423
      static const int bits = std::numeric_limits<Word>::digits;
... ...
@@ -460,3 +460,3 @@
460 460
      int num;
461
      
461

	
462 462
      BoolProducer() : num(0) {}
... ...
@@ -531,6 +531,6 @@
531 531
    typedef unsigned long Word;
532
    
532

	
533 533
    _random_bits::RandomCore<Word> core;
534 534
    _random_bits::BoolProducer<Word> bool_producer;
535
    
535

	
536 536

	
... ...
@@ -556,3 +556,3 @@
556 556
    template <typename Number>
557
    Random(Number seed) { 
557
    Random(Number seed) {
558 558
      _random_bits::Initializer<Number, Word>::init(core, seed);
... ...
@@ -566,3 +566,3 @@
566 566
    template <typename Iterator>
567
    Random(Iterator begin, Iterator end) { 
567
    Random(Iterator begin, Iterator end) {
568 568
      typedef typename std::iterator_traits<Iterator>::value_type Number;
... ...
@@ -599,3 +599,3 @@
599 599
    template <typename Number>
600
    void seed(Number seed) { 
600
    void seed(Number seed) {
601 601
      _random_bits::Initializer<Number, Word>::init(core, seed);
... ...
@@ -609,3 +609,3 @@
609 609
    template <typename Iterator>
610
    void seed(Iterator begin, Iterator end) { 
610
    void seed(Iterator begin, Iterator end) {
611 611
      typedef typename std::iterator_traits<Iterator>::value_type Number;
... ...
@@ -627,3 +627,3 @@
627 627
    }
628
    
628

	
629 629
    /// \brief Seeding from file
... ...
@@ -642,5 +642,5 @@
642 642
#ifndef WIN32
643
    bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0) 
643
    bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0)
644 644
#else
645
    bool seedFromFile(const std::string& file = "", int offset = 0) 
645
    bool seedFromFile(const std::string& file = "", int offset = 0)
646 646
#endif
... ...
@@ -662,3 +662,3 @@
662 662
    /// \return Currently always true.
663
    bool seedFromTime() { 	
663
    bool seedFromTime() {
664 664
#ifndef WIN32
... ...
@@ -698,4 +698,4 @@
698 698
    template <typename Number>
699
    Number real(Number b) { 
700
      return real<Number>() * b; 
699
    Number real(Number b) {
700
      return real<Number>() * b;
701 701
    }
... ...
@@ -706,4 +706,4 @@
706 706
    template <typename Number>
707
    Number real(Number a, Number b) { 
708
      return real<Number>() * (b - a) + a; 
707
    Number real(Number a, Number b) {
708
      return real<Number>() * (b - a) + a;
709 709
    }
... ...
@@ -727,4 +727,4 @@
727 727
    template <typename Number>
728
    Number operator()(Number b) { 
729
      return real<Number>() * b; 
728
    Number operator()(Number b) {
729
      return real<Number>() * b;
730 730
    }
... ...
@@ -735,4 +735,4 @@
735 735
    template <typename Number>
736
    Number operator()(Number a, Number b) { 
737
      return real<Number>() * (b - a) + a; 
736
    Number operator()(Number a, Number b) {
737
      return real<Number>() * (b - a) + a;
738 738
    }
... ...
@@ -786,3 +786,3 @@
786 786
    Number integer() {
787
      static const int nb = std::numeric_limits<Number>::digits + 
787
      static const int nb = std::numeric_limits<Number>::digits +
788 788
        (std::numeric_limits<Number>::is_signed ? 1 : 0);
... ...
@@ -794,3 +794,3 @@
794 794
    }
795
    
795

	
796 796
    /// \brief Returns a random bool
... ...
@@ -808,5 +808,5 @@
808 808
    ///
809
    
809

	
810 810
    ///@{
811
    
811

	
812 812
    /// \brief Returns a random bool
... ...
@@ -824,3 +824,3 @@
824 824
    /// \todo Consider using the "ziggurat" method instead.
825
    double gauss() 
825
    double gauss()
826 826
    {
... ...
@@ -828,5 +828,5 @@
828 828
      do {
829
	V1=2*real<double>()-1;
830
	V2=2*real<double>()-1;
831
	S=V1*V1+V2*V2;
829
        V1=2*real<double>()-1;
830
        V2=2*real<double>()-1;
831
        S=V1*V1+V2*V2;
832 832
      } while(S>=1);
... ...
@@ -856,5 +856,5 @@
856 856
    /// This function generates a gamma distribution random number.
857
    /// 
857
    ///
858 858
    ///\param k shape parameter (<tt>k>0</tt> integer)
859
    double gamma(int k) 
859
    double gamma(int k)
860 860
    {
... ...
@@ -864,3 +864,3 @@
864 864
    }
865
    
865

	
866 866
    /// Gamma distribution with given shape and scale parameter
... ...
@@ -868,3 +868,3 @@
868 868
    /// This function generates a gamma distribution random number.
869
    /// 
869
    ///
870 870
    ///\param k shape parameter (<tt>k>0</tt>)
... ...
@@ -878,15 +878,15 @@
878 878
      do {
879
	double V0=1.0-real<double>();
880
	double V1=1.0-real<double>();
881
	double V2=1.0-real<double>();
882
	if(V2<=v0) 
883
	  {
884
	    xi=std::pow(V1,1.0/delta);
885
	    nu=V0*std::pow(xi,delta-1.0);
886
	  }
887
	else 
888
	  {
889
	    xi=1.0-std::log(V1);
890
	    nu=V0*std::exp(-xi);
891
	  }
879
        double V0=1.0-real<double>();
880
        double V1=1.0-real<double>();
881
        double V2=1.0-real<double>();
882
        if(V2<=v0)
883
          {
884
            xi=std::pow(V1,1.0/delta);
885
            nu=V0*std::pow(xi,delta-1.0);
886
          }
887
        else
888
          {
889
            xi=1.0-std::log(V1);
890
            nu=V0*std::exp(-xi);
891
          }
892 892
      } while(nu>std::pow(xi,delta-1.0)*std::exp(-xi));
... ...
@@ -894,3 +894,3 @@
894 894
    }
895
    
895

	
896 896
    /// Weibull distribution
... ...
@@ -898,3 +898,3 @@
898 898
    /// This function generates a Weibull distribution random number.
899
    /// 
899
    ///
900 900
    ///\param k shape parameter (<tt>k>0</tt>)
... ...
@@ -905,4 +905,4 @@
905 905
      return lambda*pow(-std::log(1.0-real<double>()),1.0/k);
906
    }  
907
      
906
    }
907

	
908 908
    /// Pareto distribution
... ...
@@ -910,3 +910,3 @@
910 910
    /// This function generates a Pareto distribution random number.
911
    /// 
911
    ///
912 912
    ///\param k shape parameter (<tt>k>0</tt>)
... ...
@@ -917,4 +917,4 @@
917 917
      return exponential(gamma(k,1.0/x_min))+x_min;
918
    }  
919
      
918
    }
919

	
920 920
    /// Poisson distribution
... ...
@@ -923,3 +923,3 @@
923 923
    /// parameter \c lambda.
924
    /// 
924
    ///
925 925
    /// The probability mass function of this distribusion is
... ...
@@ -929,3 +929,3 @@
929 929
    /// return value.
930
    
930

	
931 931
    int poisson(double lambda)
... ...
@@ -936,10 +936,10 @@
936 936
      do {
937
	k++;
938
	p*=real<double>();
937
        k++;
938
        p*=real<double>();
939 939
      } while (p>=l);
940 940
      return k-1;
941
    }  
942
      
941
    }
942

	
943 943
    ///@}
944
    
944

	
945 945
    ///\name Two dimensional distributions
... ...
@@ -948,3 +948,3 @@
948 948
    ///@{
949
    
949

	
950 950
    /// Uniform distribution on the full unit circle
... ...
@@ -953,3 +953,3 @@
953 953
    ///
954
    dim2::Point<double> disc() 
954
    dim2::Point<double> disc()
955 955
    {
... ...
@@ -957,5 +957,5 @@
957 957
      do {
958
	V1=2*real<double>()-1;
959
	V2=2*real<double>()-1;
960
	
958
        V1=2*real<double>()-1;
959
        V2=2*real<double>()-1;
960

	
961 961
      } while(V1*V1+V2*V2>=1);
... ...
@@ -975,5 +975,5 @@
975 975
      do {
976
	V1=2*real<double>()-1;
977
	V2=2*real<double>()-1;
978
	S=V1*V1+V2*V2;
976
        V1=2*real<double>()-1;
977
        V2=2*real<double>()-1;
978
        S=V1*V1+V2*V2;
979 979
      } while(S>=1);
... ...
@@ -986,6 +986,6 @@
986 986
    /// The x-coordinate is of conditionally exponential distribution
987
    /// with the condition that x is positive and y=0. If x is negative and 
987
    /// with the condition that x is positive and y=0. If x is negative and
988 988
    /// y=0 then, -x is of exponential distribution. The same is true for the
989 989
    /// y-coordinate.
990
    dim2::Point<double> exponential2() 
990
    dim2::Point<double> exponential2()
991 991
    {
... ...
@@ -993,5 +993,5 @@
993 993
      do {
994
	V1=2*real<double>()-1;
995
	V2=2*real<double>()-1;
996
	S=V1*V1+V2*V2;
994
        V1=2*real<double>()-1;
995
        V2=2*real<double>()-1;
996
        S=V1*V1+V2*V2;
997 997
      } while(S>=1);
... ...
@@ -1001,3 +1001,3 @@
1001 1001

	
1002
    ///@}    
1002
    ///@}
1003 1003
  };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -47,11 +47,11 @@
47 47

	
48
    struct NodeT 
48
    struct NodeT
49 49
    {
50
      int first_in, first_out;      
50
      int first_in, first_out;
51 51
      NodeT() {}
52 52
    };
53
    struct ArcT 
53
    struct ArcT
54 54
    {
55
      int target, source, next_in, next_out;      
56
      ArcT() {}  
55
      int target, source, next_in, next_out;
56
      ArcT() {}
57 57
    };
... ...
@@ -60,3 +60,3 @@
60 60
    std::vector<ArcT> arcs;
61
        
61

	
62 62
  public:
... ...
@@ -71,5 +71,5 @@
71 71
    SmartDigraphBase() : nodes(), arcs() { }
72
    SmartDigraphBase(const SmartDigraphBase &_g) 
72
    SmartDigraphBase(const SmartDigraphBase &_g)
73 73
      : nodes(_g.nodes), arcs(_g.arcs) { }
74
    
74

	
75 75
    typedef True NodeNumTag;
... ...
@@ -84,3 +84,3 @@
84 84
    Node addNode() {
85
      int n = nodes.size();     
85
      int n = nodes.size();
86 86
      nodes.push_back(NodeT());
... ...
@@ -90,7 +90,7 @@
90 90
    }
91
    
91

	
92 92
    Arc addArc(Node u, Node v) {
93
      int n = arcs.size(); 
93
      int n = arcs.size();
94 94
      arcs.push_back(ArcT());
95
      arcs[n].source = u._id; 
95
      arcs[n].source = u._id;
96 96
      arcs[n].target = v._id;
... ...
@@ -117,7 +117,7 @@
117 117

	
118
    bool valid(Node n) const { 
119
      return n._id >= 0 && n._id < static_cast<int>(nodes.size()); 
118
    bool valid(Node n) const {
119
      return n._id >= 0 && n._id < static_cast<int>(nodes.size());
120 120
    }
121
    bool valid(Arc a) const { 
122
      return a._id >= 0 && a._id < static_cast<int>(arcs.size()); 
121
    bool valid(Arc a) const {
122
      return a._id >= 0 && a._id < static_cast<int>(arcs.size());
123 123
    }
... ...
@@ -138,3 +138,3 @@
138 138
    };
139
    
139

	
140 140

	
... ...
@@ -182,3 +182,3 @@
182 182
    }
183
    
183

	
184 184
    void nextIn(Arc& arc) const {
... ...
@@ -224,5 +224,5 @@
224 224
  public:
225
    
225

	
226 226
    /// Constructor
227
    
227

	
228 228
    /// Constructor.
... ...
@@ -230,5 +230,5 @@
230 230
    SmartDigraph() {};
231
    
231

	
232 232
    ///Add a new node to the digraph.
233
    
233

	
234 234
    /// \return the new node.
... ...
@@ -236,5 +236,5 @@
236 236
    Node addNode() { return Parent::addNode(); }
237
    
237

	
238 238
    ///Add a new arc to the digraph.
239
    
239

	
240 240
    ///Add a new arc to the digraph with source node \c s
... ...
@@ -242,4 +242,4 @@
242 242
    ///\return the new arc.
243
    Arc addArc(const Node& s, const Node& t) { 
244
      return Parent::addArc(s, t); 
243
    Arc addArc(const Node& s, const Node& t) {
244
      return Parent::addArc(s, t);
245 245
    }
... ...
@@ -271,3 +271,3 @@
271 271
    /// This function gives back true if the given node is valid,
272
    /// ie. it is a real node of the graph.  
272
    /// ie. it is a real node of the graph.
273 273
    ///
... ...
@@ -280,3 +280,3 @@
280 280
    /// This function gives back true if the given arc is valid,
281
    /// ie. it is a real arc of the graph.  
281
    /// ie. it is a real arc of the graph.
282 282
    ///
... ...
@@ -287,3 +287,3 @@
287 287
    ///Clear the digraph.
288
    
288

	
289 289
    ///Erase all the nodes and arcs from the digraph.
... ...
@@ -295,3 +295,3 @@
295 295
    ///Split a node.
296
    
296

	
297 297
    ///This function splits a node. First a new node is added to the digraph,
... ...
@@ -320,3 +320,3 @@
320 320
  public:
321
    
321

	
322 322
    class Snapshot;
... ...
@@ -329,6 +329,6 @@
329 329
        Arc arc = arcFromId(arcs.size()-1);
330
	Parent::notifier(Arc()).erase(arc);
331
	nodes[arcs.back().source].first_out=arcs.back().next_out;
332
	nodes[arcs.back().target].first_in=arcs.back().next_in;
333
	arcs.pop_back();
330
        Parent::notifier(Arc()).erase(arc);
331
        nodes[arcs.back().source].first_out=arcs.back().next_out;
332
        nodes[arcs.back().target].first_in=arcs.back().next_in;
333
        arcs.pop_back();
334 334
      }
... ...
@@ -336,6 +336,6 @@
336 336
        Node node = nodeFromId(nodes.size()-1);
337
	Parent::notifier(Node()).erase(node);
338
	nodes.pop_back();
337
        Parent::notifier(Node()).erase(node);
338
        nodes.pop_back();
339 339
      }
340
    }    
340
    }
341 341

	
... ...
@@ -357,3 +357,3 @@
357 357
    ///the validity of the snapshot is not stored.
358
    class Snapshot 
358
    class Snapshot
359 359
    {
... ...
@@ -366,3 +366,3 @@
366 366
      ///Default constructor.
367
      
367

	
368 368
      ///Default constructor.
... ...
@@ -372,3 +372,3 @@
372 372
      ///Constructor that immediately makes a snapshot
373
      
373

	
374 374
      ///This constructor immediately makes a snapshot of the digraph.
... ...
@@ -376,4 +376,4 @@
376 376
      Snapshot(SmartDigraph &graph) : _graph(&graph) {
377
	node_num=_graph->nodes.size();
378
	arc_num=_graph->arcs.size();
377
        node_num=_graph->nodes.size();
378
        arc_num=_graph->arcs.size();
379 379
      }
... ...
@@ -387,7 +387,7 @@
387 387
      ///\param _g The digraph we make the snapshot of.
388
      void save(SmartDigraph &graph) 
388
      void save(SmartDigraph &graph)
389 389
      {
390
	_graph=&graph;
391
	node_num=_graph->nodes.size();
392
	arc_num=_graph->arcs.size();
390
        _graph=&graph;
391
        node_num=_graph->nodes.size();
392
        arc_num=_graph->arcs.size();
393 393
      }
... ...
@@ -395,3 +395,3 @@
395 395
      ///Undo the changes until a snapshot.
396
      
396

	
397 397
      ///Undo the changes until a snapshot created by save().
... ...
@@ -403,3 +403,3 @@
403 403
      {
404
	_graph->restoreSnapshot(*this);
404
        _graph->restoreSnapshot(*this);
405 405
      }
... ...
@@ -416,3 +416,3 @@
416 416
    };
417
 
417

	
418 418
    struct ArcT {
... ...
@@ -426,5 +426,5 @@
426 426
    int first_free_arc;
427
    
427

	
428 428
  public:
429
    
429

	
430 430
    typedef SmartGraphBase Digraph;
... ...
@@ -434,3 +434,3 @@
434 434
    class Edge;
435
    
435

	
436 436
    class Node {
... ...
@@ -487,4 +487,4 @@
487 487

	
488
    
489
    int maxNodeId() const { return nodes.size()-1; } 
488

	
489
    int maxNodeId() const { return nodes.size()-1; }
490 490
    int maxEdgeId() const { return arcs.size() / 2 - 1; }
... ...
@@ -506,3 +506,3 @@
506 506

	
507
    void first(Node& node) const { 
507
    void first(Node& node) const {
508 508
      node._id = nodes.size() - 1;
... ...
@@ -514,3 +514,3 @@
514 514

	
515
    void first(Arc& arc) const { 
515
    void first(Arc& arc) const {
516 516
      arc._id = arcs.size() - 1;
... ...
@@ -522,3 +522,3 @@
522 522

	
523
    void first(Edge& arc) const { 
523
    void first(Edge& arc) const {
524 524
      arc._id = arcs.size() / 2 - 1;
... ...
@@ -563,6 +563,6 @@
563 563
        arc._id = -1;
564
        d = true;      
564
        d = true;
565 565
      }
566 566
    }
567
    
567

	
568 568
    static int id(Node v) { return v._id; }
... ...
@@ -575,13 +575,13 @@
575 575

	
576
    bool valid(Node n) const { 
577
      return n._id >= 0 && n._id < static_cast<int>(nodes.size()); 
576
    bool valid(Node n) const {
577
      return n._id >= 0 && n._id < static_cast<int>(nodes.size());
578 578
    }
579
    bool valid(Arc a) const { 
579
    bool valid(Arc a) const {
580 580
      return a._id >= 0 && a._id < static_cast<int>(arcs.size());
581 581
    }
582
    bool valid(Edge e) const { 
583
      return e._id >= 0 && 2 * e._id < static_cast<int>(arcs.size()); 
582
    bool valid(Edge e) const {
583
      return e._id >= 0 && 2 * e._id < static_cast<int>(arcs.size());
584 584
    }
585 585

	
586
    Node addNode() {     
586
    Node addNode() {
587 587
      int n = nodes.size();
... ...
@@ -589,6 +589,6 @@
589 589
      nodes[n].first_out = -1;
590
      
590

	
591 591
      return Node(n);
592 592
    }
593
    
593

	
594 594
    Edge addEdge(Node u, Node v) {
... ...
@@ -597,3 +597,3 @@
597 597
      arcs.push_back(ArcT());
598
      
598

	
599 599
      arcs[n].target = u._id;
... ...
@@ -604,3 +604,3 @@
604 604

	
605
      arcs[n | 1].next_out = nodes[u._id].first_out;	
605
      arcs[n | 1].next_out = nodes[u._id].first_out;
606 606
      nodes[u._id].first_out = (n | 1);
... ...
@@ -609,3 +609,3 @@
609 609
    }
610
    
610

	
611 611
    void clear() {
... ...
@@ -627,3 +627,3 @@
627 627
  /// node and arc deletions</b>.
628
  /// Except from this it conforms to 
628
  /// Except from this it conforms to
629 629
  /// the \ref concepts::Graph "Graph concept".
... ...
@@ -657,3 +657,3 @@
657 657
    /// Constructor
658
    
658

	
659 659
    /// Constructor.
... ...
@@ -663,3 +663,3 @@
663 663
    ///Add a new node to the graph.
664
    
664

	
665 665
    /// \return the new node.
... ...
@@ -667,5 +667,5 @@
667 667
    Node addNode() { return Parent::addNode(); }
668
    
668

	
669 669
    ///Add a new edge to the graph.
670
    
670

	
671 671
    ///Add a new edge to the graph with node \c s
... ...
@@ -673,4 +673,4 @@
673 673
    ///\return the new edge.
674
    Edge addEdge(const Node& s, const Node& t) { 
675
      return Parent::addEdge(s, t); 
674
    Edge addEdge(const Node& s, const Node& t) {
675
      return Parent::addEdge(s, t);
676 676
    }
... ...
@@ -680,3 +680,3 @@
680 680
    /// This function gives back true if the given node is valid,
681
    /// ie. it is a real node of the graph.  
681
    /// ie. it is a real node of the graph.
682 682
    ///
... ...
@@ -689,3 +689,3 @@
689 689
    /// This function gives back true if the given arc is valid,
690
    /// ie. it is a real arc of the graph.  
690
    /// ie. it is a real arc of the graph.
691 691
    ///
... ...
@@ -698,3 +698,3 @@
698 698
    /// This function gives back true if the given edge is valid,
699
    /// ie. it is a real edge of the graph.  
699
    /// ie. it is a real edge of the graph.
700 700
    ///
... ...
@@ -705,3 +705,3 @@
705 705
    ///Clear the graph.
706
    
706

	
707 707
    ///Erase all the nodes and edges from the graph.
... ...
@@ -713,3 +713,3 @@
713 713
  public:
714
    
714

	
715 715
    class Snapshot;
... ...
@@ -730,3 +730,3 @@
730 730
        Edge arc=edgeFromId(n/2);
731
	Parent::notifier(Edge()).erase(arc);
731
        Parent::notifier(Edge()).erase(arc);
732 732
        std::vector<Arc> dir;
... ...
@@ -734,7 +734,7 @@
734 734
        dir.push_back(arcFromId(n-1));
735
	Parent::notifier(Arc()).erase(dir);
736
	nodes[arcs[n].target].first_out=arcs[n].next_out;
737
	nodes[arcs[n-1].target].first_out=arcs[n-1].next_out;
738
	arcs.pop_back();
739
	arcs.pop_back();
735
        Parent::notifier(Arc()).erase(dir);
736
        nodes[arcs[n].target].first_out=arcs[n].next_out;
737
        nodes[arcs[n-1].target].first_out=arcs[n-1].next_out;
738
        arcs.pop_back();
739
        arcs.pop_back();
740 740
      }
... ...
@@ -743,6 +743,6 @@
743 743
        Node node = nodeFromId(n);
744
	Parent::notifier(Node()).erase(node);
745
	nodes.pop_back();
744
        Parent::notifier(Node()).erase(node);
745
        nodes.pop_back();
746 746
      }
747
    }    
747
    }
748 748

	
... ...
@@ -765,3 +765,3 @@
765 765
    ///the validity of the snapshot is not stored.
766
    class Snapshot 
766
    class Snapshot
767 767
    {
... ...
@@ -774,3 +774,3 @@
774 774
      ///Default constructor.
775
      
775

	
776 776
      ///Default constructor.
... ...
@@ -780,3 +780,3 @@
780 780
      ///Constructor that immediately makes a snapshot
781
      
781

	
782 782
      ///This constructor immediately makes a snapshot of the digraph.
... ...
@@ -794,3 +794,3 @@
794 794
      ///\param g The digraph we make the snapshot of.
795
      void save(SmartGraph &graph) 
795
      void save(SmartGraph &graph)
796 796
      {
... ...
@@ -800,3 +800,3 @@
800 800
      ///Undo the changes until a snapshot.
801
      
801

	
802 802
      ///Undo the changes until a snapshot created by save().
... ...
@@ -812,3 +812,3 @@
812 812
  };
813
  
813

	
814 814
} //namespace lemon
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -66,4 +66,4 @@
66 66
    double rtime;
67
  
68
    void _reset() { 
67

	
68
    void _reset() {
69 69
      utime = stime = cutime = cstime = rtime = 0;
... ...
@@ -98,16 +98,16 @@
98 98
      if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
99
	utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
100
	stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
101
	cutime = 0;
102
	cstime = 0;
99
        utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
100
        stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
101
        cutime = 0;
102
        cstime = 0;
103 103
      } else {
104
	rtime = 0;
105
	utime = 0;
106
	stime = 0;
107
	cutime = 0;
108
	cstime = 0;
104
        rtime = 0;
105
        utime = 0;
106
        stime = 0;
107
        cutime = 0;
108
        cstime = 0;
109 109
      }
110
#endif      
110
#endif
111 111
    }
112
  
112

	
113 113
    /// Constructor initializing with zero
... ...
@@ -117,3 +117,3 @@
117 117
    TimeStamp(void *) { stamp();}
118
  
118

	
119 119
    ///Set every time value to zero
... ...
@@ -192,5 +192,5 @@
192 192
    }
193
  
193

	
194 194
    friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t);
195
  
195

	
196 196
    ///Gives back the user time of the process
... ...
@@ -207,3 +207,3 @@
207 207

	
208
    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
208
    ///\note On <tt>WIN32</tt> platform this value is not calculated.
209 209
    ///
... ...
@@ -215,3 +215,3 @@
215 215

	
216
    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
216
    ///\note On <tt>WIN32</tt> platform this value is not calculated.
217 217
    ///
... ...
@@ -225,3 +225,3 @@
225 225

	
226
  TimeStamp operator*(double b,const TimeStamp &t) 
226
  TimeStamp operator*(double b,const TimeStamp &t)
227 227
  {
... ...
@@ -229,3 +229,3 @@
229 229
  }
230
  
230

	
231 231
  ///Prints the time counters
... ...
@@ -301,6 +301,6 @@
301 301
                          //is _running, the collected _running time otherwise.
302
    
302

	
303 303
    void _reset() {if(_running) start_time.stamp(); else start_time.reset();}
304
  
305
  public: 
304

	
305
  public:
306 306
    ///Constructor.
... ...
@@ -333,3 +333,3 @@
333 333
    ///Start the time counters
334
    
334

	
335 335
    ///This function starts the time counters.
... ...
@@ -339,3 +339,3 @@
339 339
    ///\sa stop()
340
    void start() 
340
    void start()
341 341
    {
... ...
@@ -343,6 +343,6 @@
343 343
      else {
344
	_running=1;
345
	TimeStamp t;
346
	t.stamp();
347
	start_time=t-start_time;
344
        _running=1;
345
        TimeStamp t;
346
        t.stamp();
347
        start_time=t-start_time;
348 348
      }
... ...
@@ -350,3 +350,3 @@
350 350

	
351
    
351

	
352 352
    ///Stop the time counters
... ...
@@ -356,3 +356,3 @@
356 356
    ///stop the timer.
357
    /// 
357
    ///
358 358
    ///\sa halt()
... ...
@@ -362,8 +362,8 @@
362 362

	
363
    void stop() 
363
    void stop()
364 364
    {
365 365
      if(_running && !--_running) {
366
	TimeStamp t;
367
	t.stamp();
368
	start_time=t-start_time;
366
        TimeStamp t;
367
        t.stamp();
368
        start_time=t-start_time;
369 369
      }
... ...
@@ -385,9 +385,9 @@
385 385

	
386
    void halt() 
386
    void halt()
387 387
    {
388 388
      if(_running) {
389
	_running=0;
390
	TimeStamp t;
391
	t.stamp();
392
	start_time=t-start_time;
389
        _running=0;
390
        TimeStamp t;
391
        t.stamp();
392
        start_time=t-start_time;
393 393
      }
... ...
@@ -404,4 +404,4 @@
404 404
    int running()  { return _running; }
405
    
406
    
405

	
406

	
407 407
    ///Restart the time counters
... ...
@@ -411,3 +411,3 @@
411 411
    ///
412
    void restart() 
412
    void restart()
413 413
    {
... ...
@@ -416,3 +416,3 @@
416 416
    }
417
    
417

	
418 418
    ///@}
... ...
@@ -435,3 +435,3 @@
435 435

	
436
    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
436
    ///\note On <tt>WIN32</tt> platform this value is not calculated.
437 437
    ///
... ...
@@ -443,3 +443,3 @@
443 443

	
444
    ///\note On <tt>WIN32</tt> platform this value is not calculated. 
444
    ///\note On <tt>WIN32</tt> platform this value is not calculated.
445 445
    ///
... ...
@@ -489,3 +489,3 @@
489 489
  ///\todo There is no test case for this
490
  class TimeReport : public Timer 
490
  class TimeReport : public Timer
491 491
  {
... ...
@@ -500,6 +500,6 @@
500 500

	
501
    TimeReport(std::string title,std::ostream &os=std::cerr,bool run=true) 
501
    TimeReport(std::string title,std::ostream &os=std::cerr,bool run=true)
502 502
      : Timer(run), _title(title), _os(os){}
503 503
    ///\e Prints the ellapsed time on destruction.
504
    ~TimeReport() 
504
    ~TimeReport()
505 505
    {
... ...
@@ -508,3 +508,3 @@
508 508
  };
509
      
509

	
510 510
  ///'Do nothing' version of \ref TimeReport
... ...
@@ -529,3 +529,3 @@
529 529
    void stop() {}
530
    void halt() {} 
530
    void halt() {}
531 531
    int running() { return 0; }
... ...
@@ -538,5 +538,5 @@
538 538
  };
539
      
539

	
540 540
  ///Tool to measure the running time more exactly.
541
  
541

	
542 542
  ///This function calls \c f several times and returns the average
... ...
@@ -552,3 +552,3 @@
552 552
  ///\return The average running time of \c f.
553
  
553

	
554 554
  template<class F>
... ...
@@ -568,4 +568,4 @@
568 568
  }
569
  
570
  /// @}  
569

	
570
  /// @}
571 571

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -33,3 +33,3 @@
33 33
  /// @{
34
  
34

	
35 35
  ///\brief A class to provide a basic way to
... ...
@@ -42,4 +42,4 @@
42 42
  ///
43
  ///This is an abstract class, it should be specialized for all 
44
  ///numerical data types. These specialized classes like 
43
  ///This is an abstract class, it should be specialized for all
44
  ///numerical data types. These specialized classes like
45 45
  ///Tolerance<double> may offer additional tuning parameters.
... ...
@@ -307,3 +307,3 @@
307 307
  };
308
  
308

	
309 309

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -40,6 +40,6 @@
40 40
  ///
41
  /// The class implements the \e Union-Find data structure. 
41
  /// The class implements the \e Union-Find data structure.
42 42
  /// The union operation uses rank heuristic, while
43 43
  /// the find operation uses path compression.
44
  /// This is a very simple but efficient implementation, providing 
44
  /// This is a very simple but efficient implementation, providing
45 45
  /// only four methods: join (union), find, insert and size.
... ...
@@ -52,3 +52,3 @@
52 52
  /// \pre You need to add all the elements by the \ref insert()
53
  /// method.  
53
  /// method.
54 54
  template <typename _ItemIntMap>
... ...
@@ -113,3 +113,3 @@
113 113
    ///
114
    /// This method inserts a new element into the data structure. 
114
    /// This method inserts a new element into the data structure.
115 115
    ///
... ...
@@ -125,3 +125,3 @@
125 125
    ///
126
    /// This is the \e union operation of the Union-Find structure. 
126
    /// This is the \e union operation of the Union-Find structure.
127 127
    /// Joins the component of element \e a and component of
... ...
@@ -133,11 +133,11 @@
133 133

	
134
      if ( ka == kb ) 
135
	return false;
134
      if ( ka == kb )
135
        return false;
136 136

	
137 137
      if (items[ka] < items[kb]) {
138
	items[ka] += items[kb];
139
	items[kb] = ka;
138
        items[ka] += items[kb];
139
        items[kb] = ka;
140 140
      } else {
141
	items[kb] += items[ka];
142
	items[ka] = kb;
141
        items[kb] += items[ka];
142
        items[ka] = kb;
143 143
      }
... ...
@@ -175,3 +175,3 @@
175 175
  public:
176
    
176

	
177 177
    typedef _ItemIntMap ItemIntMap;
... ...
@@ -180,3 +180,3 @@
180 180
  private:
181
    
181

	
182 182
    ItemIntMap& index;
... ...
@@ -204,3 +204,3 @@
204 204
    };
205
    
205

	
206 206
    std::vector<ClassT> classes;
... ...
@@ -210,9 +210,9 @@
210 210
      if (firstFreeClass == -1) {
211
	int cdx = classes.size();
212
	classes.push_back(ClassT());
213
	return cdx;
211
        int cdx = classes.size();
212
        classes.push_back(ClassT());
213
        return cdx;
214 214
      } else {
215
	int cdx = firstFreeClass;
216
	firstFreeClass = classes[firstFreeClass].next;
217
	return cdx;
215
        int cdx = firstFreeClass;
216
        firstFreeClass = classes[firstFreeClass].next;
217
        return cdx;
218 218
      }
... ...
@@ -222,9 +222,9 @@
222 222
      if (firstFreeItem == -1) {
223
	int idx = items.size();
224
	items.push_back(ItemT());
225
	return idx;
223
        int idx = items.size();
224
        items.push_back(ItemT());
225
        return idx;
226 226
      } else {
227
	int idx = firstFreeItem;
228
	firstFreeItem = items[firstFreeItem].next;
229
	return idx;
227
        int idx = firstFreeItem;
228
        firstFreeItem = items[firstFreeItem].next;
229
        return idx;
230 230
      }
... ...
@@ -269,3 +269,3 @@
269 269
      items[items[idx].next].prev = items[idx].prev;
270
      
270

	
271 271
      items[idx].next = firstFreeItem;
... ...
@@ -280,3 +280,3 @@
280 280
      items[bk].prev = tmp;
281
        
281

	
282 282
    }
... ...
@@ -290,3 +290,3 @@
290 290
      firstClass = cls;
291
    } 
291
    }
292 292

	
... ...
@@ -301,6 +301,6 @@
301 301
      }
302
      
302

	
303 303
      classes[cls].next = firstFreeClass;
304 304
      firstFreeClass = cls;
305
    } 
305
    }
306 306

	
... ...
@@ -308,6 +308,6 @@
308 308

	
309
    UnionFindEnum(ItemIntMap& _index) 
310
      : index(_index), items(), firstFreeItem(-1), 
311
	firstClass(-1), firstFreeClass(-1) {}
312
    
309
    UnionFindEnum(ItemIntMap& _index)
310
      : index(_index), items(), firstFreeItem(-1),
311
        firstClass(-1), firstFreeClass(-1) {}
312

	
313 313
    /// \brief Inserts the given element into a new component.
... ...
@@ -334,3 +334,3 @@
334 334
      firstClass = cdx;
335
      
335

	
336 336
      return cdx;
... ...
@@ -341,3 +341,3 @@
341 341
    /// This methods inserts the element \e a into the component of the
342
    /// element \e comp. 
342
    /// element \e comp.
343 343
    void insert(const Item& item, int cls) {
... ...
@@ -374,3 +374,3 @@
374 374
    ///
375
    /// This is the \e union operation of the Union-Find structure. 
375
    /// This is the \e union operation of the Union-Find structure.
376 376
    /// Joins the component of element \e a and component of
... ...
@@ -384,3 +384,3 @@
384 384
      if (ak == bk) {
385
	return -1;
385
        return -1;
386 386
      }
... ...
@@ -393,11 +393,11 @@
393 393
      if (classes[acx].size > classes[bcx].size) {
394
	classes[acx].size += classes[bcx].size;
395
	items[bk].parent = ak;
394
        classes[acx].size += classes[bcx].size;
395
        items[bk].parent = ak;
396 396
        unlaceClass(bcx);
397
	rcx = acx;
397
        rcx = acx;
398 398
      } else {
399
	classes[bcx].size += classes[acx].size;
400
	items[ak].parent = bk;
399
        classes[bcx].size += classes[acx].size;
400
        items[ak].parent = bk;
401 401
        unlaceClass(acx);
402
	rcx = bcx;
402
        rcx = bcx;
403 403
      }
... ...
@@ -415,3 +415,3 @@
415 415

	
416
    /// \brief Splits up the component. 
416
    /// \brief Splits up the component.
417 417
    ///
... ...
@@ -425,11 +425,11 @@
425 425

	
426
	singletonItem(idx);
426
        singletonItem(idx);
427 427

	
428
	int cdx = newClass();        
428
        int cdx = newClass();
429 429
        items[idx].parent = ~cdx;
430 430

	
431
	laceClass(cdx);
432
	classes[cdx].size = 1;
433
	classes[cdx].firstItem = idx;
434
        
431
        laceClass(cdx);
432
        classes[cdx].size = 1;
433
        classes[cdx].firstItem = idx;
434

	
435 435
        idx = next;
... ...
@@ -441,3 +441,3 @@
441 441
      classes[~(items[idx].parent)].size = 1;
442
      
442

	
443 443
    }
... ...
@@ -459,18 +459,18 @@
459 459
      if (idx == fdx) {
460
	unlaceClass(cdx);
461
	items[idx].next = firstFreeItem;
462
	firstFreeItem = idx;
463
	return;
460
        unlaceClass(cdx);
461
        items[idx].next = firstFreeItem;
462
        firstFreeItem = idx;
463
        return;
464 464
      } else {
465
	classes[cdx].firstItem = fdx;
466
	--classes[cdx].size;
467
	items[fdx].parent = ~cdx;
465
        classes[cdx].firstItem = fdx;
466
        --classes[cdx].size;
467
        items[fdx].parent = ~cdx;
468 468

	
469
	unlaceItem(idx);
470
	idx = items[fdx].next;
471
	while (idx != fdx) {
472
	  items[idx].parent = fdx;
473
	  idx = items[idx].next;
474
	}
475
          
469
        unlaceItem(idx);
470
        idx = items[fdx].next;
471
        while (idx != fdx) {
472
          items[idx].parent = fdx;
473
          idx = items[idx].next;
474
        }
475

	
476 476
      }
... ...
@@ -516,3 +516,3 @@
516 516
      ClassIt(Invalid) : unionFind(0), cdx(-1) {}
517
      
517

	
518 518
      /// \brief Increment operator
... ...
@@ -524,3 +524,3 @@
524 524
      }
525
      
525

	
526 526
      /// \brief Conversion operator
... ...
@@ -535,3 +535,3 @@
535 535
      /// Equality operator
536
      bool operator==(const ClassIt& i) { 
536
      bool operator==(const ClassIt& i) {
537 537
        return i.cdx == cdx;
... ...
@@ -542,6 +542,6 @@
542 542
      /// Inequality operator
543
      bool operator!=(const ClassIt& i) { 
543
      bool operator!=(const ClassIt& i) {
544 544
        return i.cdx != cdx;
545 545
      }
546
      
546

	
547 547
    private:
... ...
@@ -579,3 +579,3 @@
579 579
      ItemIt(Invalid) : unionFind(0), idx(-1) {}
580
      
580

	
581 581
      /// \brief Increment operator
... ...
@@ -588,3 +588,3 @@
588 588
      }
589
      
589

	
590 590
      /// \brief Conversion operator
... ...
@@ -599,3 +599,3 @@
599 599
      /// Equality operator
600
      bool operator==(const ItemIt& i) { 
600
      bool operator==(const ItemIt& i) {
601 601
        return i.idx == idx;
... ...
@@ -606,6 +606,6 @@
606 606
      /// Inequality operator
607
      bool operator!=(const ItemIt& i) { 
607
      bool operator!=(const ItemIt& i) {
608 608
        return i.idx != idx;
609 609
      }
610
      
610

	
611 611
    private:
... ...
@@ -632,3 +632,3 @@
632 632
  public:
633
    
633

	
634 634
    typedef _ItemIntMap ItemIntMap;
... ...
@@ -637,3 +637,3 @@
637 637
  private:
638
    
638

	
639 639
    ItemIntMap& index;
... ...
@@ -660,8 +660,8 @@
660 660
      if (firstFreeClass != -1) {
661
	int cdx = firstFreeClass;
662
	firstFreeClass = classes[cdx].next;
663
	return cdx;
661
        int cdx = firstFreeClass;
662
        firstFreeClass = classes[cdx].next;
663
        return cdx;
664 664
      } else {
665
	classes.push_back(ClassT());
666
	return classes.size() - 1;
665
        classes.push_back(ClassT());
666
        return classes.size() - 1;
667 667
      }
... ...
@@ -671,8 +671,8 @@
671 671
      if (firstFreeItem != -1) {
672
	int idx = firstFreeItem;
673
	firstFreeItem = items[idx].next;
674
	return idx;
672
        int idx = firstFreeItem;
673
        firstFreeItem = items[idx].next;
674
        return idx;
675 675
      } else {
676
	items.push_back(ItemT());
677
	return items.size() - 1;
676
        items.push_back(ItemT());
677
        return items.size() - 1;
678 678
      }
... ...
@@ -683,6 +683,6 @@
683 683
    /// \brief Constructor
684
    ExtendFindEnum(ItemIntMap& _index) 
685
      : index(_index), items(), firstFreeItem(-1), 
686
	classes(), firstClass(-1), firstFreeClass(-1) {}
687
    
684
    ExtendFindEnum(ItemIntMap& _index)
685
      : index(_index), items(), firstFreeItem(-1),
686
        classes(), firstClass(-1), firstFreeClass(-1) {}
687

	
688 688
    /// \brief Inserts the given element into a new component.
... ...
@@ -696,6 +696,6 @@
696 696
      if (firstClass != -1) {
697
	classes[firstClass].prev = cdx;
697
        classes[firstClass].prev = cdx;
698 698
      }
699 699
      firstClass = cdx;
700
      
700

	
701 701
      int idx = newItem();
... ...
@@ -709,3 +709,3 @@
709 709
      index.set(item, idx);
710
      
710

	
711 711
      return cdx;
... ...
@@ -752,3 +752,3 @@
752 752
    }
753
    
753

	
754 754
    /// \brief Removes the given element from the structure.
... ...
@@ -763,18 +763,18 @@
763 763
      int cdx = items[idx].cls;
764
      
764

	
765 765
      if (idx == items[idx].next) {
766
	if (classes[cdx].prev != -1) {
767
	  classes[classes[cdx].prev].next = classes[cdx].next; 
768
	} else {
769
	  firstClass = classes[cdx].next;
770
	}
771
	if (classes[cdx].next != -1) {
772
	  classes[classes[cdx].next].prev = classes[cdx].prev; 
773
	}
774
	classes[cdx].next = firstFreeClass;
775
	firstFreeClass = cdx;
766
        if (classes[cdx].prev != -1) {
767
          classes[classes[cdx].prev].next = classes[cdx].next;
768
        } else {
769
          firstClass = classes[cdx].next;
770
        }
771
        if (classes[cdx].next != -1) {
772
          classes[classes[cdx].next].prev = classes[cdx].prev;
773
        }
774
        classes[cdx].next = firstFreeClass;
775
        firstFreeClass = cdx;
776 776
      } else {
777
	classes[cdx].firstItem = items[idx].next;
778
	items[items[idx].next].prev = items[idx].prev;
779
	items[items[idx].prev].next = items[idx].next;
777
        classes[cdx].firstItem = items[idx].next;
778
        items[items[idx].next].prev = items[idx].prev;
779
        items[items[idx].prev].next = items[idx].next;
780 780
      }
... ...
@@ -782,6 +782,6 @@
782 782
      firstFreeItem = idx;
783
	
784
    }    
785 783

	
786
    
784
    }
785

	
786

	
787 787
    /// \brief Removes the component of the given element from the structure.
... ...
@@ -798,8 +798,8 @@
798 798
      if (classes[cdx].prev != -1) {
799
	classes[classes[cdx].prev].next = classes[cdx].next; 
799
        classes[classes[cdx].prev].next = classes[cdx].next;
800 800
      } else {
801
	firstClass = classes[cdx].next;
801
        firstClass = classes[cdx].next;
802 802
      }
803 803
      if (classes[cdx].next != -1) {
804
	classes[classes[cdx].next].prev = classes[cdx].prev; 
804
        classes[classes[cdx].next].prev = classes[cdx].prev;
805 805
      }
... ...
@@ -826,3 +826,3 @@
826 826
      ClassIt(Invalid) : extendFind(0), cdx(-1) {}
827
      
827

	
828 828
      /// \brief Increment operator
... ...
@@ -834,3 +834,3 @@
834 834
      }
835
      
835

	
836 836
      /// \brief Conversion operator
... ...
@@ -845,3 +845,3 @@
845 845
      /// Equality operator
846
      bool operator==(const ClassIt& i) { 
846
      bool operator==(const ClassIt& i) {
847 847
        return i.cdx == cdx;
... ...
@@ -852,6 +852,6 @@
852 852
      /// Inequality operator
853
      bool operator!=(const ClassIt& i) { 
853
      bool operator!=(const ClassIt& i) {
854 854
        return i.cdx != cdx;
855 855
      }
856
      
856

	
857 857
    private:
... ...
@@ -889,3 +889,3 @@
889 889
      ItemIt(Invalid) : extendFind(0), idx(-1) {}
890
      
890

	
891 891
      /// \brief Increment operator
... ...
@@ -895,6 +895,6 @@
895 895
        idx = extendFind->items[idx].next;
896
	if (fdx == idx) idx = -1;
896
        if (fdx == idx) idx = -1;
897 897
        return *this;
898 898
      }
899
      
899

	
900 900
      /// \brief Conversion operator
... ...
@@ -909,3 +909,3 @@
909 909
      /// Equality operator
910
      bool operator==(const ItemIt& i) { 
910
      bool operator==(const ItemIt& i) {
911 911
        return i.idx == idx;
... ...
@@ -916,6 +916,6 @@
916 916
      /// Inequality operator
917
      bool operator!=(const ItemIt& i) { 
917
      bool operator!=(const ItemIt& i) {
918 918
        return i.idx != idx;
919 919
      }
920
      
920

	
921 921
    private:
... ...
@@ -951,3 +951,3 @@
951 951
  ///
952
  template <typename _Value, typename _ItemIntMap, 
952
  template <typename _Value, typename _ItemIntMap,
953 953
            typename _Comp = std::less<_Value> >
... ...
@@ -955,3 +955,3 @@
955 955
  public:
956
    
956

	
957 957
    typedef _Value Value;
... ...
@@ -1056,3 +1056,3 @@
1056 1056
      while (depth--) {
1057
        id = nodes[id].left;      
1057
        id = nodes[id].left;
1058 1058
      }
... ...
@@ -1134,3 +1134,3 @@
1134 1134
      nodes[nodes[id].prev].next = -1;
1135
      
1135

	
1136 1136
      nodes[jd].left = id;
... ...
@@ -1143,3 +1143,3 @@
1143 1143
        ++num;
1144
      }      
1144
      }
1145 1145
      nodes[kd].size -= num;
... ...
@@ -1167,40 +1167,40 @@
1167 1167
      while (nodes[jd].left != -1) {
1168
	int kd = nodes[jd].left;
1169
	if (nodes[jd].size == 1) {
1170
	  if (nodes[jd].parent < 0) {
1171
	    classes[id].parent = ~kd;
1172
	    classes[id].depth -= 1;
1173
	    nodes[kd].parent = ~id;
1174
	    deleteNode(jd);
1175
	    jd = kd;
1176
	  } else {
1177
	    int pd = nodes[jd].parent;
1178
	    if (nodes[nodes[jd].next].size < cmax) {
1179
	      pushLeft(nodes[jd].next, nodes[jd].left);
1180
	      if (less(nodes[jd].left, nodes[jd].next)) {
1181
		nodes[nodes[jd].next].prio = nodes[nodes[jd].left].prio;
1182
		nodes[nodes[jd].next].item = nodes[nodes[jd].left].item;
1183
	      } 
1184
	      popLeft(pd);
1185
	      deleteNode(jd);
1186
	      jd = pd;
1187
	    } else {
1188
	      int ld = nodes[nodes[jd].next].left;
1189
	      popLeft(nodes[jd].next);
1190
	      pushRight(jd, ld);
1191
	      if (less(ld, nodes[jd].left)) {
1192
		nodes[jd].item = nodes[ld].item;
1193
		nodes[jd].prio = nodes[jd].prio;
1194
	      }
1195
	      if (nodes[nodes[jd].next].item == nodes[ld].item) {
1196
		setPrio(nodes[jd].next);
1197
	      }
1198
	      jd = nodes[jd].left;
1199
	    }
1200
	  }
1201
	} else {
1202
	  jd = nodes[jd].left;
1203
	}
1168
        int kd = nodes[jd].left;
1169
        if (nodes[jd].size == 1) {
1170
          if (nodes[jd].parent < 0) {
1171
            classes[id].parent = ~kd;
1172
            classes[id].depth -= 1;
1173
            nodes[kd].parent = ~id;
1174
            deleteNode(jd);
1175
            jd = kd;
1176
          } else {
1177
            int pd = nodes[jd].parent;
1178
            if (nodes[nodes[jd].next].size < cmax) {
1179
              pushLeft(nodes[jd].next, nodes[jd].left);
1180
              if (less(nodes[jd].left, nodes[jd].next)) {
1181
                nodes[nodes[jd].next].prio = nodes[nodes[jd].left].prio;
1182
                nodes[nodes[jd].next].item = nodes[nodes[jd].left].item;
1183
              }
1184
              popLeft(pd);
1185
              deleteNode(jd);
1186
              jd = pd;
1187
            } else {
1188
              int ld = nodes[nodes[jd].next].left;
1189
              popLeft(nodes[jd].next);
1190
              pushRight(jd, ld);
1191
              if (less(ld, nodes[jd].left)) {
1192
                nodes[jd].item = nodes[ld].item;
1193
                nodes[jd].prio = nodes[jd].prio;
1194
              }
1195
              if (nodes[nodes[jd].next].item == nodes[ld].item) {
1196
                setPrio(nodes[jd].next);
1197
              }
1198
              jd = nodes[jd].left;
1199
            }
1200
          }
1201
        } else {
1202
          jd = nodes[jd].left;
1203
        }
1204 1204
      }
1205
    }    
1205
    }
1206 1206

	
... ...
@@ -1209,38 +1209,38 @@
1209 1209
      while (nodes[jd].right != -1) {
1210
	int kd = nodes[jd].right;
1211
	if (nodes[jd].size == 1) {
1212
	  if (nodes[jd].parent < 0) {
1213
	    classes[id].parent = ~kd;
1214
	    classes[id].depth -= 1;
1215
	    nodes[kd].parent = ~id;
1216
	    deleteNode(jd);
1217
	    jd = kd;
1218
	  } else {
1219
	    int pd = nodes[jd].parent;
1220
	    if (nodes[nodes[jd].prev].size < cmax) {
1221
	      pushRight(nodes[jd].prev, nodes[jd].right);
1222
	      if (less(nodes[jd].right, nodes[jd].prev)) {
1223
		nodes[nodes[jd].prev].prio = nodes[nodes[jd].right].prio;
1224
		nodes[nodes[jd].prev].item = nodes[nodes[jd].right].item;
1225
	      } 
1226
	      popRight(pd);
1227
	      deleteNode(jd);
1228
	      jd = pd;
1229
	    } else {
1230
	      int ld = nodes[nodes[jd].prev].right;
1231
	      popRight(nodes[jd].prev);
1232
	      pushLeft(jd, ld);
1233
	      if (less(ld, nodes[jd].right)) {
1234
		nodes[jd].item = nodes[ld].item;
1235
		nodes[jd].prio = nodes[jd].prio;
1236
	      }
1237
	      if (nodes[nodes[jd].prev].item == nodes[ld].item) {
1238
		setPrio(nodes[jd].prev);
1239
	      }
1240
	      jd = nodes[jd].right;
1241
	    }
1242
	  }
1243
	} else {
1244
	  jd = nodes[jd].right;
1245
	}
1210
        int kd = nodes[jd].right;
1211
        if (nodes[jd].size == 1) {
1212
          if (nodes[jd].parent < 0) {
1213
            classes[id].parent = ~kd;
1214
            classes[id].depth -= 1;
1215
            nodes[kd].parent = ~id;
1216
            deleteNode(jd);
1217
            jd = kd;
1218
          } else {
1219
            int pd = nodes[jd].parent;
1220
            if (nodes[nodes[jd].prev].size < cmax) {
1221
              pushRight(nodes[jd].prev, nodes[jd].right);
1222
              if (less(nodes[jd].right, nodes[jd].prev)) {
1223
                nodes[nodes[jd].prev].prio = nodes[nodes[jd].right].prio;
1224
                nodes[nodes[jd].prev].item = nodes[nodes[jd].right].item;
1225
              }
1226
              popRight(pd);
1227
              deleteNode(jd);
1228
              jd = pd;
1229
            } else {
1230
              int ld = nodes[nodes[jd].prev].right;
1231
              popRight(nodes[jd].prev);
1232
              pushLeft(jd, ld);
1233
              if (less(ld, nodes[jd].right)) {
1234
                nodes[jd].item = nodes[ld].item;
1235
                nodes[jd].prio = nodes[jd].prio;
1236
              }
1237
              if (nodes[nodes[jd].prev].item == nodes[ld].item) {
1238
                setPrio(nodes[jd].prev);
1239
              }
1240
              jd = nodes[jd].right;
1241
            }
1242
          }
1243
        } else {
1244
          jd = nodes[jd].right;
1245
        }
1246 1246
      }
... ...
@@ -1278,8 +1278,8 @@
1278 1278
    ///
1279
    /// Constructs the union-find.  
1279
    /// Constructs the union-find.
1280 1280
    /// \brief _index The index map of the union-find. The data
1281 1281
    /// structure uses internally for store references.
1282
    HeapUnionFind(ItemIntMap& _index) 
1283
      : index(_index), first_class(-1), 
1284
	first_free_class(-1), first_free_node(-1) {}
1282
    HeapUnionFind(ItemIntMap& _index)
1283
      : index(_index), first_class(-1),
1284
        first_free_class(-1), first_free_node(-1) {}
1285 1285

	
... ...
@@ -1305,3 +1305,3 @@
1305 1305
      index[item] = id;
1306
      
1306

	
1307 1307
      int class_id = newClass();
... ...
@@ -1312,3 +1312,3 @@
1312 1312
      classes[class_id].right = -1;
1313
      
1313

	
1314 1314
      if (first_class != -1) {
... ...
@@ -1321,3 +1321,3 @@
1321 1321
      nodes[id].parent = ~class_id;
1322
      
1322

	
1323 1323
      return class_id;
... ...
@@ -1334,3 +1334,3 @@
1334 1334
    }
1335
    
1335

	
1336 1336
    /// \brief Joins the classes.
... ...
@@ -1373,3 +1373,3 @@
1373 1373
        classes[classes[l].prev].next = classes[l].next;
1374
        
1374

	
1375 1375
        classes[l].prev = -1;
... ...
@@ -1379,3 +1379,3 @@
1379 1379
        classes[l].parent = class_id;
1380
        
1380

	
1381 1381
      }
... ...
@@ -1457,3 +1457,3 @@
1457 1457
              setPrio(new_parent);
1458
              
1458

	
1459 1459
              classes[r].parent = ~new_parent;
... ...
@@ -1472,4 +1472,4 @@
1472 1472
          } else {
1473
            if (classes[l].depth != 0 && 
1474
                nodes[~(classes[l].parent)].size + 
1473
            if (classes[l].depth != 0 &&
1474
                nodes[~(classes[l].parent)].size +
1475 1475
                nodes[~(classes[r].parent)].size <= cmax) {
... ...
@@ -1478,5 +1478,5 @@
1478 1478
              if (less(~(classes[r].parent), ~(classes[l].parent))) {
1479
                nodes[~(classes[l].parent)].prio = 
1479
                nodes[~(classes[l].parent)].prio =
1480 1480
                  nodes[~(classes[r].parent)].prio;
1481
                nodes[~(classes[l].parent)].item = 
1481
                nodes[~(classes[l].parent)].item =
1482 1482
                  nodes[~(classes[r].parent)].item;
... ...
@@ -1489,3 +1489,3 @@
1489 1489
              setPrio(new_parent);
1490
            
1490

	
1491 1491
              classes[l].parent = ~new_parent;
... ...
@@ -1544,3 +1544,3 @@
1544 1544
        first_class = classes[id].left;
1545
        
1545

	
1546 1546
        if (classes[id].next != -1) {
... ...
@@ -1549,3 +1549,3 @@
1549 1549
        classes[classes[id].prev].next = classes[id].next;
1550
        
1550

	
1551 1551
        deleteClass(id);
... ...
@@ -1559,3 +1559,3 @@
1559 1559
          }
1560
          int r = l;    
1560
          int r = l;
1561 1561
          while (nodes[l].parent >= 0) {
... ...
@@ -1582,3 +1582,3 @@
1582 1582
          repairLeft(cs[i]);
1583
          
1583

	
1584 1584
          *out++ = cs[i];
... ...
@@ -1605,3 +1605,3 @@
1605 1605
    }
1606
      
1606

	
1607 1607
    /// \brief Increase the priority of the current item.
... ...
@@ -1632,3 +1632,3 @@
1632 1632
    }
1633
    
1633

	
1634 1634
    /// \brief Gives back the minimum priority of the class.
... ...
@@ -1648,5 +1648,5 @@
1648 1648
    /// \brief Gives back a representant item of the class.
1649
    /// 
1649
    ///
1650 1650
    /// The representant is indpendent from the priorities of the
1651
    /// items. 
1651
    /// items.
1652 1652
    /// \return Gives back a representant item of the class.
... ...
@@ -1676,8 +1676,8 @@
1676 1676
      int _id, _lid;
1677
      
1677

	
1678 1678
    public:
1679 1679

	
1680
      /// \brief Default constructor 
1680
      /// \brief Default constructor
1681 1681
      ///
1682
      /// Default constructor 
1682
      /// Default constructor
1683 1683
      ItemIt() {}
... ...
@@ -1697,5 +1697,5 @@
1697 1697
          _lid = -1;
1698
        } 
1698
        }
1699 1699
      }
1700
      
1700

	
1701 1701
      /// \brief Increment operator
... ...
@@ -1714,3 +1714,3 @@
1714 1714
      }
1715
      
1715

	
1716 1716
      /// \brief Equality operator
... ...
@@ -1718,3 +1718,3 @@
1718 1718
      /// Equality operator
1719
      bool operator==(const ItemIt& i) { 
1719
      bool operator==(const ItemIt& i) {
1720 1720
        return i._id == _id;
... ...
@@ -1725,3 +1725,3 @@
1725 1725
      /// Inequality operator
1726
      bool operator!=(const ItemIt& i) { 
1726
      bool operator!=(const ItemIt& i) {
1727 1727
        return i._id != _id;
... ...
@@ -1732,3 +1732,3 @@
1732 1732
      /// Equality operator
1733
      bool operator==(Invalid) { 
1733
      bool operator==(Invalid) {
1734 1734
        return _id == _lid;
... ...
@@ -1739,6 +1739,6 @@
1739 1739
      /// Inequality operator
1740
      bool operator!=(Invalid) { 
1740
      bool operator!=(Invalid) {
1741 1741
        return _id != _lid;
1742 1742
      }
1743
      
1743

	
1744 1744
    };
... ...
@@ -1747,3 +1747,3 @@
1747 1747
    ///
1748
    /// The iterator stores 
1748
    /// The iterator stores
1749 1749
    class ClassIt {
... ...
@@ -1756,6 +1756,6 @@
1756 1756

	
1757
      ClassIt(const HeapUnionFind& huf) 
1757
      ClassIt(const HeapUnionFind& huf)
1758 1758
        : _huf(&huf), _id(huf.first_class) {}
1759 1759

	
1760
      ClassIt(const HeapUnionFind& huf, int cls) 
1760
      ClassIt(const HeapUnionFind& huf, int cls)
1761 1761
        : _huf(&huf), _id(huf.classes[cls].left) {}
... ...
@@ -1763,6 +1763,6 @@
1763 1763
      ClassIt(Invalid) : _huf(0), _id(-1) {}
1764
      
1764

	
1765 1765
      const ClassIt& operator++() {
1766 1766
        _id = _huf->classes[_id].next;
1767
	return *this;
1767
        return *this;
1768 1768
      }
... ...
@@ -1772,3 +1772,3 @@
1772 1772
      /// Equality operator
1773
      bool operator==(const ClassIt& i) { 
1773
      bool operator==(const ClassIt& i) {
1774 1774
        return i._id == _id;
... ...
@@ -1779,10 +1779,10 @@
1779 1779
      /// Inequality operator
1780
      bool operator!=(const ClassIt& i) { 
1780
      bool operator!=(const ClassIt& i) {
1781 1781
        return i._id != _id;
1782
      }      
1783
      
1782
      }
1783

	
1784 1784
      operator int() const {
1785
	return _id;
1785
        return _id;
1786 1786
      }
1787
            
1787

	
1788 1788
    };
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -29,3 +29,3 @@
29 29

	
30
void checkBfsCompile() 
30
void checkBfsCompile()
31 31
{
... ...
@@ -33,3 +33,3 @@
33 33
  typedef Bfs<Digraph> BType;
34
  
34

	
35 35
  Digraph G;
... ...
@@ -42,7 +42,7 @@
42 42
  //  BType::PredNodeMap pn(G);
43
  
43

	
44 44
  BType bfs_test(G);
45
  
45

	
46 46
  bfs_test.run(n);
47
  
47

	
48 48
  l  = bfs_test.dist(n);
... ...
@@ -58,3 +58,3 @@
58 58

	
59
void checkBfsFunctionCompile() 
59
void checkBfsFunctionCompile()
60 60
{
... ...
@@ -64,3 +64,3 @@
64 64
  typedef Digraph::Node Node;
65
   
65

	
66 66
  Digraph g;
... ...
@@ -83,9 +83,9 @@
83 83
  PetStruct<Digraph> ps = addPetersen(G, 5);
84
   
84

	
85 85
  s=ps.outer[2];
86 86
  t=ps.inner[0];
87
  
87

	
88 88
  Bfs<Digraph> bfs_test(G);
89 89
  bfs_test.run(s);
90
  
90

	
91 91
  check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t));
... ...
@@ -97,3 +97,3 @@
97 97
  check(pathTarget(G, p) == t,"path() found a wrong path.");
98
  
98

	
99 99

	
... ...
@@ -103,4 +103,4 @@
103 103
    check( !bfs_test.reached(u) ||
104
	   (bfs_test.dist(v) > bfs_test.dist(u)+1),
105
	   "Wrong output.");
104
           (bfs_test.dist(v) > bfs_test.dist(u)+1),
105
           "Wrong output.");
106 106
  }
... ...
@@ -114,5 +114,5 @@
114 114
      check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
115
	    "Wrong distance. Difference: " 
116
	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 
117
			- 1));
115
            "Wrong distance. Difference: "
116
            << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
117
                        - 1));
118 118
    }
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -77,3 +77,3 @@
77 77
  v[0] = 10; v[1] = 60; v[2] = 20; v[3] = 90; v[4] = 100;
78
  v[5] = 80; v[6] = 40; v[7] = 30; v[8] = 50; v[9] = 70; 
78
  v[5] = 80; v[6] = 40; v[7] = 30; v[8] = 50; v[9] = 70;
79 79
}
... ...
@@ -84,3 +84,3 @@
84 84
  counterTest<NoCounter>();
85
  
85

	
86 86
  std::vector<int> x(10);
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -29,3 +29,3 @@
29 29

	
30
void checkDfsCompile() 
30
void checkDfsCompile()
31 31
{
... ...
@@ -33,3 +33,3 @@
33 33
  typedef Dfs<Digraph> DType;
34
  
34

	
35 35
  Digraph G;
... ...
@@ -42,7 +42,7 @@
42 42
  //  DType::PredNodeMap pn(G);
43
  
43

	
44 44
  DType dfs_test(G);
45
  
45

	
46 46
  dfs_test.run(n);
47
  
47

	
48 48
  l  = dfs_test.dist(n);
... ...
@@ -58,3 +58,3 @@
58 58

	
59
void checkDfsFunctionCompile() 
59
void checkDfsFunctionCompile()
60 60
{
... ...
@@ -64,3 +64,3 @@
64 64
  typedef Digraph::Node Node;
65
   
65

	
66 66
  Digraph g;
... ...
@@ -73,3 +73,3 @@
73 73
    .processedMap(concepts::WriteMap<Node,bool>())
74
    .run(Node()); 
74
    .run(Node());
75 75
}
... ...
@@ -83,9 +83,9 @@
83 83
  PetStruct<Digraph> ps = addPetersen(G, 5);
84
   
84

	
85 85
  s=ps.outer[2];
86 86
  t=ps.inner[0];
87
  
87

	
88 88
  Dfs<Digraph> dfs_test(G);
89
  dfs_test.run(s);  
90
  
89
  dfs_test.run(s);
90

	
91 91
  Path<Digraph> p = dfs_test.path(t);
... ...
@@ -95,3 +95,3 @@
95 95
  check(pathTarget(G, p) == t,"path() found a wrong path.");
96
  
96

	
97 97
  for(NodeIt v(G); v!=INVALID; ++v) {
... ...
@@ -103,4 +103,4 @@
103 103
      check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
104
	    "Wrong distance. (" << dfs_test.dist(u) << "->" 
105
	    <<dfs_test.dist(v) << ')');
104
            "Wrong distance. (" << dfs_test.dist(u) << "->"
105
            <<dfs_test.dist(v) << ')');
106 106
    }
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -35,9 +35,9 @@
35 35

	
36
    checkConcept<IDableDigraphComponent<>, 
36
    checkConcept<IDableDigraphComponent<>,
37 37
      IDableDigraphComponent<> >();
38 38

	
39
    checkConcept<IterableDigraphComponent<>, 
39
    checkConcept<IterableDigraphComponent<>,
40 40
      IterableDigraphComponent<> >();
41 41

	
42
    checkConcept<MappableDigraphComponent<>, 
42
    checkConcept<MappableDigraphComponent<>,
43 43
      MappableDigraphComponent<> >();
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -30,3 +30,3 @@
30 30

	
31
void checkDijkstraCompile() 
31
void checkDijkstraCompile()
32 32
{
... ...
@@ -36,3 +36,3 @@
36 36
  typedef Dijkstra<Digraph, LengthMap> DType;
37
  
37

	
38 38
  Digraph G;
... ...
@@ -62,3 +62,3 @@
62 62

	
63
void checkDijkstraFunctionCompile() 
63
void checkDijkstraFunctionCompile()
64 64
{
... ...
@@ -69,3 +69,3 @@
69 69
  typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
70
   
70

	
71 71
  Digraph g;
... ...
@@ -80,3 +80,3 @@
80 80
template <class Digraph>
81
void checkDijkstra() {    
81
void checkDijkstra() {
82 82
  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
... ...
@@ -88,3 +88,3 @@
88 88
  PetStruct<Digraph> ps = addPetersen(G, 5);
89
   
89

	
90 90
  for(int i=0;i<5;i++) {
... ...
@@ -96,7 +96,7 @@
96 96
  t=ps.inner[1];
97
  
98
  Dijkstra<Digraph, LengthMap> 
99
	dijkstra_test(G, length);
97

	
98
  Dijkstra<Digraph, LengthMap>
99
        dijkstra_test(G, length);
100 100
  dijkstra_test.run(s);
101
  
101

	
102 102
  check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
... ...
@@ -108,3 +108,3 @@
108 108
  check(pathTarget(G, p) == t,"path() found a wrong path.");
109
  
109

	
110 110
  for(ArcIt e(G); e!=INVALID; ++e) {
... ...
@@ -113,3 +113,3 @@
113 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]);
114
           "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
115 115
  }
... ...
@@ -123,6 +123,6 @@
123 123
      check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == length[e],
124
	    "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
124
            "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
125 125
    }
126 126
  }
127
  
127

	
128 128
  {
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -60,4 +60,4 @@
60 60
static int cnt = 0;
61
void my_assert_handler(const char*, int, const char*, 
62
		       const char*, const char*) {
61
void my_assert_handler(const char*, int, const char*,
62
                       const char*, const char*) {
63 63
  ++cnt;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -124,3 +124,3 @@
124 124
  }
125
  
125

	
126 126
  ListGraph to;
... ...
@@ -162,8 +162,8 @@
162 162
    check(fem[it] == tem[er[it]], "Wrong copy.");
163
    check(nr[from.u(it)] == to.u(er[it]) || nr[from.u(it)] == to.v(er[it]), 
164
	  "Wrong copy.");
165
    check(nr[from.v(it)] == to.u(er[it]) || nr[from.v(it)] == to.v(er[it]), 
166
	  "Wrong copy.");
167
    check((from.u(it) != from.v(it)) == (to.u(er[it]) != to.v(er[it])), 
168
	  "Wrong copy.");
163
    check(nr[from.u(it)] == to.u(er[it]) || nr[from.u(it)] == to.v(er[it]),
164
          "Wrong copy.");
165
    check(nr[from.v(it)] == to.u(er[it]) || nr[from.v(it)] == to.v(er[it]),
166
          "Wrong copy.");
167
    check((from.u(it) != from.v(it)) == (to.u(er[it]) != to.v(er[it])),
168
          "Wrong copy.");
169 169
  }
... ...
@@ -190,3 +190,3 @@
190 190

	
191
  return 0; 
191
  return 0;
192 192
}
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -73,3 +73,3 @@
73 73
      for (int j = 0; j < i; ++j) {
74
	arcs.push_back(graph.addArc(nodes[i], nodes[j]));
74
        arcs.push_back(graph.addArc(nodes[i], nodes[j]));
75 75
      }
... ...
@@ -86,4 +86,4 @@
86 86
      for (int j = i + 1; j < num; ++j) {
87
	arcs.push_back(graph.addArc(nodes[i], nodes[j]));
88
	map[arcs.back()] = 23;
87
        arcs.push_back(graph.addArc(nodes[i], nodes[j]));
88
        map[arcs.back()] = 23;
89 89
        check(map[arcs.back()] == 23, "Wrong operator[].");
... ...
@@ -115,3 +115,3 @@
115 115
      for (int j = 0; j < i; ++j) {
116
	edges.push_back(graph.addEdge(nodes[i], nodes[j]));
116
        edges.push_back(graph.addEdge(nodes[i], nodes[j]));
117 117
      }
... ...
@@ -128,4 +128,4 @@
128 128
      for (int j = i + 1; j < num; ++j) {
129
	edges.push_back(graph.addEdge(nodes[i], nodes[j]));
130
	map[edges.back()] = 23;
129
        edges.push_back(graph.addEdge(nodes[i], nodes[j]));
130
        map[edges.back()] = 23;
131 131
        check(map[edges.back()] == 23, "Wrong operator[].");
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -35,9 +35,9 @@
35 35

	
36
    checkConcept<IDableGraphComponent<>, 
36
    checkConcept<IDableGraphComponent<>,
37 37
      IDableGraphComponent<> >();
38 38

	
39
    checkConcept<IterableGraphComponent<>, 
39
    checkConcept<IterableGraphComponent<>,
40 40
      IterableGraphComponent<> >();
41 41

	
42
    checkConcept<MappableGraphComponent<>, 
42
    checkConcept<MappableGraphComponent<>,
43 43
      MappableGraphComponent<> >();
... ...
@@ -136,3 +136,3 @@
136 136
//   }
137
  
137

	
138 138
//   for (int i = 0; i < w; ++i) {
... ...
@@ -156,5 +156,5 @@
156 156
//       check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right");
157
//       check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");      
157
//       check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");
158 158
//     }
159
//     check(g.right(g(w - 1, j)) == INVALID, "Wrong right");    
159
//     check(g.right(g(w - 1, j)) == INVALID, "Wrong right");
160 160
//   }
... ...
@@ -164,5 +164,5 @@
164 164
//       check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left");
165
//       check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");      
165
//       check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");
166 166
//     }
167
//     check(g.left(g(0, j)) == INVALID, "Wrong left");    
167
//     check(g.left(g(0, j)) == INVALID, "Wrong left");
168 168
//   }
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -219,3 +219,3 @@
219 219
    }
220
    
220

	
221 221
    return n;
... ...
@@ -248,3 +248,3 @@
248 248
  }
249
  
249

	
250 250
  template <class Graph>
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -142,3 +142,3 @@
142 142
  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
143
  
143

	
144 144
  const int nodeNum = 10;
... ...
@@ -157,3 +157,3 @@
157 157
  for (int i = 0; i < nodeNum; ++i) {
158
    check(inDeg[nodes[i]] == countInArcs(digraph, nodes[i]), 
158
    check(inDeg[nodes[i]] == countInArcs(digraph, nodes[i]),
159 159
          "Wrong in degree map");
... ...
@@ -161,3 +161,3 @@
161 161
  for (int i = 0; i < nodeNum; ++i) {
162
    check(outDeg[nodes[i]] == countOutArcs(digraph, nodes[i]), 
162
    check(outDeg[nodes[i]] == countOutArcs(digraph, nodes[i]),
163 163
          "Wrong out degree map");
... ...
@@ -174,11 +174,11 @@
174 174
  Node n2=g.addNode();
175
  
175

	
176 176
  InDegMap<Digraph> ind(g);
177
  
177

	
178 178
  g.addArc(n1,n2);
179
  
179

	
180 180
  typename Digraph::Snapshot snap(g);
181
  
181

	
182 182
  OutDegMap<Digraph> outd(g);
183
  
183

	
184 184
  check(ind[n1]==0 && ind[n2]==1, "Wrong InDegMap value.");
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -42,38 +42,38 @@
42 42

	
43
char test_lgf[] = 
44
  "@nodes\n" 
45
  "label\n"	
46
  "0\n"	
47
  "1\n"	
48
  "2\n"	
49
  "3\n"	
50
  "4\n"	
51
  "5\n"	
52
  "6\n"	
53
  "7\n"	
54
  "8\n"	
55
  "9\n"	
56
  "@arcs\n" 
57
  "		label	capacity\n"	
58
  "0	5	0	94\n"	
59
  "3	9	1	11\n"	
60
  "8	7	2	83\n"	
61
  "1	2	3	94\n"	
62
  "5	7	4	35\n"	
63
  "7	4	5	84\n"	
64
  "9	5	6	38\n"	
65
  "0	4	7	96\n"	
66
  "6	7	8	6\n"	
67
  "3	1	9	27\n"	
68
  "5	2	10	77\n"	
69
  "5	6	11	69\n"	
70
  "6	5	12	41\n"	
71
  "4	6	13	70\n"	
72
  "3	2	14	45\n"	
73
  "7	9	15	93\n"	
74
  "5	9	16	50\n"	
75
  "9	0	17	94\n"	
76
  "9	6	18	67\n"	
77
  "0	9	19	86\n"	
78
  "@attributes\n" 
43
char test_lgf[] =
44
  "@nodes\n"
45
  "label\n"
46
  "0\n"
47
  "1\n"
48
  "2\n"
49
  "3\n"
50
  "4\n"
51
  "5\n"
52
  "6\n"
53
  "7\n"
54
  "8\n"
55
  "9\n"
56
  "@arcs\n"
57
  "                label        capacity\n"
58
  "0        5        0        94\n"
59
  "3        9        1        11\n"
60
  "8        7        2        83\n"
61
  "1        2        3        94\n"
62
  "5        7        4        35\n"
63
  "7        4        5        84\n"
64
  "9        5        6        38\n"
65
  "0        4        7        96\n"
66
  "6        7        8        6\n"
67
  "3        1        9        27\n"
68
  "5        2        10        77\n"
69
  "5        6        11        69\n"
70
  "6        5        12        41\n"
71
  "4        6        13        70\n"
72
  "3        2        14        45\n"
73
  "7        9        15        93\n"
74
  "5        9        16        50\n"
75
  "9        0        17        94\n"
76
  "9        6        18        67\n"
77
  "0        9        19        86\n"
78
  "@attributes\n"
79 79
  "source 3\n";
... ...
@@ -90,3 +90,3 @@
90 90
  Heap heap(map);
91
  
91

	
92 92
  std::vector<int> v(test_len);
... ...
@@ -109,3 +109,3 @@
109 109
  Heap heap(map);
110
  
110

	
111 111
  std::vector<int> v(test_len);
... ...
@@ -130,5 +130,5 @@
130 130
template <typename Heap>
131
void dijkstraHeapTest(const Digraph& digraph, const IntArcMap& length, 
132
		      Node source) {
133
  
131
void dijkstraHeapTest(const Digraph& digraph, const IntArcMap& length,
132
                      Node source) {
133

	
134 134
  typename Dijkstra<Digraph, IntArcMap>::template DefStandardHeap<Heap>::
... ...
@@ -139,3 +139,3 @@
139 139
  for(ArcIt a(digraph); a != INVALID; ++a) {
140
    Node s = digraph.source(a); 
140
    Node s = digraph.source(a);
141 141
    Node t = digraph.target(a);
... ...
@@ -143,3 +143,3 @@
143 143
      check( dijkstra.dist(t) - dijkstra.dist(s) <= length[a],
144
      	     "Error in a shortest path tree!");
144
                   "Error in a shortest path tree!");
145 145
    }
... ...
@@ -152,3 +152,3 @@
152 152
      check( dijkstra.dist(n) - dijkstra.dist(s) == length[a],
153
	     "Error in a shortest path tree!");
153
             "Error in a shortest path tree!");
154 154
    }
... ...
@@ -163,3 +163,3 @@
163 163
  typedef RangeMap<int> ItemIntMap;
164
  
164

	
165 165
  Digraph digraph;
... ...
@@ -172,4 +172,4 @@
172 172
    node("source", source).
173
    run();  
174
 
173
    run();
174

	
175 175
  {
... ...
@@ -179,3 +179,3 @@
179 179
    heapIncreaseTest<IntHeap>();
180
    
180

	
181 181
    typedef BinHeap<Prio, IntNodeMap > NodeHeap;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -75,3 +75,3 @@
75 75
  Node t=G.addNode();
76
  
76

	
77 77
  Edge e1 = G.addEdge(s, v1);
... ...
@@ -92,3 +92,3 @@
92 92
  EBoolMap tree_map(G);
93
  
93

	
94 94

	
... ...
@@ -96,6 +96,6 @@
96 96
  check(kruskal(G, ConstMap<ListGraph::Edge,int>(2), tree_map)==10,
97
	"Total cost should be 10");
97
        "Total cost should be 10");
98 98
  //Test with an edge map (filled with uniform costs).
99 99
  check(kruskal(G, edge_cost_map, tree_map)==10,
100
	"Total cost should be 10");
100
        "Total cost should be 10");
101 101

	
... ...
@@ -116,6 +116,6 @@
116 116
  check(kruskal(G, edge_cost_map,
117
		 tree_edge_vec.begin())
118
	==-31,
119
	"Total cost should be -31.");
120
  
117
                 tree_edge_vec.begin())
118
        ==-31,
119
        "Total cost should be -31.");
120

	
121 121
  tree_edge_vec.clear();
... ...
@@ -123,14 +123,14 @@
123 123
  check(kruskal(G, edge_cost_map,
124
		back_inserter(tree_edge_vec))
125
	==-31,
126
	"Total cost should be -31.");
127
  
124
                back_inserter(tree_edge_vec))
125
        ==-31,
126
        "Total cost should be -31.");
127

	
128 128
//   tree_edge_vec.clear();
129
  
129

	
130 130
//   //The above test could also be coded like this:
131 131
//   check(kruskal(G,
132
// 		makeKruskalMapInput(G, edge_cost_map),
133
// 		makeKruskalSequenceOutput(back_inserter(tree_edge_vec)))
134
// 	==-31,
135
// 	"Total cost should be -31.");
132
//                 makeKruskalMapInput(G, edge_cost_map),
133
//                 makeKruskalSequenceOutput(back_inserter(tree_edge_vec)))
134
//         ==-31,
135
//         "Total cost should be -31.");
136 136

	
... ...
@@ -139,7 +139,7 @@
139 139
  check(tree_edge_vec[0]==e1 &&
140
	tree_edge_vec[1]==e2 &&
141
	tree_edge_vec[2]==e5 &&
142
	tree_edge_vec[3]==e7 &&
143
	tree_edge_vec[4]==e9,
144
	"Wrong tree.");
140
        tree_edge_vec[1]==e2 &&
141
        tree_edge_vec[2]==e5 &&
142
        tree_edge_vec[3]==e7 &&
143
        tree_edge_vec[4]==e9,
144
        "Wrong tree.");
145 145

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -306,3 +306,3 @@
306 306
  }
307
  
307

	
308 308
  // LoggerBoolMap
... ...
@@ -322,3 +322,3 @@
322 322
          "Something is wrong with LoggerBoolMap");
323
          
323

	
324 324
    int i = 0;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -41,3 +41,3 @@
41 41
int main() {
42
  check_concepts();  
42
  check_concepts();
43 43
  return 0;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -35,4 +35,4 @@
35 35
  lemon::rnd.seed(100);
36
  lemon::rnd.seed(seed_array, seed_array + 
37
		  (sizeof(seed_array) / sizeof(seed_array[0])));
36
  lemon::rnd.seed(seed_array, seed_array +
37
                  (sizeof(seed_array) / sizeof(seed_array[0])));
38 38

	
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -20,3 +20,3 @@
20 20

	
21
int main() 
21
int main()
22 22
{
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -20,3 +20,3 @@
20 20

	
21
int main() 
21
int main()
22 22
{
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -22,3 +22,3 @@
22 22

	
23
void f() 
23
void f()
24 24
{
... ...
@@ -29,6 +29,6 @@
29 29

	
30
void g() 
30
void g()
31 31
{
32 32
  static Timer T;
33
  
33

	
34 34
  for(int i=0;i<1000;i++)
... ...
@@ -51,3 +51,3 @@
51 51
  std::cout << "Total: " << full << "\n";
52
  
52

	
53 53
  t=runningTimeTest(g,1,&n,&full);
... ...
@@ -55,3 +55,3 @@
55 55
  std::cout << "Total: " << full << "\n";
56
  
56

	
57 57
  return 0;
Ignore white space 6 line context
1
/* -*- C++ -*-
1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3
 * This file is a part of LEMON, a generic C++ optimization library
3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
... ...
@@ -33,3 +33,3 @@
33 33
  vector<ListGraph::Node> n;
34
  
34

	
35 35
  for(int i=0;i<20;i++) n.push_back(g.addNode());
0 comments (0 inline)