↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -52,51 +52,51 @@
52 52
  template <typename PR, typename IM, typename Comp = std::less<PR> >
53 53
  class BinHeap {
54 54

	
55 55
  public:
56 56
    ///\e
57 57
    typedef IM ItemIntMap;
58 58
    ///\e
59 59
    typedef PR Prio;
60 60
    ///\e
61 61
    typedef typename ItemIntMap::Key Item;
62 62
    ///\e
63 63
    typedef std::pair<Item,Prio> Pair;
64 64
    ///\e
65 65
    typedef Comp Compare;
66 66

	
67 67
    /// \brief Type to represent the items states.
68 68
    ///
69 69
    /// Each Item element have a state associated to it. It may be "in heap",
70 70
    /// "pre heap" or "post heap". The latter two are indifferent from the
71 71
    /// heap's point of view, but may be useful to the user.
72 72
    ///
73 73
    /// The item-int map must be initialized in such way that it assigns
74 74
    /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
75 75
    enum State {
76
      IN_HEAP = 0,    ///< \e
77
      PRE_HEAP = -1,  ///< \e
78
      POST_HEAP = -2  ///< \e
76
      IN_HEAP = 0,    ///< = 0.
77
      PRE_HEAP = -1,  ///< = -1.
78
      POST_HEAP = -2  ///< = -2.
79 79
    };
80 80

	
81 81
  private:
82 82
    std::vector<Pair> _data;
83 83
    Compare _comp;
84 84
    ItemIntMap &_iim;
85 85

	
86 86
  public:
87 87
    /// \brief The constructor.
88 88
    ///
89 89
    /// The constructor.
90 90
    /// \param map should be given to the constructor, since it is used
91 91
    /// internally to handle the cross references. The value of the map
92 92
    /// must be \c PRE_HEAP (<tt>-1</tt>) for every item.
93 93
    explicit BinHeap(ItemIntMap &map) : _iim(map) {}
94 94

	
95 95
    /// \brief The constructor.
96 96
    ///
97 97
    /// The constructor.
98 98
    /// \param map should be given to the constructor, since it is used
99 99
    /// internally to handle the cross references. The value of the map
100 100
    /// should be PRE_HEAP (-1) for each element.
101 101
    ///
102 102
    /// \param comp The comparator function object.
Ignore white space 48 line context
... ...
@@ -581,49 +581,49 @@
581 581
          e = it2;
582 582
        }
583 583
        const Base& node;
584 584
        const GR& graph;
585 585
      };
586 586
    };
587 587

	
588 588
    /// \brief Skeleton class for iterable directed graphs.
589 589
    ///
590 590
    /// This class describes the interface of iterable directed
591 591
    /// graphs. It extends \ref BaseDigraphComponent with the core
592 592
    /// iterable interface.
593 593
    /// This concept is part of the Digraph concept.
594 594
    template <typename BAS = BaseDigraphComponent>
595 595
    class IterableDigraphComponent : public BAS {
596 596

	
597 597
    public:
598 598

	
599 599
      typedef BAS Base;
600 600
      typedef typename Base::Node Node;
601 601
      typedef typename Base::Arc Arc;
602 602

	
603 603
      typedef IterableDigraphComponent Digraph;
604 604

	
605
      /// \name Base iteration
605
      /// \name Base Iteration
606 606
      ///
607 607
      /// This interface provides functions for iteration on digraph items.
608 608
      ///
609 609
      /// @{
610 610

	
611 611
      /// \brief Return the first node.
612 612
      ///
613 613
      /// This function gives back the first node in the iteration order.
614 614
      void first(Node&) const {}
615 615

	
616 616
      /// \brief Return the next node.
617 617
      ///
618 618
      /// This function gives back the next node in the iteration order.
619 619
      void next(Node&) const {}
620 620

	
621 621
      /// \brief Return the first arc.
622 622
      ///
623 623
      /// This function gives back the first arc in the iteration order.
624 624
      void first(Arc&) const {}
625 625

	
626 626
      /// \brief Return the next arc.
627 627
      ///
628 628
      /// This function gives back the next arc in the iteration order.
629 629
      void next(Arc&) const {}
... ...
@@ -633,49 +633,49 @@
633 633
      /// This function gives back the first arc incomming to the
634 634
      /// given node.
635 635
      void firstIn(Arc&, const Node&) const {}
636 636

	
637 637
      /// \brief Return the next arc incomming to the given node.
638 638
      ///
639 639
      /// This function gives back the next arc incomming to the
640 640
      /// given node.
641 641
      void nextIn(Arc&) const {}
642 642

	
643 643
      /// \brief Return the first arc outgoing form the given node.
644 644
      ///
645 645
      /// This function gives back the first arc outgoing form the
646 646
      /// given node.
647 647
      void firstOut(Arc&, const Node&) const {}
648 648

	
649 649
      /// \brief Return the next arc outgoing form the given node.
650 650
      ///
651 651
      /// This function gives back the next arc outgoing form the
652 652
      /// given node.
653 653
      void nextOut(Arc&) const {}
654 654

	
655 655
      /// @}
656 656

	
657
      /// \name Class based iteration
657
      /// \name Class Based Iteration
658 658
      ///
659 659
      /// This interface provides iterator classes for digraph items.
660 660
      ///
661 661
      /// @{
662 662

	
663 663
      /// \brief This iterator goes through each node.
664 664
      ///
665 665
      /// This iterator goes through each node.
666 666
      ///
667 667
      typedef GraphItemIt<Digraph, Node> NodeIt;
668 668

	
669 669
      /// \brief This iterator goes through each arc.
670 670
      ///
671 671
      /// This iterator goes through each arc.
672 672
      ///
673 673
      typedef GraphItemIt<Digraph, Arc> ArcIt;
674 674

	
675 675
      /// \brief This iterator goes trough the incoming arcs of a node.
676 676
      ///
677 677
      /// This iterator goes trough the \e incoming arcs of a certain node
678 678
      /// of a digraph.
679 679
      typedef GraphIncIt<Digraph, Arc, Node, 'i'> InArcIt;
680 680

	
681 681
      /// \brief This iterator goes trough the outgoing arcs of a node.
... ...
@@ -758,88 +758,88 @@
758 758
        }
759 759

	
760 760
        const _Digraph& digraph;
761 761
      };
762 762
    };
763 763

	
764 764
    /// \brief Skeleton class for iterable undirected graphs.
765 765
    ///
766 766
    /// This class describes the interface of iterable undirected
767 767
    /// graphs. It extends \ref IterableDigraphComponent with the core
768 768
    /// iterable interface of undirected graphs.
769 769
    /// This concept is part of the Graph concept.
770 770
    template <typename BAS = BaseGraphComponent>
771 771
    class IterableGraphComponent : public IterableDigraphComponent<BAS> {
772 772
    public:
773 773

	
774 774
      typedef BAS Base;
775 775
      typedef typename Base::Node Node;
776 776
      typedef typename Base::Arc Arc;
777 777
      typedef typename Base::Edge Edge;
778 778

	
779 779

	
780 780
      typedef IterableGraphComponent Graph;
781 781

	
782
      /// \name Base iteration
782
      /// \name Base Iteration
783 783
      ///
784 784
      /// This interface provides functions for iteration on edges.
785 785
      ///
786 786
      /// @{
787 787

	
788 788
      using IterableDigraphComponent<Base>::first;
789 789
      using IterableDigraphComponent<Base>::next;
790 790

	
791 791
      /// \brief Return the first edge.
792 792
      ///
793 793
      /// This function gives back the first edge in the iteration order.
794 794
      void first(Edge&) const {}
795 795

	
796 796
      /// \brief Return the next edge.
797 797
      ///
798 798
      /// This function gives back the next edge in the iteration order.
799 799
      void next(Edge&) const {}
800 800

	
801 801
      /// \brief Return the first edge incident to the given node.
802 802
      ///
803 803
      /// This function gives back the first edge incident to the given 
804 804
      /// node. The bool parameter gives back the direction for which the
805 805
      /// source node of the directed arc representing the edge is the 
806 806
      /// given node.
807 807
      void firstInc(Edge&, bool&, const Node&) const {}
808 808

	
809 809
      /// \brief Gives back the next of the edges from the
810 810
      /// given node.
811 811
      ///
812 812
      /// This function gives back the next edge incident to the given 
813 813
      /// node. The bool parameter should be used as \c firstInc() use it.
814 814
      void nextInc(Edge&, bool&) const {}
815 815

	
816 816
      using IterableDigraphComponent<Base>::baseNode;
817 817
      using IterableDigraphComponent<Base>::runningNode;
818 818

	
819 819
      /// @}
820 820

	
821
      /// \name Class based iteration
821
      /// \name Class Based Iteration
822 822
      ///
823 823
      /// This interface provides iterator classes for edges.
824 824
      ///
825 825
      /// @{
826 826

	
827 827
      /// \brief This iterator goes through each edge.
828 828
      ///
829 829
      /// This iterator goes through each edge.
830 830
      typedef GraphItemIt<Graph, Edge> EdgeIt;
831 831

	
832 832
      /// \brief This iterator goes trough the incident edges of a
833 833
      /// node.
834 834
      ///
835 835
      /// This iterator goes trough the incident edges of a certain
836 836
      /// node of a graph.
837 837
      typedef GraphIncIt<Graph, Edge, Node, 'e'> IncEdgeIt;
838 838

	
839 839
      /// \brief The base node of the iterator.
840 840
      ///
841 841
      /// This function gives back the base node of the iterator.
842 842
      Node baseNode(const IncEdgeIt&) const { return INVALID; }
843 843

	
844 844
      /// \brief The running node of the iterator.
845 845
      ///
Ignore white space 6 line context
... ...
@@ -50,51 +50,51 @@
50 50
    template <typename PR, typename IM, typename Comp = std::less<PR> >
51 51
#else
52 52
    template <typename PR, typename IM>
53 53
#endif
54 54
    class Heap {
55 55
    public:
56 56

	
57 57
      /// Type of the item-int map.
58 58
      typedef IM ItemIntMap;
59 59
      /// Type of the priorities.
60 60
      typedef PR Prio;
61 61
      /// Type of the items stored in the heap.
62 62
      typedef typename ItemIntMap::Key Item;
63 63

	
64 64
      /// \brief Type to represent the states of the items.
65 65
      ///
66 66
      /// Each item has a state associated to it. It can be "in heap",
67 67
      /// "pre heap" or "post heap". The later two are indifferent
68 68
      /// from the point of view of the heap, but may be useful for
69 69
      /// the user.
70 70
      ///
71 71
      /// The item-int map must be initialized in such way that it assigns
72 72
      /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
73 73
      enum State {
74
        IN_HEAP = 0,    ///< The "in heap" state constant.
75
        PRE_HEAP = -1,  ///< The "pre heap" state constant.
76
        POST_HEAP = -2  ///< The "post heap" state constant.
74
        IN_HEAP = 0,    ///< = 0. The "in heap" state constant.
75
        PRE_HEAP = -1,  ///< = -1. The "pre heap" state constant.
76
        POST_HEAP = -2  ///< = -2. The "post heap" state constant.
77 77
      };
78 78

	
79 79
      /// \brief The constructor.
80 80
      ///
81 81
      /// The constructor.
82 82
      /// \param map A map that assigns \c int values to keys of type
83 83
      /// \c Item. It is used internally by the heap implementations to
84 84
      /// handle the cross references. The assigned value must be
85 85
      /// \c PRE_HEAP (<tt>-1</tt>) for every item.
86 86
      explicit Heap(ItemIntMap &map) {}
87 87

	
88 88
      /// \brief The number of items stored in the heap.
89 89
      ///
90 90
      /// Returns the number of items stored in the heap.
91 91
      int size() const { return 0; }
92 92

	
93 93
      /// \brief Checks if the heap is empty.
94 94
      ///
95 95
      /// Returns \c true if the heap is empty.
96 96
      bool empty() const { return false; }
97 97

	
98 98
      /// \brief Makes the heap empty.
99 99
      ///
100 100
      /// Makes the heap empty.
Ignore white space 6 line context
... ...
@@ -185,49 +185,49 @@
185 185
        _pred = Traits::createPredMap(*G);
186 186
      }
187 187
      if(!_dist) {
188 188
        local_dist = true;
189 189
        _dist = Traits::createDistMap(*G);
190 190
      }
191 191
      if(!_reached) {
192 192
        local_reached = true;
193 193
        _reached = Traits::createReachedMap(*G);
194 194
      }
195 195
      if(!_processed) {
196 196
        local_processed = true;
197 197
        _processed = Traits::createProcessedMap(*G);
198 198
      }
199 199
    }
200 200

	
201 201
  protected:
202 202

	
203 203
    Dfs() {}
204 204

	
205 205
  public:
206 206

	
207 207
    typedef Dfs Create;
208 208

	
209
    ///\name Named template parameters
209
    ///\name Named Template Parameters
210 210

	
211 211
    ///@{
212 212

	
213 213
    template <class T>
214 214
    struct SetPredMapTraits : public Traits {
215 215
      typedef T PredMap;
216 216
      static PredMap *createPredMap(const Digraph &)
217 217
      {
218 218
        LEMON_ASSERT(false, "PredMap is not initialized");
219 219
        return 0; // ignore warnings
220 220
      }
221 221
    };
222 222
    ///\brief \ref named-templ-param "Named parameter" for setting
223 223
    ///\c PredMap type.
224 224
    ///
225 225
    ///\ref named-templ-param "Named parameter" for setting
226 226
    ///\c PredMap type.
227 227
    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
228 228
    template <class T>
229 229
    struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > {
230 230
      typedef Dfs<Digraph, SetPredMapTraits<T> > Create;
231 231
    };
232 232

	
233 233
    template <class T>
Ignore white space 6 line context
... ...
@@ -265,49 +265,49 @@
265 265
        _pred = Traits::createPredMap(*G);
266 266
      }
267 267
      if(!_dist) {
268 268
        local_dist = true;
269 269
        _dist = Traits::createDistMap(*G);
270 270
      }
271 271
      if(!_processed) {
272 272
        local_processed = true;
273 273
        _processed = Traits::createProcessedMap(*G);
274 274
      }
275 275
      if (!_heap_cross_ref) {
276 276
        local_heap_cross_ref = true;
277 277
        _heap_cross_ref = Traits::createHeapCrossRef(*G);
278 278
      }
279 279
      if (!_heap) {
280 280
        local_heap = true;
281 281
        _heap = Traits::createHeap(*_heap_cross_ref);
282 282
      }
283 283
    }
284 284

	
285 285
  public:
286 286

	
287 287
    typedef Dijkstra Create;
288 288

	
289
    ///\name Named template parameters
289
    ///\name Named Template Parameters
290 290

	
291 291
    ///@{
292 292

	
293 293
    template <class T>
294 294
    struct SetPredMapTraits : public Traits {
295 295
      typedef T PredMap;
296 296
      static PredMap *createPredMap(const Digraph &)
297 297
      {
298 298
        LEMON_ASSERT(false, "PredMap is not initialized");
299 299
        return 0; // ignore warnings
300 300
      }
301 301
    };
302 302
    ///\brief \ref named-templ-param "Named parameter" for setting
303 303
    ///\c PredMap type.
304 304
    ///
