COIN-OR::LEMON - Graph Library

Changeset 1374:00769a5f0f5d in lemon


Ignore:
Timestamp:
09/19/17 15:19:48 (7 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
1.2
Parents:
1365:1e87c18cf65e (diff), 1373:332627dd249e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge bugfix #607 to branch 1.2

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/dimacs.h

    r956 r1374  
    2626#include <lemon/maps.h>
    2727#include <lemon/error.h>
     28
    2829/// \ingroup dimacs_group
    2930/// \file
     
    123124  ///
    124125  /// If the file type was previously evaluated by dimacsType(), then
    125   /// the descriptor struct should be given by the \c dest parameter.
     126  /// the descriptor struct should be given by the \c desc parameter.
    126127  template <typename Digraph, typename LowerMap,
    127128            typename CapacityMap, typename CostMap,
     
    277278  ///
    278279  /// If the file type was previously evaluated by dimacsType(), then
    279   /// the descriptor struct should be given by the \c dest parameter.
     280  /// the descriptor struct should be given by the \c desc parameter.
    280281  template<typename Digraph, typename CapacityMap>
    281282  void readDimacsMax(std::istream& is,
     
    304305  ///
    305306  /// If the file type was previously evaluated by dimacsType(), then
    306   /// the descriptor struct should be given by the \c dest parameter.
     307  /// the descriptor struct should be given by the \c desc parameter.
    307308  template<typename Digraph, typename LengthMap>
    308309  void readDimacsSp(std::istream& is,
     
    335336  ///
    336337  /// If the file type was previously evaluated by dimacsType(), then
    337   /// the descriptor struct should be given by the \c dest parameter.
     338  /// the descriptor struct should be given by the \c desc parameter.
    338339  template<typename Digraph, typename CapacityMap>
    339340  void readDimacsCap(std::istream& is,
     
    344345    typename Digraph::Node u,v;
    345346    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
    346     if(desc.type!=DimacsDescriptor::MAX || desc.type!=DimacsDescriptor::SP)
     347    if(desc.type!=DimacsDescriptor::MAX && desc.type!=DimacsDescriptor::SP)
    347348      throw FormatError("Problem type mismatch");
    348349    _readDimacs(is, g, capacity, u, v, infty, desc);
     
    375376  ///
    376377  /// If the file type was previously evaluated by dimacsType(), then
    377   /// the descriptor struct should be given by the \c dest parameter.
     378  /// the descriptor struct should be given by the \c desc parameter.
    378379  template<typename Graph>
    379380  void readDimacsMat(std::istream& is, Graph &g,
  • lemon/dimacs.h

    r1373 r1374  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    3939  struct DimacsDescriptor
    4040  {
    41     ///File type enum
    42     enum Type
    43       {
    44         NONE, MIN, MAX, SP, MAT
    45       };
     41    ///\brief DIMACS file type enum
     42    ///
     43    ///DIMACS file type enum.
     44    enum Type {
     45      NONE,  ///< Undefined type.
     46      MIN,   ///< DIMACS file type for minimum cost flow problems.
     47      MAX,   ///< DIMACS file type for maximum flow problems.
     48      SP,    ///< DIMACS file type for shostest path problems.
     49      MAT    ///< DIMACS file type for plain graphs and matching problems.
     50    };
    4651    ///The file type
    4752    Type type;
     
    5156    int edgeNum;
    5257    int lineShift;
    53     /// Constructor. Sets the type to NONE.
     58    ///Constructor. It sets the type to \c NONE.
    5459    DimacsDescriptor() : type(NONE) {}
    5560  };
     
    5762  ///Discover the type of a DIMACS file
    5863
    59   ///It starts seeking the beginning of the file for the problem type
    60   ///and size info. The found data is returned in a special struct
    61   ///that can be evaluated and passed to the appropriate reader
    62   ///function.
     64  ///This function starts seeking the beginning of the given file for the
     65  ///problem type and size info.
     66  ///The found data is returned in a special struct that can be evaluated
     67  ///and passed to the appropriate reader function.
    6368  DimacsDescriptor dimacsType(std::istream& is)
    6469  {
     
    98103
    99104
    100 
    101   /// DIMACS minimum cost flow reader function.
     105  /// \brief DIMACS minimum cost flow reader function.
    102106  ///
    103107  /// This function reads a minimum cost flow instance from DIMACS format,
     
    210214        std::numeric_limits<Capacity>::infinity() :
    211215        std::numeric_limits<Capacity>::max();
    212  
     216
    213217    while (is >> c) {
    214218      switch (c) {
     
    235239          e = g.addArc(nodes[i], nodes[j]);
    236240          capacity.set(e, _cap);
    237         } 
     241        }
    238242        else if (desc.type==DimacsDescriptor::MAX) {
    239243          is >> i >> j >> _cap;
     
    255259  }
    256260
    257   /// DIMACS maximum flow reader function.
     261  /// \brief DIMACS maximum flow reader function.
    258262  ///
    259263  /// This function reads a maximum flow instance from DIMACS format,
     
    289293  }
    290294
    291   /// DIMACS shortest path reader function.
     295  /// \brief DIMACS shortest path reader function.
    292296  ///
    293297  /// This function reads a shortest path instance from DIMACS format,
     
    315319  }
    316320
    317   /// DIMACS capacitated digraph reader function.
     321  /// \brief DIMACS capacitated digraph reader function.
    318322  ///
    319323  /// This function reads an arc capacitated digraph instance from
     
    360364    g.addArc(s,t);
    361365  }
    362  
    363   /// DIMACS plain (di)graph reader function.
    364   ///
    365   /// This function reads a (di)graph without any designated nodes and
    366   /// maps from DIMACS format, i.e. from DIMACS files having a line
    367   /// starting with
     366
     367  /// \brief DIMACS plain (di)graph reader function.
     368  ///
     369  /// This function reads a plain (di)graph without any designated nodes
     370  /// and maps (e.g. a matching instance) from DIMACS format, i.e. from
     371  /// DIMACS files having a line starting with
    368372  /// \code
    369373  ///   p mat
     
    390394      nodes[k] = g.addNode();
    391395    }
    392    
     396
    393397    while (is >> c) {
    394398      switch (c) {
Note: See TracChangeset for help on using the changeset viewer.