305 305
    ///\ref named-templ-param "Named parameter" for setting
306 306
    ///\c PredMap type.
307 307
    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
308 308
    template <class T>
309 309
    struct SetPredMap
310 310
      : public Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > {
311 311
      typedef Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > Create;
312 312
    };
313 313

	
Ignore white space 6 line context
... ...
@@ -16,109 +16,113 @@
16 16
 *
17 17
 */
18 18

	
19 19
#ifndef LEMON_DIMACS_H
20 20
#define LEMON_DIMACS_H
21 21

	
22 22
#include <iostream>
23 23
#include <string>
24 24
#include <vector>
25 25
#include <limits>
26 26
#include <lemon/maps.h>
27 27
#include <lemon/error.h>
28 28
/// \ingroup dimacs_group
29 29
/// \file
30 30
/// \brief DIMACS file format reader.
31 31

	
32 32
namespace lemon {
33 33

	
34 34
  /// \addtogroup dimacs_group
35 35
  /// @{
36 36

	
37 37
  /// DIMACS file type descriptor.
38 38
  struct DimacsDescriptor
39 39
  {
40
    ///File type enum
41
    enum Type
42
      {
43
        NONE, MIN, MAX, SP, MAT
44
      };
40
    ///\brief DIMACS file type enum
41
    ///
42
    ///DIMACS file type enum.
43
    enum Type {
44
      NONE,  ///< Undefined type.
45
      MIN,   ///< DIMACS file type for minimum cost flow problems.
46
      MAX,   ///< DIMACS file type for maximum flow problems.
47
      SP,    ///< DIMACS file type for shostest path problems.
48
      MAT    ///< DIMACS file type for plain graphs and matching problems.
49
    };
45 50
    ///The file type
46 51
    Type type;
47 52
    ///The number of nodes in the graph
48 53
    int nodeNum;
49 54
    ///The number of edges in the graph
50 55
    int edgeNum;
51 56
    int lineShift;
52
    /// Constructor. Sets the type to NONE.
57
    ///Constructor. It sets the type to \c NONE.
53 58
    DimacsDescriptor() : type(NONE) {}
54 59
  };
55 60

	
56 61
  ///Discover the type of a DIMACS file
57 62

	
58
  ///It starts seeking the beginning of the file for the problem type
59
  ///and size info. The found data is returned in a special struct
60
  ///that can be evaluated and passed to the appropriate reader
61
  ///function.
63
  ///This function starts seeking the beginning of the given file for the
64
  ///problem type and size info. 
65
  ///The found data is returned in a special struct that can be evaluated
66
  ///and passed to the appropriate reader function.
62 67
  DimacsDescriptor dimacsType(std::istream& is)
63 68
  {
64 69
    DimacsDescriptor r;
65 70
    std::string problem,str;
66 71
    char c;
67 72
    r.lineShift=0;
68 73
    while (is >> c)
69 74
      switch(c)
70 75
        {
71 76
        case 'p':
72 77
          if(is >> problem >> r.nodeNum >> r.edgeNum)
73 78
            {
74 79
              getline(is, str);
75 80
              r.lineShift++;
76 81
              if(problem=="min") r.type=DimacsDescriptor::MIN;
77 82
              else if(problem=="max") r.type=DimacsDescriptor::MAX;
78 83
              else if(problem=="sp") r.type=DimacsDescriptor::SP;
79 84
              else if(problem=="mat") r.type=DimacsDescriptor::MAT;
80 85
              else throw FormatError("Unknown problem type");
81 86
              return r;
82 87
            }
83 88
          else
84 89
            {
85 90
              throw FormatError("Missing or wrong problem type declaration.");
86 91
            }
87 92
          break;
88 93
        case 'c':
89 94
          getline(is, str);
90 95
          r.lineShift++;
91 96
          break;
92 97
        default:
93 98
          throw FormatError("Unknown DIMACS declaration.");
94 99
        }
95 100
    throw FormatError("Missing problem type declaration.");
96 101
  }
97 102

	
98 103

	
99

	
100
  /// DIMACS minimum cost flow reader function.
104
  /// \brief DIMACS minimum cost flow reader function.
101 105
  ///
102 106
  /// This function reads a minimum cost flow instance from DIMACS format,
103 107
  /// i.e. from a DIMACS file having a line starting with
104 108
  /// \code
105 109
  ///   p min
106 110
  /// \endcode
107 111
  /// At the beginning, \c g is cleared by \c g.clear(). The supply
108 112
  /// amount of the nodes are written to the \c supply node map
109 113
  /// (they are signed values). The lower bounds, capacities and costs
110 114
  /// of the arcs are written to the \c lower, \c capacity and \c cost
111 115
  /// arc maps.
112 116
  ///
113 117
  /// If the capacity of an arc is less than the lower bound, it will
114 118
  /// be set to "infinite" instead. The actual value of "infinite" is
115 119
  /// contolled by the \c infty parameter. If it is 0 (the default value),
116 120
  /// \c std::numeric_limits<Capacity>::infinity() will be used if available,
117 121
  /// \c std::numeric_limits<Capacity>::max() otherwise. If \c infty is set to
118 122
  /// a non-zero value, that value will be used as "infinite".
119 123
  ///
120 124
  /// If the file type was previously evaluated by dimacsType(), then
121 125
  /// the descriptor struct should be given by the \c dest parameter.
122 126
  template <typename Digraph, typename LowerMap,
123 127
            typename CapacityMap, typename CostMap,
124 128
            typename SupplyMap>
... ...
@@ -232,159 +236,159 @@
232 236
          is >> i >> j >> _cap;
233 237
          getline(is, str);
234 238
          e = g.addArc(nodes[i], nodes[j]);
235 239
          capacity.set(e, _cap);
236 240
        } 
237 241
        else if (desc.type==DimacsDescriptor::MAX) {
238 242
          is >> i >> j >> _cap;
239 243
          getline(is, str);
240 244
          e = g.addArc(nodes[i], nodes[j]);
241 245
          if (_cap >= 0)
242 246
            capacity.set(e, _cap);
243 247
          else
244 248
            capacity.set(e, infty);
245 249
        }
246 250
        else {
247 251
          is >> i >> j;
248 252
          getline(is, str);
249 253
          g.addArc(nodes[i], nodes[j]);
250 254
        }
251 255
        break;
252 256
      }
253 257
    }
254 258
  }
255 259

	
256
  /// DIMACS maximum flow reader function.
260
  /// \brief DIMACS maximum flow reader function.
257 261
  ///
258 262
  /// This function reads a maximum flow instance from DIMACS format,
259 263
  /// i.e. from a DIMACS file having a line starting with
260 264
  /// \code
261 265
  ///   p max
262 266
  /// \endcode
263 267
  /// At the beginning, \c g is cleared by \c g.clear(). The arc
264 268
  /// capacities are written to the \c capacity arc map and \c s and
265 269
  /// \c t are set to the source and the target nodes.
266 270
  ///
267 271
  /// If the capacity of an arc is negative, it will
268 272
  /// be set to "infinite" instead. The actual value of "infinite" is
269 273
  /// contolled by the \c infty parameter. If it is 0 (the default value),
270 274
  /// \c std::numeric_limits<Capacity>::infinity() will be used if available,
271 275
  /// \c std::numeric_limits<Capacity>::max() otherwise. If \c infty is set to
272 276
  /// a non-zero value, that value will be used as "infinite".
273 277
  ///
274 278
  /// If the file type was previously evaluated by dimacsType(), then
275 279
  /// the descriptor struct should be given by the \c dest parameter.
276 280
  template<typename Digraph, typename CapacityMap>
277 281
  void readDimacsMax(std::istream& is,
278 282
                     Digraph &g,
279 283
                     CapacityMap& capacity,
280 284
                     typename Digraph::Node &s,
281 285
                     typename Digraph::Node &t,
282 286
                     typename CapacityMap::Value infty = 0,
283 287
                     DimacsDescriptor desc=DimacsDescriptor()) {
284 288
    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
285 289
    if(desc.type!=DimacsDescriptor::MAX)
286 290
      throw FormatError("Problem type mismatch");
287 291
    _readDimacs(is,g,capacity,s,t,infty,desc);
288 292
  }
289 293

	
290
  /// DIMACS shortest path reader function.
294
  /// \brief DIMACS shortest path reader function.
291 295
  ///
292 296
  /// This function reads a shortest path instance from DIMACS format,
293 297
  /// i.e. from a DIMACS file having a line starting with
294 298
  /// \code
295 299
  ///   p sp
296 300
  /// \endcode
297 301
  /// At the beginning, \c g is cleared by \c g.clear(). The arc
298 302
  /// lengths are written to the \c length arc map and \c s is set to the
299 303
  /// source node.
300 304
  ///
301 305
  /// If the file type was previously evaluated by dimacsType(), then
302 306
  /// the descriptor struct should be given by the \c dest parameter.
303 307
  template<typename Digraph, typename LengthMap>
304 308
  void readDimacsSp(std::istream& is,
305 309
                    Digraph &g,
306 310
                    LengthMap& length,
307 311
                    typename Digraph::Node &s,
308 312
                    DimacsDescriptor desc=DimacsDescriptor()) {
309 313
    typename Digraph::Node t;
310 314
    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
311 315
    if(desc.type!=DimacsDescriptor::SP)
312 316
      throw FormatError("Problem type mismatch");
313 317
    _readDimacs(is, g, length, s, t, 0, desc);
314 318
  }
315 319

	
316
  /// DIMACS capacitated digraph reader function.
320
  /// \brief DIMACS capacitated digraph reader function.
317 321
  ///
318 322
  /// This function reads an arc capacitated digraph instance from
319 323
  /// DIMACS 'max' or 'sp' format.
320 324
  /// At the beginning, \c g is cleared by \c g.clear()
321 325
  /// and the arc capacities/lengths are written to the \c capacity
322 326
  /// arc map.
323 327
  ///
324 328
  /// In case of the 'max' format, if the capacity of an arc is negative,
325 329
  /// it will
326 330
  /// be set to "infinite" instead. The actual value of "infinite" is
327 331
  /// contolled by the \c infty parameter. If it is 0 (the default value),
328 332
  /// \c std::numeric_limits<Capacity>::infinity() will be used if available,
329 333
  /// \c std::numeric_limits<Capacity>::max() otherwise. If \c infty is set to
330 334
  /// a non-zero value, that value will be used as "infinite".
331 335
  ///
332 336
  /// If the file type was previously evaluated by dimacsType(), then
333 337
  /// the descriptor struct should be given by the \c dest parameter.
334 338
  template<typename Digraph, typename CapacityMap>
335 339
  void readDimacsCap(std::istream& is,
336 340
                     Digraph &g,
337 341
                     CapacityMap& capacity,
338 342
                     typename CapacityMap::Value infty = 0,
339 343
                     DimacsDescriptor desc=DimacsDescriptor()) {
340 344
    typename Digraph::Node u,v;
341 345
    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
342 346
    if(desc.type!=DimacsDescriptor::MAX || desc.type!=DimacsDescriptor::SP)
343 347
      throw FormatError("Problem type mismatch");
344 348
    _readDimacs(is, g, capacity, u, v, infty, desc);
345 349
  }
346 350

	
347 351
  template<typename Graph>
348 352
  typename enable_if<lemon::UndirectedTagIndicator<Graph>,void>::type
349 353
  _addArcEdge(Graph &g, typename Graph::Node s, typename Graph::Node t,
350 354
              dummy<0> = 0)
351 355
  {
352 356
    g.addEdge(s,t);
353 357
  }
354 358
  template<typename Graph>
355 359
  typename disable_if<lemon::UndirectedTagIndicator<Graph>,void>::type
356 360
  _addArcEdge(Graph &g, typename Graph::Node s, typename Graph::Node t,
357 361
              dummy<1> = 1)
358 362
  {
359 363
    g.addArc(s,t);
360 364
  }
361 365
  
362
  /// DIMACS plain (di)graph reader function.
366
  /// \brief DIMACS plain (di)graph reader function.
363 367
  ///
364
  /// This function reads a (di)graph without any designated nodes and
365
  /// maps from DIMACS format, i.e. from DIMACS files having a line
366
  /// starting with
368
  /// This function reads a plain (di)graph without any designated nodes
369
  /// and maps (e.g. a matching instance) from DIMACS format, i.e. from 
370
  /// DIMACS files having a line starting with
367 371
  /// \code
368 372
  ///   p mat
369 373
  /// \endcode
370 374
  /// At the beginning, \c g is cleared by \c g.clear().
371 375
  ///
372 376
  /// If the file type was previously evaluated by dimacsType(), then
373 377
  /// the descriptor struct should be given by the \c dest parameter.
374 378
  template<typename Graph>
375 379
  void readDimacsMat(std::istream& is, Graph &g,
376 380
                     DimacsDescriptor desc=DimacsDescriptor())
377 381
  {
378 382
    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
379 383
    if(desc.type!=DimacsDescriptor::MAT)
380 384
      throw FormatError("Problem type mismatch");
381 385

	
382 386
    g.clear();
383 387
    std::vector<typename Graph::Node> nodes;
384 388
    char c;
385 389
    int i, j;
386 390
    std::string str;
387 391
    nodes.resize(desc.nodeNum + 1);
388 392
    for (int k = 1; k <= desc.nodeNum; ++k) {
389 393
      nodes[k] = g.addNode();
390 394
    }
Ignore white space 6 line context
... ...
@@ -247,64 +247,60 @@
247 247
  typedef typename Graph::ArcIt ArcIt;
248 248
  typedef typename Graph::InArcIt InArcIt;
249 249
  typedef typename Graph::OutArcIt OutArcIt;
250 250

	
251 251
  static const int INTERPOL_PREC;
252 252
  static const double A4HEIGHT;
253 253
  static const double A4WIDTH;
254 254
  static const double A4BORDER;
255 255

	
256 256
  bool dontPrint;
257 257

	
258 258
public:
259 259
  ///Node shapes
260 260

	
261 261
  ///Node shapes.
262 262
  ///
263 263
  enum NodeShapes {
264 264
    /// = 0
265 265
    ///\image html nodeshape_0.png
266 266
    ///\image latex nodeshape_0.eps "CIRCLE shape (0)" width=2cm
267 267
    CIRCLE=0,
268 268
    /// = 1
269 269
    ///\image html nodeshape_1.png
270 270
    ///\image latex nodeshape_1.eps "SQUARE shape (1)" width=2cm
271
    ///
272 271
    SQUARE=1,
273 272
    /// = 2
274 273
    ///\image html nodeshape_2.png
275 274
    ///\image latex nodeshape_2.eps "DIAMOND shape (2)" width=2cm
276
    ///
277 275
    DIAMOND=2,
278 276
    /// = 3
279 277
    ///\image html nodeshape_3.png
280
    ///\image latex nodeshape_2.eps "MALE shape (4)" width=2cm
281
    ///
278
    ///\image latex nodeshape_3.eps "MALE shape (3)" width=2cm
282 279
    MALE=3,
283 280
    /// = 4
284 281
    ///\image html nodeshape_4.png
285
    ///\image latex nodeshape_2.eps "FEMALE shape (4)" width=2cm
286
    ///
282
    ///\image latex nodeshape_4.eps "FEMALE shape (4)" width=2cm
287 283
    FEMALE=4
288 284
  };
289 285

	
290 286
private:
291 287
  class arcLess {
292 288
    const Graph &g;
293 289
  public:
294 290
    arcLess(const Graph &_g) : g(_g) {}
295 291
    bool operator()(Arc a,Arc b) const
296 292
    {
297 293
      Node ai=std::min(g.source(a),g.target(a));
298 294
      Node aa=std::max(g.source(a),g.target(a));
299 295
      Node bi=std::min(g.source(b),g.target(b));
300 296
      Node ba=std::max(g.source(b),g.target(b));
301 297
      return ai<bi ||
302 298
        (ai==bi && (aa < ba ||
303 299
                    (aa==ba && ai==g.source(a) && bi==g.target(b))));
304 300
    }
305 301
  };
306 302
  bool isParallel(Arc e,Arc f) const
307 303
  {
308 304
    return (g.source(e)==g.source(f)&&
309 305
            g.target(e)==g.target(f)) ||
310 306
      (g.source(e)==g.target(f)&&
Ignore white space 6 line context
... ...
@@ -227,103 +227,101 @@
227 227

	
228 228
      static Value kruskal(const Graph& graph, const In& in, Out& out) {
229 229
        typedef LoggerBoolMap<typename RemoveConst<Out>::type> Map;
230 230
        Map map(out);
231 231
        return _kruskal_bits::kruskal(graph, in, map);
232 232
      }
233 233

	
234 234
    };
235 235

	
236 236
    template <typename Graph, typename In, typename Out>
237 237
    struct KruskalOutputSelector<Graph, In, Out,
238 238
      typename enable_if<MapOutputIndicator<Out>, void>::type >
239 239
    {
240 240
      typedef typename In::value_type::second_type Value;
241 241

	
242 242
      static Value kruskal(const Graph& graph, const In& in, Out& out) {
243 243
        return _kruskal_bits::kruskal(graph, in, out);
244 244
      }
245 245
    };
246 246

	
247 247
  }
248 248

	
249 249
  /// \ingroup spantree
250 250
  ///
251
  /// \brief Kruskal algorithm to find a minimum cost spanning tree of
251
  /// \brief Kruskal's algorithm for finding a minimum cost spanning tree of
252 252
  /// a graph.
253 253
  ///
254 254
  /// This function runs Kruskal's algorithm to find a minimum cost
255
  /// spanning tree.
255
  /// spanning tree of a graph.
256 256
  /// Due to some C++ hacking, it accepts various input and output types.
257 257
  ///
258 258
  /// \param g The graph the algorithm runs on.
259 259
  /// It can be either \ref concepts::Digraph "directed" or
260 260
  /// \ref concepts::Graph "undirected".
261 261
  /// If the graph is directed, the algorithm consider it to be
262 262
  /// undirected by disregarding the direction of the arcs.
263 263
  ///
264 264
  /// \param in This object is used to describe the arc/edge costs.
265 265
  /// It can be one of the following choices.
266 266
  /// - An STL compatible 'Forward Container' with
267
  /// <tt>std::pair<GR::Arc,X></tt> or
268
  /// <tt>std::pair<GR::Edge,X></tt> as its <tt>value_type</tt>, where
269
  /// \c X is the type of the costs. The pairs indicates the arcs/edges
267
  /// <tt>std::pair<GR::Arc,C></tt> or
268
  /// <tt>std::pair<GR::Edge,C></tt> as its <tt>value_type</tt>, where
269
  /// \c C is the type of the costs. The pairs indicates the arcs/edges
270 270
  /// along with the assigned cost. <em>They must be in a
271 271
  /// cost-ascending order.</em>
272 272
  /// - Any readable arc/edge map. The values of the map indicate the
273 273
  /// arc/edge costs.
274 274
  ///
275 275
  /// \retval out Here we also have a choice.
276
  /// - It can be a writable \c bool arc/edge map. After running the
277
  /// algorithm it will contain the found minimum cost spanning
276
  /// - It can be a writable arc/edge map with \c bool value type. After
277
  /// running the algorithm it will contain the found minimum cost spanning
278 278
  /// tree: the value of an arc/edge will be set to \c true if it belongs
279 279
  /// to the tree, otherwise it will be set to \c false. The value of
280 280
  /// each arc/edge will be set exactly once.
281 281
  /// - It can also be an iteraror of an STL Container with
282 282
  /// <tt>GR::Arc</tt> or <tt>GR::Edge</tt> as its
283 283
  /// <tt>value_type</tt>.  The algorithm copies the elements of the
284 284
  /// found tree into this sequence.  For example, if we know that the
285 285
  /// spanning tree of the graph \c g has say 53 arcs, then we can
286 286
  /// put its arcs into an STL vector \c tree with a code like this.
287 287
  ///\code
288 288
  /// std::vector<Arc> tree(53);
289 289
  /// kruskal(g,cost,tree.begin());
290 290
  ///\endcode
291 291
  /// Or if we don't know in advance the size of the tree, we can
292 292
  /// write this.
293 293
  ///\code
294 294
  /// std::vector<Arc> tree;
295 295
  /// kruskal(g,cost,std::back_inserter(tree));
296 296
  ///\endcode
297 297
  ///
298 298
  /// \return The total cost of the found spanning tree.
299 299
  ///
300 300
  /// \note If the input graph is not (weakly) connected, a spanning
301 301
  /// forest is calculated instead of a spanning tree.
302 302

	
303 303
#ifdef DOXYGEN
304
  template <class Graph, class In, class Out>
305
  Value kruskal(GR const& g, const In& in, Out& out)
304
  template <typename Graph, typename In, typename Out>
305
  Value kruskal(const Graph& g, const In& in, Out& out)
306 306
#else
307 307
  template <class Graph, class In, class Out>
308 308
  inline typename _kruskal_bits::KruskalValueSelector<In>::Value
309 309
  kruskal(const Graph& graph, const In& in, Out& out)
310 310
#endif
311 311
  {
312 312
    return _kruskal_bits::KruskalInputSelector<Graph, In, Out>::
313 313
      kruskal(graph, in, out);
314 314
  }
315 315

	
316 316

	
317

	
318

	
319 317
  template <class Graph, class In, class Out>
320 318
  inline typename _kruskal_bits::KruskalValueSelector<In>::Value
321 319
  kruskal(const Graph& graph, const In& in, const Out& out)
322 320
  {
323 321
    return _kruskal_bits::KruskalInputSelector<Graph, In, const Out>::
324 322
      kruskal(graph, in, out);
325 323
  }
326 324

	
327 325
} //namespace lemon
328 326

	
329 327
#endif //LEMON_KRUSKAL_H
Ignore white space 6 line context
... ...
@@ -572,49 +572,49 @@
572 572
      : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
573 573
        _use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
574 574
        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
575 575

	
576 576
      other._is = 0;
577 577
      other.local_is = false;
578 578

	
579 579
      _node_index.swap(other._node_index);
580 580
      _arc_index.swap(other._arc_index);
581 581

	
582 582
      _node_maps.swap(other._node_maps);
583 583
      _arc_maps.swap(other._arc_maps);
584 584
      _attributes.swap(other._attributes);
585 585

	
586 586
      _nodes_caption = other._nodes_caption;
587 587
      _arcs_caption = other._arcs_caption;
588 588
      _attributes_caption = other._attributes_caption;
589 589

	
590 590
    }
591 591

	
592 592
    DigraphReader& operator=(const DigraphReader&);
593 593

	
594 594
  public:
595 595

	
596
    /// \name Reading rules
596
    /// \name Reading Rules
597 597
    /// @{
598 598

	
599 599
    /// \brief Node map reading rule
600 600
    ///
601 601
    /// Add a node map reading rule to the reader.
602 602
    template <typename Map>
603 603
    DigraphReader& nodeMap(const std::string& caption, Map& map) {
604 604
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
605 605
      _reader_bits::MapStorageBase<Node>* storage =
606 606
        new _reader_bits::MapStorage<Node, Map>(map);
607 607
      _node_maps.push_back(std::make_pair(caption, storage));
608 608
      return *this;
609 609
    }
610 610

	
611 611
    /// \brief Node map reading rule
612 612
    ///
613 613
    /// Add a node map reading rule with specialized converter to the
614 614
    /// reader.
615 615
    template <typename Map, typename Converter>
616 616
    DigraphReader& nodeMap(const std::string& caption, Map& map,
617 617
                           const Converter& converter = Converter()) {
618 618
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
619 619
      _reader_bits::MapStorageBase<Node>* storage =
620 620
        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
... ...
@@ -677,78 +677,78 @@
677 677
    /// Add a node reading rule to reader.
678 678
    DigraphReader& node(const std::string& caption, Node& node) {
679 679
      typedef _reader_bits::MapLookUpConverter<Node> Converter;
680 680
      Converter converter(_node_index);
681 681
      _reader_bits::ValueStorageBase* storage =
682 682
        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
683 683
      _attributes.insert(std::make_pair(caption, storage));
684 684
      return *this;
685 685
    }
686 686

	
687 687
    /// \brief Arc reading rule
688 688
    ///
689 689
    /// Add an arc reading rule to reader.
690 690
    DigraphReader& arc(const std::string& caption, Arc& arc) {
691 691
      typedef _reader_bits::MapLookUpConverter<Arc> Converter;
692 692
      Converter converter(_arc_index);
693 693
      _reader_bits::ValueStorageBase* storage =
694 694
        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
695 695
      _attributes.insert(std::make_pair(caption, storage));
696 696
      return *this;
697 697
    }
698 698

	
699 699
    /// @}
700 700

	
701
    /// \name Select section by name
701
    /// \name Select Section by Name
702 702
    /// @{
703 703

	
704 704
    /// \brief Set \c \@nodes section to be read
705 705
    ///
706 706
    /// Set \c \@nodes section to be read
707 707
    DigraphReader& nodes(const std::string& caption) {
708 708
      _nodes_caption = caption;
709 709
      return *this;
710 710
    }
711 711

	
712 712
    /// \brief Set \c \@arcs section to be read
713 713
    ///
714 714
    /// Set \c \@arcs section to be read
715 715
    DigraphReader& arcs(const std::string& caption) {
716 716
      _arcs_caption = caption;
717 717
      return *this;
718 718
    }
719 719

	
720 720
    /// \brief Set \c \@attributes section to be read
721 721
    ///
722 722
    /// Set \c \@attributes section to be read
723 723
    DigraphReader& attributes(const std::string& caption) {
724 724
      _attributes_caption = caption;
725 725
      return *this;
726 726
    }
727 727

	
728 728
    /// @}
729 729

	
730
    /// \name Using previously constructed node or arc set
730
    /// \name Using Previously Constructed Node or Arc Set
731 731
    /// @{
732 732

	
733 733
    /// \brief Use previously constructed node set
734 734
    ///
735 735
    /// Use previously constructed node set, and specify the node
736 736
    /// label map.
737 737
    template <typename Map>
738 738
    DigraphReader& useNodes(const Map& map) {
739 739
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
740 740
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
741 741
      _use_nodes = true;
742 742
      _writer_bits::DefaultConverter<typename Map::Value> converter;
743 743
      for (NodeIt n(_digraph); n != INVALID; ++n) {
744 744
        _node_index.insert(std::make_pair(converter(map[n]), n));
745 745
      }
746 746
      return *this;
747 747
    }
748 748

	
749 749
    /// \brief Use previously constructed node set
750 750
    ///
751 751
    /// Use previously constructed node set, and specify the node
752 752
    /// label map and a functor which converts the label map values to
753 753
    /// \c std::string.
754 754
    template <typename Map, typename Converter>
... ...
@@ -1095,49 +1095,49 @@
1095 1095
        {
1096 1096
          typename Attributes::iterator it = _attributes.lower_bound(attr);
1097 1097
          while (it != _attributes.end() && it->first == attr) {
1098 1098
            it->second->set(token);
1099 1099
            ++it;
1100 1100
          }
1101 1101
        }
1102 1102

	
1103 1103
      }
1104 1104
      if (readSuccess()) {
1105 1105
        line.putback(c);
1106 1106
      }
1107 1107
      for (typename Attributes::iterator it = _attributes.begin();
1108 1108
           it != _attributes.end(); ++it) {
1109 1109
        if (read_attr.find(it->first) == read_attr.end()) {
1110 1110
          std::ostringstream msg;
1111 1111
          msg << "Attribute not found: " << it->first;
1112 1112
          throw FormatError(msg.str());
1113 1113
        }
1114 1114
      }
1115 1115
    }
1116 1116

	
1117 1117
  public:
1118 1118

	
1119
    /// \name Execution of the reader
1119
    /// \name Execution of the Reader
1120 1120
    /// @{
1121 1121

	
1122 1122
    /// \brief Start the batch processing
1123 1123
    ///
1124 1124
    /// This function starts the batch processing
1125 1125
    void run() {
1126 1126
      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
1127 1127

	
1128 1128
      bool nodes_done = _skip_nodes;
1129 1129
      bool arcs_done = _skip_arcs;
1130 1130
      bool attributes_done = false;
1131 1131

	
1132 1132
      line_num = 0;
1133 1133
      readLine();
1134 1134
      skipSection();
1135 1135

	
1136 1136
      while (readSuccess()) {
1137 1137
        try {
1138 1138
          char c;
1139 1139
          std::string section, caption;
1140 1140
          line >> c;
1141 1141
          _reader_bits::readToken(line, section);
1142 1142
          _reader_bits::readToken(line, caption);
1143 1143

	
... ...
@@ -1368,49 +1368,49 @@
1368 1368
      : _is(other._is), local_is(other.local_is), _graph(other._graph),
1369 1369
        _use_nodes(other._use_nodes), _use_edges(other._use_edges),
1370 1370
        _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
1371 1371

	
1372 1372
      other._is = 0;
1373 1373
      other.local_is = false;
1374 1374

	
1375 1375
      _node_index.swap(other._node_index);
1376 1376
      _edge_index.swap(other._edge_index);
1377 1377

	
1378 1378
      _node_maps.swap(other._node_maps);
1379 1379
      _edge_maps.swap(other._edge_maps);
1380 1380
      _attributes.swap(other._attributes);
1381 1381

	
1382 1382
      _nodes_caption = other._nodes_caption;
1383 1383
      _edges_caption = other._edges_caption;
1384 1384
      _attributes_caption = other._attributes_caption;
1385 1385

	
1386 1386
    }
1387 1387

	
1388 1388
    GraphReader& operator=(const GraphReader&);
1389 1389

	
1390 1390
  public:
1391 1391

	
1392
    /// \name Reading rules
1392
    /// \name Reading Rules
1393 1393
    /// @{
1394 1394

	
1395 1395
    /// \brief Node map reading rule
1396 1396
    ///
1397 1397
    /// Add a node map reading rule to the reader.
1398 1398
    template <typename Map>
1399 1399
    GraphReader& nodeMap(const std::string& caption, Map& map) {
1400 1400
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
1401 1401
      _reader_bits::MapStorageBase<Node>* storage =
1402 1402
        new _reader_bits::MapStorage<Node, Map>(map);
1403 1403
      _node_maps.push_back(std::make_pair(caption, storage));
1404 1404
      return *this;
1405 1405
    }
1406 1406

	
1407 1407
    /// \brief Node map reading rule
1408 1408
    ///
1409 1409
    /// Add a node map reading rule with specialized converter to the
1410 1410
    /// reader.
1411 1411
    template <typename Map, typename Converter>
1412 1412
    GraphReader& nodeMap(const std::string& caption, Map& map,
1413 1413
                           const Converter& converter = Converter()) {
1414 1414
      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
1415 1415
      _reader_bits::MapStorageBase<Node>* storage =
1416 1416
        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
... ...
@@ -1519,78 +1519,78 @@
1519 1519
    /// Add an edge reading rule to reader.
1520 1520
    GraphReader& edge(const std::string& caption, Edge& edge) {
1521 1521
      typedef _reader_bits::MapLookUpConverter<Edge> Converter;
1522 1522
      Converter converter(_edge_index);
1523 1523
      _reader_bits::ValueStorageBase* storage =
1524 1524
        new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
1525 1525
      _attributes.insert(std::make_pair(caption, storage));
1526 1526
      return *this;
1527 1527
    }
1528 1528

	
1529 1529
    /// \brief Arc reading rule
1530 1530
    ///
1531 1531
    /// Add an arc reading rule to reader.
1532 1532
    GraphReader& arc(const std::string& caption, Arc& arc) {
1533 1533
      typedef _reader_bits::GraphArcLookUpConverter<Graph> Converter;
1534 1534
      Converter converter(_graph, _edge_index);
1535 1535
      _reader_bits::ValueStorageBase* storage =
1536 1536
        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
1537 1537
      _attributes.insert(std::make_pair(caption, storage));
1538 1538
      return *this;
1539 1539
    }
1540 1540

	
1541 1541
    /// @}
1542 1542

	
1543
    /// \name Select section by name
1543
    /// \name Select Section by Name
1544 1544
    /// @{
1545 1545

	
1546 1546
    /// \brief Set \c \@nodes section to be read
1547 1547
    ///
1548 1548
    /// Set \c \@nodes section to be read.
1549 1549
    GraphReader& nodes(const std::string& caption) {
1550 1550
      _nodes_caption = caption;
1551 1551
      return *this;
1552 1552
    }
1553 1553

	
1554 1554
    /// \brief Set \c \@edges section to be read
1555 1555
    ///
1556 1556
    /// Set \c \@edges section to be read.
1557 1557
    GraphReader& edges(const std::string& caption) {
1558 1558
      _edges_caption = caption;
1559 1559
      return *this;
1560 1560
    }
1561 1561

	
1562 1562
    /// \brief Set \c \@attributes section to be read
1563 1563
    ///
1564 1564
    /// Set \c \@attributes section to be read.
1565 1565
    GraphReader& attributes(const std::string& caption) {
1566 1566
      _attributes_caption = caption;
1567 1567
      return *this;
1568 1568
    }
1569 1569

	
1570 1570
    /// @}
1571 1571

	
1572
    /// \name Using previously constructed node or edge set
1572
    /// \name Using Previously Constructed Node or Edge Set
1573 1573
    /// @{
1574 1574

	
1575 1575
    /// \brief Use previously constructed node set
1576 1576
    ///
1577 1577
    /// Use previously constructed node set, and specify the node
1578 1578
    /// label map.
1579 1579
    template <typename Map>
1580 1580
    GraphReader& useNodes(const Map& map) {
1581 1581
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1582 1582
      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
1583 1583
      _use_nodes = true;
1584 1584
      _writer_bits::DefaultConverter<typename Map::Value> converter;
1585 1585
      for (NodeIt n(_graph); n != INVALID; ++n) {
1586 1586
        _node_index.insert(std::make_pair(converter(map[n]), n));
1587 1587
      }
1588 1588
      return *this;
1589 1589
    }
1590 1590

	
1591 1591
    /// \brief Use previously constructed node set
1592 1592
    ///
1593 1593
    /// Use previously constructed node set, and specify the node
1594 1594
    /// label map and a functor which converts the label map values to
1595 1595
    /// \c std::string.
1596 1596
    template <typename Map, typename Converter>
... ...
@@ -1938,49 +1938,49 @@
1938 1938
        {
1939 1939
          typename Attributes::iterator it = _attributes.lower_bound(attr);
1940 1940
          while (it != _attributes.end() && it->first == attr) {
1941 1941
            it->second->set(token);
1942 1942
            ++it;
1943 1943
          }
1944 1944
        }
1945 1945

	
1946 1946
      }
1947 1947
      if (readSuccess()) {
1948 1948
        line.putback(c);
1949 1949
      }
1950 1950
      for (typename Attributes::iterator it = _attributes.begin();
1951 1951
           it != _attributes.end(); ++it) {
1952 1952
        if (read_attr.find(it->first) == read_attr.end()) {
1953 1953
          std::ostringstream msg;
1954 1954
          msg << "Attribute not found: " << it->first;
1955 1955
          throw FormatError(msg.str());
1956 1956
        }
1957 1957
      }
1958 1958
    }
1959 1959

	
1960 1960
  public:
1961 1961

	
1962
    /// \name Execution of the reader
1962
    /// \name Execution of the Reader
1963 1963
    /// @{
1964 1964

	
1965 1965
    /// \brief Start the batch processing
1966 1966
    ///
1967 1967
    /// This function starts the batch processing
1968 1968
    void run() {
1969 1969

	
1970 1970
      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
1971 1971

	
1972 1972
      bool nodes_done = _skip_nodes;
1973 1973
      bool edges_done = _skip_edges;
1974 1974
      bool attributes_done = false;
1975 1975

	
1976 1976
      line_num = 0;
1977 1977
      readLine();
1978 1978
      skipSection();
1979 1979

	
1980 1980
      while (readSuccess()) {
1981 1981
        try {
1982 1982
          char c;
1983 1983
          std::string section, caption;
1984 1984
          line >> c;
1985 1985
          _reader_bits::readToken(line, section);
1986 1986
          _reader_bits::readToken(line, caption);
... ...
@@ -2137,49 +2137,49 @@
2137 2137
        delete _is;
2138 2138
      }
2139 2139

	
2140 2140
    }
2141 2141

	
2142 2142
  private:
2143 2143

	
2144 2144
    friend SectionReader sectionReader(std::istream& is);
2145 2145
    friend SectionReader sectionReader(const std::string& fn);
2146 2146
    friend SectionReader sectionReader(const char* fn);
2147 2147

	
2148 2148
    SectionReader(SectionReader& other)
2149 2149
      : _is(other._is), local_is(other.local_is) {
2150 2150

	
2151 2151
      other._is = 0;
2152 2152
      other.local_is = false;
2153 2153

	
2154 2154
      _sections.swap(other._sections);
2155 2155
    }
2156 2156

	
2157 2157
    SectionReader& operator=(const SectionReader&);
2158 2158

	
2159 2159
  public:
2160 2160

	
2161
    /// \name Section readers
2161
    /// \name Section Readers
2162 2162
    /// @{
2163 2163

	
2164 2164
    /// \brief Add a section processor with line oriented reading
2165 2165
    ///
2166 2166
    /// The first parameter is the type descriptor of the section, the
2167 2167
    /// second is a functor, which takes just one \c std::string
2168 2168
    /// parameter. At the reading process, each line of the section
2169 2169
    /// will be given to the functor object. However, the empty lines
2170 2170
    /// and the comment lines are filtered out, and the leading
2171 2171
    /// whitespaces are trimmed from each processed string.
2172 2172
    ///
2173 2173
    /// For example let's see a section, which contain several
2174 2174
    /// integers, which should be inserted into a vector.
2175 2175
    ///\code
2176 2176
    ///  @numbers
2177 2177
    ///  12 45 23
2178 2178
    ///  4
2179 2179
    ///  23 6
2180 2180
    ///\endcode
2181 2181
    ///
2182 2182
    /// The functor is implemented as a struct:
2183 2183
    ///\code
2184 2184
    ///  struct NumberSection {
2185 2185
    ///    std::vector<int>& _data;
... ...
@@ -2236,49 +2236,49 @@
2236 2236
          line.putback(c);
2237 2237
          return true;
2238 2238
        }
2239 2239
      }
2240 2240
      return false;
2241 2241
    }
2242 2242

	
2243 2243
    bool readSuccess() {
2244 2244
      return static_cast<bool>(*_is);
2245 2245
    }
2246 2246

	
2247 2247
    void skipSection() {
2248 2248
      char c;
2249 2249
      while (readSuccess() && line >> c && c != '@') {
2250 2250
        readLine();
2251 2251
      }
2252 2252
      if (readSuccess()) {
2253 2253
        line.putback(c);
2254 2254
      }
2255 2255
    }
2256 2256

	
2257 2257
  public:
2258 2258

	
2259 2259

	
2260
    /// \name Execution of the reader
2260
    /// \name Execution of the Reader
2261 2261
    /// @{
2262 2262

	
2263 2263
    /// \brief Start the batch processing
2264 2264
    ///
2265 2265
    /// This function starts the batch processing.
2266 2266
    void run() {
2267 2267

	
2268 2268
      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
2269 2269

	
2270 2270
      std::set<std::string> extra_sections;
2271 2271

	
2272 2272
      line_num = 0;
2273 2273
      readLine();
2274 2274
      skipSection();
2275 2275

	
2276 2276
      while (readSuccess()) {
2277 2277
        try {
2278 2278
          char c;
2279 2279
          std::string section, caption;
2280 2280
          line >> c;
2281 2281
          _reader_bits::readToken(line, section);
2282 2282
          _reader_bits::readToken(line, caption);
2283 2283

	
2284 2284
          if (line >> c)
... ...
@@ -2418,75 +2418,75 @@
2418 2418
    ///
2419 2419
    /// Construct an \e LGF contents reader, which reads from the given
2420 2420
    /// file.
2421 2421
    LgfContents(const char* fn)
2422 2422
      : _is(new std::ifstream(fn)), local_is(true) {
2423 2423
      if (!(*_is)) {
2424 2424
        delete _is;
2425 2425
        throw IoError("Cannot open file", fn);
2426 2426
      }
2427 2427
    }
2428 2428

	
2429 2429
    /// \brief Destructor
2430 2430
    ~LgfContents() {
2431 2431
      if (local_is) delete _is;
2432 2432
    }
2433 2433

	
2434 2434
  private:
2435 2435

	
2436 2436
    LgfContents(const LgfContents&);
2437 2437
    LgfContents& operator=(const LgfContents&);
2438 2438

	
2439 2439
  public:
2440 2440

	
2441 2441

	
2442
    /// \name Node sections
2442
    /// \name Node Sections
2443 2443
    /// @{
2444 2444

	
2445 2445
    /// \brief Gives back the number of node sections in the file.
2446 2446
    ///
2447 2447
    /// Gives back the number of node sections in the file.
2448 2448
    int nodeSectionNum() const {
2449 2449
      return _node_sections.size();
2450 2450
    }
2451 2451

	
2452 2452
    /// \brief Returns the node section name at the given position.
2453 2453
    ///
2454 2454
    /// Returns the node section name at the given position.
2455 2455
    const std::string& nodeSection(int i) const {
2456 2456
      return _node_sections[i];
2457 2457
    }
2458 2458

	
2459 2459
    /// \brief Gives back the node maps for the given section.
2460 2460
    ///
2461 2461
    /// Gives back the node maps for the given section.
2462 2462
    const std::vector<std::string>& nodeMapNames(int i) const {
2463 2463
      return _node_maps[i];
2464 2464
    }
2465 2465

	
2466 2466
    /// @}
2467 2467

	
2468
    /// \name Arc/Edge sections
2468
    /// \name Arc/Edge Sections
2469 2469
    /// @{
2470 2470

	
2471 2471
    /// \brief Gives back the number of arc/edge sections in the file.
2472 2472
    ///
2473 2473
    /// Gives back the number of arc/edge sections in the file.
2474 2474
    /// \note It is synonym of \c edgeSectionNum().
2475 2475
    int arcSectionNum() const {
2476 2476
      return _edge_sections.size();
2477 2477
    }
2478 2478

	
2479 2479
    /// \brief Returns the arc/edge section name at the given position.
2480 2480
    ///
2481 2481
    /// Returns the arc/edge section name at the given position.
2482 2482
    /// \note It is synonym of \c edgeSection().
2483 2483
    const std::string& arcSection(int i) const {
2484 2484
      return _edge_sections[i];
2485 2485
    }
2486 2486

	
2487 2487
    /// \brief Gives back the arc/edge maps for the given section.
2488 2488
    ///
2489 2489
    /// Gives back the arc/edge maps for the given section.
2490 2490
    /// \note It is synonym of \c edgeMapNames().
2491 2491
    const std::vector<std::string>& arcMapNames(int i) const {
2492 2492
      return _edge_maps[i];
... ...
@@ -2502,75 +2502,75 @@
2502 2502
    /// Gives back the number of arc/edge sections in the file.
2503 2503
    /// \note It is synonym of \c arcSectionNum().
2504 2504
    int edgeSectionNum() const {
2505 2505
      return _edge_sections.size();
2506 2506
    }
2507 2507

	
2508 2508
    /// \brief Returns the section name at the given position.
2509 2509
    ///
2510 2510
    /// Returns the section name at the given position.
2511 2511
    /// \note It is synonym of \c arcSection().
2512 2512
    const std::string& edgeSection(int i) const {
2513 2513
      return _edge_sections[i];
2514 2514
    }
2515 2515

	
2516 2516
    /// \brief Gives back the edge maps for the given section.
2517 2517
    ///
2518 2518
    /// Gives back the edge maps for the given section.
2519 2519
    /// \note It is synonym of \c arcMapNames().
2520 2520
    const std::vector<std::string>& edgeMapNames(int i) const {
2521 2521
      return _edge_maps[i];
2522 2522
    }
2523 2523

	
2524 2524
    /// @}
2525 2525

	
2526
    /// \name Attribute sections
2526
    /// \name Attribute Sections
2527 2527
    /// @{
2528 2528

	
2529 2529
    /// \brief Gives back the number of attribute sections in the file.
2530 2530
    ///
2531 2531
    /// Gives back the number of attribute sections in the file.
2532 2532
    int attributeSectionNum() const {
2533 2533
      return _attribute_sections.size();
2534 2534
    }
2535 2535

	
2536 2536
    /// \brief Returns the attribute section name at the given position.
2537 2537
    ///
2538 2538
    /// Returns the attribute section name at the given position.
2539 2539
    const std::string& attributeSectionNames(int i) const {
2540 2540
      return _attribute_sections[i];
2541 2541
    }
2542 2542

	
2543 2543
    /// \brief Gives back the attributes for the given section.
2544 2544
    ///
2545 2545
    /// Gives back the attributes for the given section.
2546 2546
    const std::vector<std::string>& attributes(int i) const {
2547 2547
      return _attributes[i];
2548 2548
    }
2549 2549

	
2550 2550
    /// @}
2551 2551

	
2552
    /// \name Extra sections
2552
    /// \name Extra Sections
2553 2553
    /// @{
2554 2554

	
2555 2555
    /// \brief Gives back the number of extra sections in the file.
2556 2556
    ///
2557 2557
    /// Gives back the number of extra sections in the file.
2558 2558
    int extraSectionNum() const {
2559 2559
      return _extra_sections.size();
2560 2560
    }
2561 2561

	
2562 2562
    /// \brief Returns the extra section type at the given position.
2563 2563
    ///
2564 2564
    /// Returns the section type at the given position.
2565 2565
    const std::string& extraSection(int i) const {
2566 2566
      return _extra_sections[i];
2567 2567
    }
2568 2568

	
2569 2569
    /// @}
2570 2570

	
2571 2571
  private:
2572 2572

	
2573 2573
    bool readLine() {
2574 2574
      std::string str;
2575 2575
      while(++line_num, std::getline(*_is, str)) {
2576 2576
        line.clear(); line.str(str);
... ...
@@ -2604,49 +2604,49 @@
2604 2604
        return;
2605 2605
      }
2606 2606
      line.putback(c);
2607 2607
      std::string map;
2608 2608
      while (_reader_bits::readToken(line, map)) {
2609 2609
        maps.push_back(map);
2610 2610
      }
2611 2611
    }
2612 2612

	
2613 2613
    void readAttributes(std::vector<std::string>& attrs) {
2614 2614
      readLine();
2615 2615
      char c;
2616 2616
      while (readSuccess() && line >> c && c != '@') {
2617 2617
        line.putback(c);
2618 2618
        std::string attr;
2619 2619
        _reader_bits::readToken(line, attr);
2620 2620
        attrs.push_back(attr);
2621 2621
        readLine();
2622 2622
      }
2623 2623
      line.putback(c);
2624 2624
    }
2625 2625

	
2626 2626
  public:
2627 2627

	
2628
    /// \name Execution of the contents reader
2628
    /// \name Execution of the Contents Reader
2629 2629
    /// @{
2630 2630

	
2631 2631
    /// \brief Starts the reading
2632 2632
    ///
2633 2633
    /// This function starts the reading.
2634 2634
    void run() {
2635 2635

	
2636 2636
      readLine();
2637 2637
      skipSection();
2638 2638

	
2639 2639
      while (readSuccess()) {
2640 2640

	
2641 2641
        char c;
2642 2642
        line >> c;
2643 2643

	
2644 2644
        std::string section, caption;
2645 2645
        _reader_bits::readToken(line, section);
2646 2646
        _reader_bits::readToken(line, caption);
2647 2647

	
2648 2648
        if (section == "nodes") {
2649 2649
          _node_sections.push_back(caption);
2650 2650
          _node_maps.push_back(std::vector<std::string>());
2651 2651
          readMaps(_node_maps.back());
2652 2652
          readLine(); skipSection();
Ignore white space 6 line context
... ...
@@ -517,49 +517,49 @@
517 517

	
518 518
    DigraphWriter(DigraphWriter& other)
519 519
      : _os(other._os), local_os(other.local_os), _digraph(other._digraph),
520 520
        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
521 521

	
522 522
      other._os = 0;
523 523
      other.local_os = false;
524 524

	
525 525
      _node_index.swap(other._node_index);
526 526
      _arc_index.swap(other._arc_index);
527 527

	
528 528
      _node_maps.swap(other._node_maps);
529 529
      _arc_maps.swap(other._arc_maps);
530 530
      _attributes.swap(other._attributes);
531 531

	
532 532
      _nodes_caption = other._nodes_caption;
533 533
      _arcs_caption = other._arcs_caption;
534 534
      _attributes_caption = other._attributes_caption;
535 535
    }
536 536

	
537 537
    DigraphWriter& operator=(const DigraphWriter&);
538 538

	
539 539
  public:
540 540

	
541
    /// \name Writing rules
541
    /// \name Writing Rules
542 542
    /// @{
543 543

	
544 544
    /// \brief Node map writing rule
545 545
    ///
546 546
    /// Add a node map writing rule to the writer.
547 547
    template <typename Map>
548 548
    DigraphWriter& nodeMap(const std::string& caption, const Map& map) {
549 549
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
550 550
      _writer_bits::MapStorageBase<Node>* storage =
551 551
        new _writer_bits::MapStorage<Node, Map>(map);
552 552
      _node_maps.push_back(std::make_pair(caption, storage));
553 553
      return *this;
554 554
    }
555 555

	
556 556
    /// \brief Node map writing rule
557 557
    ///
558 558
    /// Add a node map writing rule with specialized converter to the
559 559
    /// writer.
560 560
    template <typename Map, typename Converter>
561 561
    DigraphWriter& nodeMap(const std::string& caption, const Map& map,
562 562
                           const Converter& converter = Converter()) {
563 563
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
564 564
      _writer_bits::MapStorageBase<Node>* storage =
565 565
        new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
... ...
@@ -620,76 +620,76 @@
620 620
    /// \brief Node writing rule
621 621
    ///
622 622
    /// Add a node writing rule to the writer.
623 623
    DigraphWriter& node(const std::string& caption, const Node& node) {
624 624
      typedef _writer_bits::MapLookUpConverter<Node> Converter;
625 625
      Converter converter(_node_index);
626 626
      _writer_bits::ValueStorageBase* storage =
627 627
        new _writer_bits::ValueStorage<Node, Converter>(node, converter);
628 628
      _attributes.push_back(std::make_pair(caption, storage));
629 629
      return *this;
630 630
    }
631 631

	
632 632
    /// \brief Arc writing rule
633 633
    ///
634 634
    /// Add an arc writing rule to writer.
635 635
    DigraphWriter& arc(const std::string& caption, const Arc& arc) {
636 636
      typedef _writer_bits::MapLookUpConverter<Arc> Converter;
637 637
      Converter converter(_arc_index);
638 638
      _writer_bits::ValueStorageBase* storage =
639 639
        new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
640 640
      _attributes.push_back(std::make_pair(caption, storage));
641 641
      return *this;
642 642
    }
643 643

	
644
    /// \name Section captions
644
    /// \name Section Captions
645 645
    /// @{
646 646

	
647 647
    /// \brief Add an additional caption to the \c \@nodes section
648 648
    ///
649 649
    /// Add an additional caption to the \c \@nodes section.
650 650
    DigraphWriter& nodes(const std::string& caption) {
651 651
      _nodes_caption = caption;
652 652
      return *this;
653 653
    }
654 654

	
655 655
    /// \brief Add an additional caption to the \c \@arcs section
656 656
    ///
657 657
    /// Add an additional caption to the \c \@arcs section.
658 658
    DigraphWriter& arcs(const std::string& caption) {
659 659
      _arcs_caption = caption;
660 660
      return *this;
661 661
    }
662 662

	
663 663
    /// \brief Add an additional caption to the \c \@attributes section
664 664
    ///
665 665
    /// Add an additional caption to the \c \@attributes section.
666 666
    DigraphWriter& attributes(const std::string& caption) {
667 667
      _attributes_caption = caption;
668 668
      return *this;
669 669
    }
670 670

	
671
    /// \name Skipping section
671
    /// \name Skipping Section
672 672
    /// @{
673 673

	
674 674
    /// \brief Skip writing the node set
675 675
    ///
676 676
    /// The \c \@nodes section will not be written to the stream.
677 677
    DigraphWriter& skipNodes() {
678 678
      LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
679 679
      _skip_nodes = true;
680 680
      return *this;
681 681
    }
682 682

	
683 683
    /// \brief Skip writing arc set
684 684
    ///
685 685
    /// The \c \@arcs section will not be written to the stream.
686 686
    DigraphWriter& skipArcs() {
687 687
      LEMON_ASSERT(!_skip_arcs, "Multiple usage of skipArcs() member");
688 688
      _skip_arcs = true;
689 689
      return *this;
690 690
    }
691 691

	
692 692
    /// @}
693 693

	
694 694
  private:
695 695

	
... ...
@@ -864,49 +864,49 @@
864 864
        for (ArcIt a(_digraph); a != INVALID; ++a) {
865 865
          std::string value = label->get(a);
866 866
          _arc_index.insert(std::make_pair(a, value));
867 867
        }
868 868
      }
869 869
    }
870 870

	
871 871
    void writeAttributes() {
872 872
      if (_attributes.empty()) return;
873 873
      *_os << "@attributes";
874 874
      if (!_attributes_caption.empty()) {
875 875
        _writer_bits::writeToken(*_os << ' ', _attributes_caption);
876 876
      }
877 877
      *_os << std::endl;
878 878
      for (typename Attributes::iterator it = _attributes.begin();
879 879
           it != _attributes.end(); ++it) {
880 880
        _writer_bits::writeToken(*_os, it->first) << ' ';
881 881
        _writer_bits::writeToken(*_os, it->second->get());
882 882
        *_os << std::endl;
883 883
      }
884 884
    }
885 885

	
886 886
  public:
887 887

	
888
    /// \name Execution of the writer
888
    /// \name Execution of the Writer
889 889
    /// @{
890 890

	
891 891
    /// \brief Start the batch processing
892 892
    ///
893 893
    /// This function starts the batch processing.
894 894
    void run() {
895 895
      if (!_skip_nodes) {
896 896
        writeNodes();
897 897
      } else {
898 898
        createNodeIndex();
899 899
      }
900 900
      if (!_skip_arcs) {
901 901
        writeArcs();
902 902
      } else {
903 903
        createArcIndex();
904 904
      }
905 905
      writeAttributes();
906 906
    }
907 907

	
908 908
    /// \brief Give back the stream of the writer
909 909
    ///
910 910
    /// Give back the stream of the writer.
911 911
    std::ostream& ostream() {
912 912
      return *_os;
... ...
@@ -1085,49 +1085,49 @@
1085 1085
    
1086 1086
    GraphWriter(GraphWriter& other)
1087 1087
      : _os(other._os), local_os(other.local_os), _graph(other._graph),
1088 1088
        _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
1089 1089

	
1090 1090
      other._os = 0;
1091 1091
      other.local_os = false;
1092 1092

	
1093 1093
      _node_index.swap(other._node_index);
1094 1094
      _edge_index.swap(other._edge_index);
1095 1095

	
1096 1096
      _node_maps.swap(other._node_maps);
1097 1097
      _edge_maps.swap(other._edge_maps);
1098 1098
      _attributes.swap(other._attributes);
1099 1099

	
1100 1100
      _nodes_caption = other._nodes_caption;
1101 1101
      _edges_caption = other._edges_caption;
1102 1102
      _attributes_caption = other._attributes_caption;
1103 1103
    }
1104 1104

	
1105 1105
    GraphWriter& operator=(const GraphWriter&);
1106 1106

	
1107 1107
  public:
1108 1108

	
1109
    /// \name Writing rules
1109
    /// \name Writing Rules
1110 1110
    /// @{
1111 1111

	
1112 1112
    /// \brief Node map writing rule
1113 1113
    ///
1114 1114
    /// Add a node map writing rule to the writer.
1115 1115
    template <typename Map>
1116 1116
    GraphWriter& nodeMap(const std::string& caption, const Map& map) {
1117 1117
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1118 1118
      _writer_bits::MapStorageBase<Node>* storage =
1119 1119
        new _writer_bits::MapStorage<Node, Map>(map);
1120 1120
      _node_maps.push_back(std::make_pair(caption, storage));
1121 1121
      return *this;
1122 1122
    }
1123 1123

	
1124 1124
    /// \brief Node map writing rule
1125 1125
    ///
1126 1126
    /// Add a node map writing rule with specialized converter to the
1127 1127
    /// writer.
1128 1128
    template <typename Map, typename Converter>
1129 1129
    GraphWriter& nodeMap(const std::string& caption, const Map& map,
1130 1130
                           const Converter& converter = Converter()) {
1131 1131
      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
1132 1132
      _writer_bits::MapStorageBase<Node>* storage =
1133 1133
        new _writer_bits::MapStorage<Node, Map, Converter>(map, converter);
... ...
@@ -1234,76 +1234,76 @@
1234 1234
    /// \brief Edge writing rule
1235 1235
    ///
1236 1236
    /// Add an edge writing rule to writer.
1237 1237
    GraphWriter& edge(const std::string& caption, const Edge& edge) {
1238 1238
      typedef _writer_bits::MapLookUpConverter<Edge> Converter;
1239 1239
      Converter converter(_edge_index);
1240 1240
      _writer_bits::ValueStorageBase* storage =
1241 1241
        new _writer_bits::ValueStorage<Edge, Converter>(edge, converter);
1242 1242
      _attributes.push_back(std::make_pair(caption, storage));
1243 1243
      return *this;
1244 1244
    }
1245 1245

	
1246 1246
    /// \brief Arc writing rule
1247 1247
    ///
1248 1248
    /// Add an arc writing rule to writer.
1249 1249
    GraphWriter& arc(const std::string& caption, const Arc& arc) {
1250 1250
      typedef _writer_bits::GraphArcLookUpConverter<Graph> Converter;
1251 1251
      Converter converter(_graph, _edge_index);
1252 1252
      _writer_bits::ValueStorageBase* storage =
1253 1253
        new _writer_bits::ValueStorage<Arc, Converter>(arc, converter);
1254 1254
      _attributes.push_back(std::make_pair(caption, storage));
1255 1255
      return *this;
1256 1256
    }
1257 1257

	
1258
    /// \name Section captions
1258
    /// \name Section Captions
1259 1259
    /// @{
1260 1260

	
1261 1261
    /// \brief Add an additional caption to the \c \@nodes section
1262 1262
    ///
1263 1263
    /// Add an additional caption to the \c \@nodes section.
1264 1264
    GraphWriter& nodes(const std::string& caption) {
1265 1265
      _nodes_caption = caption;
1266 1266
      return *this;
1267 1267
    }
1268 1268

	
1269 1269
    /// \brief Add an additional caption to the \c \@arcs section
1270 1270
    ///
1271 1271
    /// Add an additional caption to the \c \@arcs section.
1272 1272
    GraphWriter& edges(const std::string& caption) {
1273 1273
      _edges_caption = caption;
1274 1274
      return *this;
1275 1275
    }
1276 1276

	
1277 1277
    /// \brief Add an additional caption to the \c \@attributes section
1278 1278
    ///
1279 1279
    /// Add an additional caption to the \c \@attributes section.
1280 1280
    GraphWriter& attributes(const std::string& caption) {
1281 1281
      _attributes_caption = caption;
1282 1282
      return *this;
1283 1283
    }
1284 1284

	
1285
    /// \name Skipping section
1285
    /// \name Skipping Section
1286 1286
    /// @{
1287 1287

	
1288 1288
    /// \brief Skip writing the node set
1289 1289
    ///
1290 1290
    /// The \c \@nodes section will not be written to the stream.
1291 1291
    GraphWriter& skipNodes() {
1292 1292
      LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
1293 1293
      _skip_nodes = true;
1294 1294
      return *this;
1295 1295
    }
1296 1296

	
1297 1297
    /// \brief Skip writing edge set
1298 1298
    ///
1299 1299
    /// The \c \@edges section will not be written to the stream.
1300 1300
    GraphWriter& skipEdges() {
1301 1301
      LEMON_ASSERT(!_skip_edges, "Multiple usage of skipEdges() member");
1302 1302
      _skip_edges = true;
1303 1303
      return *this;
1304 1304
    }
1305 1305

	
1306 1306
    /// @}
1307 1307

	
1308 1308
  private:
1309 1309

	
... ...
@@ -1478,49 +1478,49 @@
1478 1478
        for (EdgeIt e(_graph); e != INVALID; ++e) {
1479 1479
          std::string value = label->get(e);
1480 1480
          _edge_index.insert(std::make_pair(e, value));
1481 1481
        }
1482 1482
      }
1483 1483
    }
1484 1484

	
1485 1485
    void writeAttributes() {
1486 1486
      if (_attributes.empty()) return;
1487 1487
      *_os << "@attributes";
1488 1488
      if (!_attributes_caption.empty()) {
1489 1489
        _writer_bits::writeToken(*_os << ' ', _attributes_caption);
1490 1490
      }
1491 1491
      *_os << std::endl;
1492 1492
      for (typename Attributes::iterator it = _attributes.begin();
1493 1493
           it != _attributes.end(); ++it) {
1494 1494
        _writer_bits::writeToken(*_os, it->first) << ' ';
1495 1495
        _writer_bits::writeToken(*_os, it->second->get());
1496 1496
        *_os << std::endl;
1497 1497
      }
1498 1498
    }
1499 1499

	
1500 1500
  public:
1501 1501

	
1502
    /// \name Execution of the writer
1502
    /// \name Execution of the Writer
1503 1503
    /// @{
1504 1504

	
1505 1505
    /// \brief Start the batch processing
1506 1506
    ///
1507 1507
    /// This function starts the batch processing.
1508 1508
    void run() {
1509 1509
      if (!_skip_nodes) {
1510 1510
        writeNodes();
1511 1511
      } else {
1512 1512
        createNodeIndex();
1513 1513
      }
1514 1514
      if (!_skip_edges) {
1515 1515
        writeEdges();
1516 1516
      } else {
1517 1517
        createEdgeIndex();
1518 1518
      }
1519 1519
      writeAttributes();
1520 1520
    }
1521 1521

	
1522 1522
    /// \brief Give back the stream of the writer
1523 1523
    ///
1524 1524
    /// Give back the stream of the writer
1525 1525
    std::ostream& ostream() {
1526 1526
      return *_os;
... ...
@@ -1630,49 +1630,49 @@
1630 1630
        delete _os;
1631 1631
      }
1632 1632

	
1633 1633
    }
1634 1634

	
1635 1635
  private:
1636 1636

	
1637 1637
    friend SectionWriter sectionWriter(std::ostream& os);
1638 1638
    friend SectionWriter sectionWriter(const std::string& fn);
1639 1639
    friend SectionWriter sectionWriter(const char* fn);
1640 1640

	
1641 1641
    SectionWriter(SectionWriter& other)
1642 1642
      : _os(other._os), local_os(other.local_os) {
1643 1643

	
1644 1644
      other._os = 0;
1645 1645
      other.local_os = false;
1646 1646

	
1647 1647
      _sections.swap(other._sections);
1648 1648
    }
1649 1649

	
1650 1650
    SectionWriter& operator=(const SectionWriter&);
1651 1651

	
1652 1652
  public:
1653 1653

	
1654
    /// \name Section writers
1654
    /// \name Section Writers
1655 1655
    /// @{
1656 1656

	
1657 1657
    /// \brief Add a section writer with line oriented writing
1658 1658
    ///
1659 1659
    /// The first parameter is the type descriptor of the section, the
1660 1660
    /// second is a generator with std::string values. At the writing
1661 1661
    /// process, the returned \c std::string will be written into the
1662 1662
    /// output file until it is an empty string.
1663 1663
    ///
1664 1664
    /// For example, an integer vector is written into a section.
1665 1665
    ///\code
1666 1666
    ///  @numbers
1667 1667
    ///  12 45 23 78
1668 1668
    ///  4 28 38 28
1669 1669
    ///  23 6 16
1670 1670
    ///\endcode
1671 1671
    ///
1672 1672
    /// The generator is implemented as a struct.
1673 1673
    ///\code
1674 1674
    ///  struct NumberSection {
1675 1675
    ///    std::vector<int>::const_iterator _it, _end;
1676 1676
    ///    NumberSection(const std::vector<int>& data)
1677 1677
    ///      : _it(data.begin()), _end(data.end()) {}
1678 1678
    ///    std::string operator()() {
... ...
@@ -1697,49 +1697,49 @@
1697 1697
        new _writer_bits::LineSection<Functor>(functor)));
1698 1698
      return *this;
1699 1699
    }
1700 1700

	
1701 1701

	
1702 1702
    /// \brief Add a section writer with stream oriented writing
1703 1703
    ///
1704 1704
    /// The first parameter is the type of the section, the second is
1705 1705
    /// a functor, which takes a \c std::ostream& parameter. The
1706 1706
    /// functor writes the section to the output stream.
1707 1707
    /// \warning The last line must be closed with end-line character.
1708 1708
    template <typename Functor>
1709 1709
    SectionWriter& sectionStream(const std::string& type, Functor functor) {
1710 1710
      LEMON_ASSERT(!type.empty(), "Type is empty.");
1711 1711
      _sections.push_back(std::make_pair(type,
1712 1712
         new _writer_bits::StreamSection<Functor>(functor)));
1713 1713
      return *this;
1714 1714
    }
1715 1715

	
1716 1716
    /// @}
1717 1717

	
1718 1718
  public:
1719 1719

	
1720 1720

	
1721
    /// \name Execution of the writer
1721
    /// \name Execution of the Writer
1722 1722
    /// @{
1723 1723

	
1724 1724
    /// \brief Start the batch processing
1725 1725
    ///
1726 1726
    /// This function starts the batch processing.
1727 1727
    void run() {
1728 1728

	
1729 1729
      LEMON_ASSERT(_os != 0, "This writer is assigned to an other writer");
1730 1730

	
1731 1731
      for (Sections::iterator it = _sections.begin();
1732 1732
           it != _sections.end(); ++it) {
1733 1733
        (*_os) << '@' << it->first << std::endl;
1734 1734
        it->second->process(*_os);
1735 1735
      }
1736 1736
    }
1737 1737

	
1738 1738
    /// \brief Give back the stream of the writer
1739 1739
    ///
1740 1740
    /// Returns the stream of the writer
1741 1741
    std::ostream& ostream() {
1742 1742
      return *_os;
1743 1743
    }
1744 1744

	
1745 1745
    /// @}
Ignore white space 6 line context
... ...
@@ -31,76 +31,76 @@
31 31
#include<lemon/core.h>
32 32
#include<lemon/bits/solver_bits.h>
33 33

	
34 34
///\file
35 35
///\brief The interface of the LP solver interface.
36 36
///\ingroup lp_group
37 37
namespace lemon {
38 38

	
39 39
  ///Common base class for LP and MIP solvers
40 40

	
41 41
  ///Usually this class is not used directly, please use one of the concrete
42 42
  ///implementations of the solver interface.
43 43
  ///\ingroup lp_group
44 44
  class LpBase {
45 45

	
46 46
  protected:
47 47

	
48 48
    _solver_bits::VarIndex rows;
49 49
    _solver_bits::VarIndex cols;
50 50

	
51 51
  public:
52 52

	
53 53
    ///Possible outcomes of an LP solving procedure
54 54
    enum SolveExitStatus {
55
      ///This means that the problem has been successfully solved: either
55
      /// = 0. It means that the problem has been successfully solved: either
56 56
      ///an optimal solution has been found or infeasibility/unboundedness
57 57
      ///has been proved.
58 58
      SOLVED = 0,
59
      ///Any other case (including the case when some user specified
60
      ///limit has been exceeded)
59
      /// = 1. Any other case (including the case when some user specified
60
      ///limit has been exceeded).
61 61
      UNSOLVED = 1
62 62
    };
63 63

	
64 64
    ///Direction of the optimization
65 65
    enum Sense {
66 66
      /// Minimization
67 67
      MIN,
68 68
      /// Maximization
69 69
      MAX
70 70
    };
71 71

	
72 72
    ///Enum for \c messageLevel() parameter
73 73
    enum MessageLevel {
74
      /// no output (default value)
74
      /// No output (default value).
75 75
      MESSAGE_NOTHING,
76
      /// error messages only
76
      /// Error messages only.
77 77
      MESSAGE_ERROR,
78
      /// warnings
78
      /// Warnings.
79 79
      MESSAGE_WARNING,
80
      /// normal output
80
      /// Normal output.
81 81
      MESSAGE_NORMAL,
82
      /// verbose output
82
      /// Verbose output.
83 83
      MESSAGE_VERBOSE
84 84
    };
85 85
    
86 86

	
87 87
    ///The floating point type used by the solver
88 88
    typedef double Value;
89 89
    ///The infinity constant
90 90
    static const Value INF;
91 91
    ///The not a number constant
92 92
    static const Value NaN;
93 93

	
94 94
    friend class Col;
95 95
    friend class ColIt;
96 96
    friend class Row;
97 97
    friend class RowIt;
98 98

	
99 99
    ///Refer to a column of the LP.
100 100

	
101 101
    ///This type is used to refer to a column of the LP.
102 102
    ///
103 103
    ///Its value remains valid and correct even after the addition or erase of
104 104
    ///other columns.
105 105
    ///
106 106
    ///\note This class is similar to other Item types in LEMON, like
... ...
@@ -984,49 +984,49 @@
984 984
    virtual void _setSense(Sense) = 0;
985 985
    virtual Sense _getSense() const = 0;
986 986

	
987 987
    virtual void _clear() = 0;
988 988

	
989 989
    virtual const char* _solverName() const = 0;
990 990

	
991 991
    virtual void _messageLevel(MessageLevel level) = 0;
992 992

	
993 993
    //Own protected stuff
994 994

	
995 995
    //Constant component of the objective function
996 996
    Value obj_const_comp;
997 997

	
998 998
    LpBase() : rows(), cols(), obj_const_comp(0) {}
999 999

	
1000 1000
  public:
1001 1001

	
1002 1002
    /// Virtual destructor
1003 1003
    virtual ~LpBase() {}
1004 1004

	
1005 1005
    ///Gives back the name of the solver.
1006 1006
    const char* solverName() const {return _solverName();}
1007 1007

	
1008
    ///\name Build up and modify the LP
1008
    ///\name Build Up and Modify the LP
1009 1009

	
1010 1010
    ///@{
1011 1011

	
1012 1012
    ///Add a new empty column (i.e a new variable) to the LP
1013 1013
    Col addCol() { Col c; c._id = _addColId(_addCol()); return c;}
1014 1014

	
1015 1015
    ///\brief Adds several new columns (i.e variables) at once
1016 1016
    ///
1017 1017
    ///This magic function takes a container as its argument and fills
1018 1018
    ///its elements with new columns (i.e. variables)
1019 1019
    ///\param t can be
1020 1020
    ///- a standard STL compatible iterable container with
1021 1021
    ///\ref Col as its \c values_type like
1022 1022
    ///\code
1023 1023
    ///std::vector<LpBase::Col>
1024 1024
    ///std::list<LpBase::Col>
1025 1025
    ///\endcode
1026 1026
    ///- a standard STL compatible iterable container with
1027 1027
    ///\ref Col as its \c mapped_type like
1028 1028
    ///\code
1029 1029
    ///std::map<AnyType,LpBase::Col>
1030 1030
    ///\endcode
1031 1031
    ///- an iterable lemon \ref concepts::WriteMap "write map" like
1032 1032
    ///\code
... ...
@@ -1767,57 +1767,57 @@
1767 1767
  ///
1768 1768
  inline LpBase::DualExpr operator/(const LpBase::DualExpr &a,
1769 1769
                                    const LpBase::Value &b) {
1770 1770
    LpBase::DualExpr tmp(a);
1771 1771
    tmp/=b;
1772 1772
    return tmp;
1773 1773
  }
1774 1774

	
1775 1775
  /// \ingroup lp_group
1776 1776
  ///
1777 1777
  /// \brief Common base class for LP solvers
1778 1778
  ///
1779 1779
  /// This class is an abstract base class for LP solvers. This class
1780 1780
  /// provides a full interface for set and modify an LP problem,
1781 1781
  /// solve it and retrieve the solution. You can use one of the
1782 1782
  /// descendants as a concrete implementation, or the \c Lp
1783 1783
  /// default LP solver. However, if you would like to handle LP
1784 1784
  /// solvers as reference or pointer in a generic way, you can use
1785 1785
  /// this class directly.
1786 1786
  class LpSolver : virtual public LpBase {
1787 1787
  public:
1788 1788

	
1789 1789
    /// The problem types for primal and dual problems
1790 1790
    enum ProblemType {
1791
      ///Feasible solution hasn't been found (but may exist).
1791
      /// = 0. Feasible solution hasn't been found (but may exist).
1792 1792
      UNDEFINED = 0,
1793
      ///The problem has no feasible solution
1793
      /// = 1. The problem has no feasible solution.
1794 1794
      INFEASIBLE = 1,
1795
      ///Feasible solution found
1795
      /// = 2. Feasible solution found.
1796 1796
      FEASIBLE = 2,
1797
      ///Optimal solution exists and found
1797
      /// = 3. Optimal solution exists and found.
1798 1798
      OPTIMAL = 3,
1799
      ///The cost function is unbounded
1799
      /// = 4. The cost function is unbounded.
1800 1800
      UNBOUNDED = 4
1801 1801
    };
1802 1802

	
1803 1803
    ///The basis status of variables
1804 1804
    enum VarStatus {
1805 1805
      /// The variable is in the basis
1806 1806
      BASIC, 
1807 1807
      /// The variable is free, but not basic
1808 1808
      FREE,
1809 1809
      /// The variable has active lower bound 
1810 1810
      LOWER,
1811 1811
      /// The variable has active upper bound
1812 1812
      UPPER,
1813 1813
      /// The variable is non-basic and fixed
1814 1814
      FIXED
1815 1815
    };
1816 1816

	
1817 1817
  protected:
1818 1818

	
1819 1819
    virtual SolveExitStatus _solve() = 0;
1820 1820

	
1821 1821
    virtual Value _getPrimal(int i) const = 0;
1822 1822
    virtual Value _getDual(int i) const = 0;
1823 1823

	
... ...
@@ -1831,49 +1831,49 @@
1831 1831

	
1832 1832
    virtual ProblemType _getPrimalType() const = 0;
1833 1833
    virtual ProblemType _getDualType() const = 0;
1834 1834

	
1835 1835
  public:
1836 1836

	
1837 1837
    ///Allocate a new LP problem instance
1838 1838
    virtual LpSolver* newSolver() const = 0;
1839 1839
    ///Make a copy of the LP problem
1840 1840
    virtual LpSolver* cloneSolver() const = 0;
1841 1841

	
1842 1842
    ///\name Solve the LP
1843 1843

	
1844 1844
    ///@{
1845 1845

	
1846 1846
    ///\e Solve the LP problem at hand
1847 1847
    ///
1848 1848
    ///\return The result of the optimization procedure. Possible
1849 1849
    ///values and their meanings can be found in the documentation of
1850 1850
    ///\ref SolveExitStatus.
1851 1851
    SolveExitStatus solve() { return _solve(); }
1852 1852

	
1853 1853
    ///@}
1854 1854

	
1855
    ///\name Obtain the solution
1855
    ///\name Obtain the Solution
1856 1856

	
1857 1857
    ///@{
1858 1858

	
1859 1859
    /// The type of the primal problem
1860 1860
    ProblemType primalType() const {
1861 1861
      return _getPrimalType();
1862 1862
    }
1863 1863

	
1864 1864
    /// The type of the dual problem
1865 1865
    ProblemType dualType() const {
1866 1866
      return _getDualType();
1867 1867
    }
1868 1868

	
1869 1869
    /// Return the primal value of the column
1870 1870

	
1871 1871
    /// Return the primal value of the column.
1872 1872
    /// \pre The problem is solved.
1873 1873
    Value primal(Col c) const { return _getPrimal(cols(id(c))); }
1874 1874

	
1875 1875
    /// Return the primal value of the expression
1876 1876

	
1877 1877
    /// Return the primal value of the expression, i.e. the dot
1878 1878
    /// product of the primal solution and the expression.
1879 1879
    /// \pre The problem is solved.
... ...
@@ -1953,109 +1953,108 @@
1953 1953
    Value primal() const { return _getPrimalValue()+obj_const_comp;}
1954 1954
    ///@}
1955 1955

	
1956 1956
  protected:
1957 1957

	
1958 1958
  };
1959 1959

	
1960 1960

	
1961 1961
  /// \ingroup lp_group
1962 1962
  ///
1963 1963
  /// \brief Common base class for MIP solvers
1964 1964
  ///
1965 1965
  /// This class is an abstract base class for MIP solvers. This class
1966 1966
  /// provides a full interface for set and modify an MIP problem,
1967 1967
  /// solve it and retrieve the solution. You can use one of the
1968 1968
  /// descendants as a concrete implementation, or the \c Lp
1969 1969
  /// default MIP solver. However, if you would like to handle MIP
1970 1970
  /// solvers as reference or pointer in a generic way, you can use
1971 1971
  /// this class directly.
1972 1972
  class MipSolver : virtual public LpBase {
1973 1973
  public:
1974 1974

	
1975 1975
    /// The problem types for MIP problems
1976 1976
    enum ProblemType {
1977
      ///Feasible solution hasn't been found (but may exist).
1977
      /// = 0. Feasible solution hasn't been found (but may exist).
1978 1978
      UNDEFINED = 0,
1979
      ///The problem has no feasible solution
1979
      /// = 1. The problem has no feasible solution.
1980 1980
      INFEASIBLE = 1,
1981
      ///Feasible solution found
1981
      /// = 2. Feasible solution found.
1982 1982
      FEASIBLE = 2,
1983
      ///Optimal solution exists and found
1983
      /// = 3. Optimal solution exists and found.
1984 1984
      OPTIMAL = 3,
1985
      ///The cost function is unbounded
1986
      ///
1987
      ///The Mip or at least the relaxed problem is unbounded
1985
      /// = 4. The cost function is unbounded.
1986
      ///The Mip or at least the relaxed problem is unbounded.
1988 1987
      UNBOUNDED = 4
1989 1988
    };
1990 1989

	
1991 1990
    ///Allocate a new MIP problem instance
1992 1991
    virtual MipSolver* newSolver() const = 0;
1993 1992
    ///Make a copy of the MIP problem
1994 1993
    virtual MipSolver* cloneSolver() const = 0;
1995 1994

	
1996 1995
    ///\name Solve the MIP
1997 1996

	
1998 1997
    ///@{
1999 1998

	
2000 1999
    /// Solve the MIP problem at hand
2001 2000
    ///
2002 2001
    ///\return The result of the optimization procedure. Possible
2003 2002
    ///values and their meanings can be found in the documentation of
2004 2003
    ///\ref SolveExitStatus.
2005 2004
    SolveExitStatus solve() { return _solve(); }
2006 2005

	
2007 2006
    ///@}
2008 2007

	
2009
    ///\name Setting column type
2008
    ///\name Set Column Type
2010 2009
    ///@{
2011 2010

	
2012 2011
    ///Possible variable (column) types (e.g. real, integer, binary etc.)
2013 2012
    enum ColTypes {
2014
      ///Continuous variable (default)
2013
      /// = 0. Continuous variable (default).
2015 2014
      REAL = 0,
2016
      ///Integer variable
2015
      /// = 1. Integer variable.
2017 2016
      INTEGER = 1
2018 2017
    };
2019 2018

	
2020 2019
    ///Sets the type of the given column to the given type
2021 2020

	
2022 2021
    ///Sets the type of the given column to the given type.
2023 2022
    ///
2024 2023
    void colType(Col c, ColTypes col_type) {
2025 2024
      _setColType(cols(id(c)),col_type);
2026 2025
    }
2027 2026

	
2028 2027
    ///Gives back the type of the column.
2029 2028

	
2030 2029
    ///Gives back the type of the column.
2031 2030
    ///
2032 2031
    ColTypes colType(Col c) const {
2033 2032
      return _getColType(cols(id(c)));
2034 2033
    }
2035 2034
    ///@}
2036 2035

	
2037
    ///\name Obtain the solution
2036
    ///\name Obtain the Solution
2038 2037

	
2039 2038
    ///@{
2040 2039

	
2041 2040
    /// The type of the MIP problem
2042 2041
    ProblemType type() const {
2043 2042
      return _getType();
2044 2043
    }
2045 2044

	
2046 2045
    /// Return the value of the row in the solution
2047 2046

	
2048 2047
    ///  Return the value of the row in the solution.
2049 2048
    /// \pre The problem is solved.
2050 2049
    Value sol(Col c) const { return _getSol(cols(id(c))); }
2051 2050

	
2052 2051
    /// Return the value of the expression in the solution
2053 2052

	
2054 2053
    /// Return the value of the expression in the solution, i.e. the
2055 2054
    /// dot product of the solution and the expression.
2056 2055
    /// \pre The problem is solved.
2057 2056
    Value sol(const Expr& e) const {
2058 2057
      double res = *e;
2059 2058
      for (Expr::ConstCoeffIt c(e); c != INVALID; ++c) {
2060 2059
        res += *c * sol(c);
2061 2060
      }
Ignore white space 6 line context
... ...
@@ -2707,50 +2707,50 @@
2707 2707
      for (int i = 0; i < int(arcs.size()); ++i) {
2708 2708
        --_deg[_digraph.source(arcs[i])];
2709 2709
      }
2710 2710
    }
2711 2711

	
2712 2712
    virtual void build() {
2713 2713
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
2714 2714
        _deg[it] = countOutArcs(_digraph, it);
2715 2715
      }
2716 2716
    }
2717 2717

	
2718 2718
    virtual void clear() {
2719 2719
      for(typename Digraph::NodeIt it(_digraph); it != INVALID; ++it) {
2720 2720
        _deg[it] = 0;
2721 2721
      }
2722 2722
    }
2723 2723
  private:
2724 2724

	
2725 2725
    const Digraph& _digraph;
2726 2726
    AutoNodeMap _deg;
2727 2727
  };
2728 2728

	
2729 2729
  /// \brief Potential difference map
2730 2730
  ///
2731
  /// PotentialMap returns the difference between the potentials of the
2732
  /// source and target nodes of each arc in a digraph, i.e. it returns
2731
  /// PotentialDifferenceMap returns the difference between the potentials of
2732
  /// the source and target nodes of each arc in a digraph, i.e. it returns
2733 2733
  /// \code
2734 2734
  ///   potential[gr.target(arc)] - potential[gr.source(arc)].
2735 2735
  /// \endcode
2736 2736
  /// \tparam GR The digraph type.
2737 2737
  /// \tparam POT A node map storing the potentials.
2738 2738
  template <typename GR, typename POT>
2739 2739
  class PotentialDifferenceMap {
2740 2740
  public:
2741 2741
    /// Key type
2742 2742
    typedef typename GR::Arc Key;
2743 2743
    /// Value type
2744 2744
    typedef typename POT::Value Value;
2745 2745

	
2746 2746
    /// \brief Constructor
2747 2747
    ///
2748 2748
    /// Contructor of the map.
2749 2749
    explicit PotentialDifferenceMap(const GR& gr,
2750 2750
                                    const POT& potential)
2751 2751
      : _digraph(gr), _potential(potential) {}
2752 2752

	
2753 2753
    /// \brief Returns the potential difference for the given arc.
2754 2754
    ///
2755 2755
    /// Returns the potential difference for the given arc, i.e.
2756 2756
    /// \code
Ignore white space 6 line context
... ...
@@ -69,52 +69,52 @@
69 69
    /// \param digraph is the graph, to which we would like to
70 70
    /// calculate the \c ArborescenceMap.
71 71
    static ArborescenceMap *createArborescenceMap(const Digraph &digraph){
72 72
      return new ArborescenceMap(digraph);
73 73
    }
74 74

	
75 75
    /// \brief The type of the \c PredMap
76 76
    ///
77 77
    /// The type of the \c PredMap. It is a node map with an arc value type.
78 78
    typedef typename Digraph::template NodeMap<typename Digraph::Arc> PredMap;
79 79

	
80 80
    /// \brief Instantiates a \c PredMap.
81 81
    ///
82 82
    /// This function instantiates a \c PredMap.
83 83
    /// \param digraph The digraph to which we would like to define the
84 84
    /// \c PredMap.
85 85
    static PredMap *createPredMap(const Digraph &digraph){
86 86
      return new PredMap(digraph);
87 87
    }
88 88

	
89 89
  };
90 90

	
91 91
  /// \ingroup spantree
92 92
  ///
93
  /// \brief %MinCostArborescence algorithm class.
93
  /// \brief Minimum Cost Arborescence algorithm class.
94 94
  ///
95 95
  /// This class provides an efficient implementation of
96
  /// %MinCostArborescence algorithm. The arborescence is a tree
96
  /// Minimum Cost Arborescence algorithm. The arborescence is a tree
97 97
  /// which is directed from a given source node of the digraph. One or
98 98
  /// more sources should be given for the algorithm and it will calculate
99 99
  /// the minimum cost subgraph which are union of arborescences with the
100 100
  /// given sources and spans all the nodes which are reachable from the
101 101
  /// sources. The time complexity of the algorithm is O(n<sup>2</sup>+e).
102 102
  ///
103 103
  /// The algorithm provides also an optimal dual solution, therefore
104 104
  /// the optimality of the solution can be checked.
105 105
  ///
106 106
  /// \param GR The digraph type the algorithm runs on. The default value
107 107
  /// is \ref ListDigraph.
108 108
  /// \param CM This read-only ArcMap determines the costs of the
109 109
  /// arcs. It is read once for each arc, so the map may involve in
110 110
  /// relatively time consuming process to compute the arc cost if
111 111
  /// it is necessary. The default map type is \ref
112 112
  /// concepts::Digraph::ArcMap "Digraph::ArcMap<int>".
113 113
  /// \param TR Traits class to set various data types used
114 114
  /// by the algorithm. The default traits class is
115 115
  /// \ref MinCostArborescenceDefaultTraits
116 116
  /// "MinCostArborescenceDefaultTraits<GR, CM>".  See \ref
117 117
  /// MinCostArborescenceDefaultTraits for the documentation of a
118 118
  /// MinCostArborescence traits class.
119 119
#ifndef DOXYGEN
120 120
  template <typename GR = ListDigraph,
... ...
@@ -369,49 +369,49 @@
369 369
          if ((*_arc_order)[it] < 0) continue;
370 370
          Node target = _digraph->target(it);
371 371
          switch(_heap->state(target)) {
372 372
          case Heap::PRE_HEAP:
373 373
            _heap->push(target, (*_arc_order)[it]);
374 374
            _pred->set(target, it);
375 375
            break;
376 376
          case Heap::IN_HEAP:
377 377
            if ((*_arc_order)[it] < (*_heap)[target]) {
378 378
              _heap->decrease(target, (*_arc_order)[it]);
379 379
              _pred->set(target, it);
380 380
            }
381 381
            break;
382 382
          case Heap::POST_HEAP:
383 383
            break;
384 384
          }
385 385
        }
386 386
        _arborescence->set((*_pred)[source], true);
387 387
      }
388 388
    }
389 389

	
390 390

	
391 391
  public:
392 392

	
393
    /// \name Named template parameters
393
    /// \name Named Template Parameters
394 394

	
395 395
    /// @{
396 396

	
397 397
    template <class T>
398 398
    struct DefArborescenceMapTraits : public Traits {
399 399
      typedef T ArborescenceMap;
400 400
      static ArborescenceMap *createArborescenceMap(const Digraph &)
401 401
      {
402 402
        LEMON_ASSERT(false, "ArborescenceMap is not initialized");
403 403
        return 0; // ignore warnings
404 404
      }
405 405
    };
406 406

	
407 407
    /// \brief \ref named-templ-param "Named parameter" for
408 408
    /// setting ArborescenceMap type
409 409
    ///
410 410
    /// \ref named-templ-param "Named parameter" for setting
411 411
    /// ArborescenceMap type
412 412
    template <class T>
413 413
    struct DefArborescenceMap
414 414
      : public MinCostArborescence<Digraph, CostMap,
415 415
                                   DefArborescenceMapTraits<T> > {
416 416
    };
417 417

	
... ...
@@ -609,49 +609,49 @@
609 609
        return *this;
610 610
      }
611 611

	
612 612
      /// \brief Validity checking
613 613
      ///
614 614
      /// Checks whether the iterator is invalid.
615 615
      bool operator==(Invalid) const {
616 616
        return _index == _last;
617 617
      }
618 618

	
619 619
      /// \brief Validity checking
620 620
      ///
621 621
      /// Checks whether the iterator is valid.
622 622
      bool operator!=(Invalid) const {
623 623
        return _index != _last;
624 624
      }
625 625

	
626 626
    private:
627 627
      const MinCostArborescence* _algorithm;
628 628
      int _index, _last;
629 629
    };
630 630

	
631 631
    /// @}
632 632

	
633
    /// \name Execution control
633
    /// \name Execution Control
634 634
    /// The simplest way to execute the algorithm is to use
635 635
    /// one of the member functions called \c run(...). \n
636 636
    /// If you need more control on the execution,
637 637
    /// first you must call \ref init(), then you can add several
638 638
    /// source nodes with \ref addSource().
639 639
    /// Finally \ref start() will perform the arborescence
640 640
    /// computation.
641 641

	
642 642
    ///@{
643 643

	
644 644
    /// \brief Initializes the internal data structures.
645 645
    ///
646 646
    /// Initializes the internal data structures.
647 647
    ///
648 648
    void init() {
649 649
      createStructures();
650 650
      _heap->clear();
651 651
      for (NodeIt it(*_digraph); it != INVALID; ++it) {
652 652
        (*_cost_arcs)[it].arc = INVALID;
653 653
        (*_node_order)[it] = -3;
654 654
        (*_heap_cross_ref)[it] = Heap::PRE_HEAP;
655 655
        _pred->set(it, INVALID);
656 656
      }
657 657
      for (ArcIt it(*_digraph); it != INVALID; ++it) {
Ignore white space 6 line context
... ...
@@ -638,49 +638,49 @@
638 638
      if (!rs.read(reinterpret_cast<char*>(buf), sizeof(buf))) return false;
639 639
      seed(buf, buf + size);
640 640
      return true;
641 641
    }
642 642

	
643 643
    /// \brief Seding from process id and time
644 644
    ///
645 645
    /// Seding from process id and time. This function uses the
646 646
    /// current process id and the current time for initialize the
647 647
    /// random sequence.
648 648
    /// \return Currently always \c true.
649 649
    bool seedFromTime() {
650 650
#ifndef WIN32
651 651
      timeval tv;
652 652
      gettimeofday(&tv, 0);
653 653
      seed(getpid() + tv.tv_sec + tv.tv_usec);
654 654
#else
655 655
      seed(bits::getWinRndSeed());
656 656
#endif
657 657
      return true;
658 658
    }
659 659

	
660 660
    /// @}
661 661

	
662
    ///\name Uniform distributions
662
    ///\name Uniform Distributions
663 663
    ///
664 664
    /// @{
665 665

	
666 666
    /// \brief Returns a random real number from the range [0, 1)
667 667
    ///
668 668
    /// It returns a random real number from the range [0, 1). The
669 669
    /// default Number type is \c double.
670 670
    template <typename Number>
671 671
    Number real() {
672 672
      return _random_bits::RealConversion<Number, Word>::convert(core);
673 673
    }
674 674

	
675 675
    double real() {
676 676
      return real<double>();
677 677
    }
678 678

	
679 679
    /// \brief Returns a random real number from the range [0, 1)
680 680
    ///
681 681
    /// It returns a random double from the range [0, 1).
682 682
    double operator()() {
683 683
      return real<double>();
684 684
    }
685 685

	
686 686
    /// \brief Returns a random real number from the range [0, b)
... ...
@@ -741,49 +741,49 @@
741 741
    /// the current \c Number type. The default result type of this
742 742
    /// function is \c int.
743 743
    template <typename Number>
744 744
    Number integer() {
745 745
      static const int nb = std::numeric_limits<Number>::digits +
746 746
        (std::numeric_limits<Number>::is_signed ? 1 : 0);
747 747
      return _random_bits::IntConversion<Number, Word, nb>::convert(core);
748 748
    }
749 749

	
750 750
    int integer() {
751 751
      return integer<int>();
752 752
    }
753 753

	
754 754
    /// \brief Returns a random bool
755 755
    ///
756 756
    /// It returns a random bool. The generator holds a buffer for
757 757
    /// random bits. Every time when it become empty the generator makes
758 758
    /// a new random word and fill the buffer up.
759 759
    bool boolean() {
760 760
      return bool_producer.convert(core);
761 761
    }
762 762

	
763 763
    /// @}
764 764

	
765
    ///\name Non-uniform distributions
765
    ///\name Non-uniform Distributions
766 766
    ///
767 767
    ///@{
768 768

	
769 769
    /// \brief Returns a random bool with given probability of true result.
770 770
    ///
771 771
    /// It returns a random bool with given probability of true result.
772 772
    bool boolean(double p) {
773 773
      return operator()() < p;
774 774
    }
775 775

	
776 776
    /// Standard normal (Gauss) distribution
777 777

	
778 778
    /// Standard normal (Gauss) distribution.
779 779
    /// \note The Cartesian form of the Box-Muller
780 780
    /// transformation is used to generate a random normal distribution.
781 781
    double gauss()
782 782
    {
783 783
      double V1,V2,S;
784 784
      do {
785 785
        V1=2*real<double>()-1;
786 786
        V2=2*real<double>()-1;
787 787
        S=V1*V1+V2*V2;
788 788
      } while(S>=1);
789 789
      return std::sqrt(-2*std::log(S)/S)*V1;
... ...
@@ -917,49 +917,49 @@
917 917

	
918 918
    /// This function generates a Poisson distribution random number with
919 919
    /// parameter \c lambda.
920 920
    ///
921 921
    /// The probability mass function of this distribusion is
922 922
    /// \f[ \frac{e^{-\lambda}\lambda^k}{k!} \f]
923 923
    /// \note The algorithm is taken from the book of Donald E. Knuth titled
924 924
    /// ''Seminumerical Algorithms'' (1969). Its running time is linear in the
925 925
    /// return value.
926 926

	
927 927
    int poisson(double lambda)
928 928
    {
929 929
      const double l = std::exp(-lambda);
930 930
      int k=0;
931 931
      double p = 1.0;
932 932
      do {
933 933
        k++;
934 934
        p*=real<double>();
935 935
      } while (p>=l);
936 936
      return k-1;
937 937
    }
938 938

	
939 939
    ///@}
940 940

	
941
    ///\name Two dimensional distributions
941
    ///\name Two Dimensional Distributions
942 942
    ///
943 943
    ///@{
944 944

	
945 945
    /// Uniform distribution on the full unit circle
946 946

	
947 947
    /// Uniform distribution on the full unit circle.
948 948
    ///
949 949
    dim2::Point<double> disc()
950 950
    {
951 951
      double V1,V2;
952 952
      do {
953 953
        V1=2*real<double>()-1;
954 954
        V2=2*real<double>()-1;
955 955

	
956 956
      } while(V1*V1+V2*V2>=1);
957 957
      return dim2::Point<double>(V1,V2);
958 958
    }
959 959
    /// A kind of two dimensional normal (Gauss) distribution
960 960

	
961 961
    /// This function provides a turning symmetric two-dimensional distribution.
962 962
    /// Both coordinates are of standard normal distribution, but they are not
963 963
    /// independent.
964 964
    ///
965 965
    /// \note The coordinates are the two random variables provided by
Ignore white space 6 line context
... ...
@@ -267,49 +267,49 @@
267 267
        delete _flow;
268 268
        _local_flow = false;
269 269
      }
270 270
      _flow = &map;
271 271
      return *this;
272 272
    }
273 273

	
274 274
    /// \brief Set the potential map.
275 275
    ///
276 276
    /// This function sets the potential map.
277 277
    ///
278 278
    /// The potentials provide the dual solution of the underlying
279 279
    /// minimum cost flow problem.
280 280
    ///
281 281
    /// \return <tt>(*this)</tt>
282 282
    Suurballe& potentialMap(PotentialMap &map) {
283 283
      if (_local_potential) {
284 284
        delete _potential;
285 285
        _local_potential = false;
286 286
      }
287 287
      _potential = &map;
288 288
      return *this;
289 289
    }
290 290

	
291
    /// \name Execution control
291
    /// \name Execution Control
292 292
    /// The simplest way to execute the algorithm is to call the run()
293 293
    /// function.
294 294
    /// \n
295 295
    /// If you only need the flow that is the union of the found
296 296
    /// arc-disjoint paths, you may call init() and findFlow().
297 297

	
298 298
    /// @{
299 299

	
300 300
    /// \brief Run the algorithm.
301 301
    ///
302 302
    /// This function runs the algorithm.
303 303
    ///
304 304
    /// \param k The number of paths to be found.
305 305
    ///
306 306
    /// \return \c k if there are at least \c k arc-disjoint paths from
307 307
    /// \c s to \c t in the digraph. Otherwise it returns the number of
308 308
    /// arc-disjoint paths found.
309 309
    ///
310 310
    /// \note Apart from the return value, <tt>s.run(k)</tt> is just a
311 311
    /// shortcut of the following code.
312 312
    /// \code
313 313
    ///   s.init();
314 314
    ///   s.findFlow(k);
315 315
    ///   s.findPaths();
Ignore white space 6 line context
... ...
@@ -266,49 +266,49 @@
266 266
  ///granularity.
267 267
  ///Therefore this tool is not appropriate to measure very short times.
268 268
  ///Also, if you start and stop the timer very frequently, it could lead to
269 269
  ///distorted results.
270 270
  ///
271 271
  ///\note If you want to measure the running time of the execution of a certain
272 272
  ///function, consider the usage of \ref TimeReport instead.
273 273
  ///
274 274
  ///\sa TimeReport
275 275
  class Timer
276 276
  {
277 277
    int _running; //Timer is running iff _running>0; (_running>=0 always holds)
278 278
    TimeStamp start_time; //This is the relativ start-time if the timer
279 279
                          //is _running, the collected _running time otherwise.
280 280

	
281 281
    void _reset() {if(_running) start_time.stamp(); else start_time.reset();}
282 282

	
283 283
  public:
284 284
    ///Constructor.
285 285

	
286 286
    ///\param run indicates whether or not the timer starts immediately.
287 287
    ///
288 288
    Timer(bool run=true) :_running(run) {_reset();}
289 289

	
290
    ///\name Control the state of the timer
290
    ///\name Control the State of the Timer
291 291
    ///Basically a Timer can be either running or stopped,
292 292
    ///but it provides a bit finer control on the execution.
293 293
    ///The \ref lemon::Timer "Timer" also counts the number of
294 294
    ///\ref lemon::Timer::start() "start()" executions, and it stops
295 295
    ///only after the same amount (or more) \ref lemon::Timer::stop()
296 296
    ///"stop()"s. This can be useful e.g. to compute the running time
297 297
    ///of recursive functions.
298 298

	
299 299
    ///@{
300 300

	
301 301
    ///Reset and stop the time counters
302 302

	
303 303
    ///This function resets and stops the time counters
304 304
    ///\sa restart()
305 305
    void reset()
306 306
    {
307 307
      _running=0;
308 308
      _reset();
309 309
    }
310 310

	
311 311
    ///Start the time counters
312 312

	
313 313
    ///This function starts the time counters.
314 314
    ///
... ...
@@ -374,49 +374,49 @@
374 374
    ///Returns the running state of the timer
375 375

	
376 376
    ///This function returns the number of stop() exections that is
377 377
    ///necessary to really stop the timer.
378 378
    ///For example the timer
379 379
    ///is running if and only if the return value is \c true
380 380
    ///(i.e. greater than
381 381
    ///zero).
382 382
    int running()  { return _running; }
383 383

	
384 384

	
385 385
    ///Restart the time counters
386 386

	
387 387
    ///This function is a shorthand for
388 388
    ///a reset() and a start() calls.
389 389
    ///
390 390
    void restart()
391 391
    {
392 392
      reset();
393 393
      start();
394 394
    }
395 395

	
396 396
    ///@}
397 397

	
398
    ///\name Query Functions for the ellapsed time
398
    ///\name Query Functions for the Ellapsed Time
399 399

	
400 400
    ///@{
401 401

	
402 402
    ///Gives back the ellapsed user time of the process
403 403
    double userTime() const
404 404
    {
405 405
      return operator TimeStamp().userTime();
406 406
    }
407 407
    ///Gives back the ellapsed system time of the process
408 408
    double systemTime() const
409 409
    {
410 410
      return operator TimeStamp().systemTime();
411 411
    }
412 412
    ///Gives back the ellapsed user time of the process' children
413 413

	
414 414
    ///\note On <tt>WIN32</tt> platform this value is not calculated.
415 415
    ///
416 416
    double cUserTime() const
417 417
    {
418 418
      return operator TimeStamp().cUserTime();
419 419
    }
420 420
    ///Gives back the ellapsed user time of the process' children
421 421

	
422 422
    ///\note On <tt>WIN32</tt> platform this value is not calculated.
Ignore white space 6 line context
... ...
@@ -2,53 +2,52 @@
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2009
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
///\ingroup tools
20 20
///\file
21 21
///\brief DIMACS problem solver.
22 22
///
23 23
/// This program solves various problems given in DIMACS format.
24 24
///
25 25
/// See
26
/// \verbatim
27
///  dimacs-solver --help
28
/// \endverbatim
26
/// \code
27
///   dimacs-solver --help
28
/// \endcode
29 29
/// for more info on usage.
30
///
31 30

	
32 31
#include <iostream>
33 32
#include <fstream>
34 33
#include <cstring>
35 34

	
36 35
#include <lemon/smart_graph.h>
37 36
#include <lemon/dimacs.h>
38 37
#include <lemon/lgf_writer.h>
39 38
#include <lemon/time_measure.h>
40 39

	
41 40
#include <lemon/arg_parser.h>
42 41
#include <lemon/error.h>
43 42

	
44 43
#include <lemon/dijkstra.h>
45 44
#include <lemon/preflow.h>
46 45
#include <lemon/max_matching.h>
47 46

	
48 47
using namespace lemon;
49 48
typedef SmartDigraph Digraph;
50 49
DIGRAPH_TYPEDEFS(Digraph);
51 50
typedef SmartGraph Graph;
52 51

	
53 52
template<class Value>
54 53
void solve_sp(ArgParser &ap, std::istream &is, std::ostream &,
Ignore white space 6 line context
... ...
@@ -3,53 +3,52 @@
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2009
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
///\ingroup tools
20 20
///\file
21 21
///\brief DIMACS to LGF converter.
22 22
///
23 23
/// This program converts various DIMACS formats to the LEMON Digraph Format
24 24
/// (LGF).
25 25
///
26 26
/// See
27
/// \verbatim
28
///  dimacs-to-lgf --help
29
/// \endverbatim
30
/// for more info on usage.
31
///
27
/// \code
28
///   dimacs-to-lgf --help
29
/// \endcode
30
/// for more info on the usage.
32 31

	
33 32
#include <iostream>
34 33
#include <fstream>
35 34
#include <cstring>
36 35

	
37 36
#include <lemon/smart_graph.h>
38 37
#include <lemon/dimacs.h>
39 38
#include <lemon/lgf_writer.h>
40 39

	
41 40
#include <lemon/arg_parser.h>
42 41
#include <lemon/error.h>
43 42

	
44 43
using namespace std;
45 44
using namespace lemon;
46 45

	
47 46

	
48 47
int main(int argc, const char *argv[]) {
49 48
  typedef SmartDigraph Digraph;
50 49

	
51 50
  typedef Digraph::Arc Arc;
52 51
  typedef Digraph::Node Node;
53 52
  typedef Digraph::ArcIt ArcIt;
54 53
  typedef Digraph::NodeIt NodeIt;
55 54
  typedef Digraph::ArcMap<double> DoubleArcMap;
Ignore white space 6 line context
... ...
@@ -2,54 +2,52 @@
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2009
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
/// \ingroup tools
20 20
/// \file
21 21
/// \brief Special plane digraph generator.
22 22
///
23 23
/// Graph generator application for various types of plane graphs.
24 24
///
25 25
/// See
26
/// \verbatim
27
///  lgf-gen --help
28
/// \endverbatim
26
/// \code
27
///   lgf-gen --help
28
/// \endcode
29 29
/// for more info on the usage.
30
///
31

	
32 30

	
33 31
#include <algorithm>
34 32
#include <set>
35 33
#include <ctime>
36 34
#include <lemon/list_graph.h>
37 35
#include <lemon/random.h>
38 36
#include <lemon/dim2.h>
39 37
#include <lemon/bfs.h>
40 38
#include <lemon/counter.h>
41 39
#include <lemon/suurballe.h>
42 40
#include <lemon/graph_to_eps.h>
43 41
#include <lemon/lgf_writer.h>
44 42
#include <lemon/arg_parser.h>
45 43
#include <lemon/euler.h>
46 44
#include <lemon/math.h>
47 45
#include <lemon/kruskal.h>
48 46
#include <lemon/time_measure.h>
49 47

	
50 48
using namespace lemon;
51 49

	
52 50
typedef dim2::Point<double> Point;
53 51

	
54 52
GRAPH_TYPEDEFS(ListGraph);
55 53

	
0 comments (0 inline)