COIN-OR::LEMON - Graph Library

Changeset 1067:54464584b157 in lemon


Ignore:
Timestamp:
08/02/11 18:13:34 (13 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
1068:e8afd887d706, 1069:b1b534ddb539, 1070:c8c8801db0a4, 1071:2d583da4ba40, 1072:3dcb45a871c3
Phase:
public
Message:

Allow lgf file without Arc maps (#382)

A single '-' character in the @arcs sectio header indicates that
there is no arc map.

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • doc/lgf.dox

    r313 r1067  
    6464\endcode
    6565
    66 The \c \@arcs section is very similar to the \c \@nodes section,
    67 it again starts with a header line describing the names of the maps,
    68 but the \c "label" map is not obligatory here. The following lines
    69 describe the arcs. The first two tokens of each line are
    70 the source and the target node of the arc, respectively, then come the map
     66The \c \@arcs section is very similar to the \c \@nodes section, it
     67again starts with a header line describing the names of the maps, but
     68the \c "label" map is not obligatory here. The following lines
     69describe the arcs. The first two tokens of each line are the source
     70and the target node of the arc, respectively, then come the map
    7171values. The source and target tokens must be node labels.
    7272
     
    7979\endcode
    8080
     81If there is no map in the \c \@arcs section at all, then it must be
     82indicated by a sole '-' sign in the first line.
     83
     84\code
     85 @arcs
     86         -
     87 1   2
     88 1   3
     89 2   3
     90\endcode
     91
    8192The \c \@edges is just a synonym of \c \@arcs. The \@arcs section can
    8293also store the edge set of an undirected graph. In such case there is
    8394a conventional method for store arc maps in the file, if two columns
    84 has the same caption with \c '+' and \c '-' prefix, then these columns
     95have the same caption with \c '+' and \c '-' prefix, then these columns
    8596can be regarded as the values of an arc map.
    8697
  • lemon/lgf_reader.h

    r517 r1067  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2011
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    964964        int index = 0;
    965965        while (_reader_bits::readToken(line, map)) {
     966          if(map == "-") {
     967              if(index!=0)
     968                throw FormatError("'-' is not allowed as a map name");
     969              else if (line >> std::ws >> c)
     970                throw FormatError("Extra character at the end of line");
     971              else break;
     972            }
    966973          if (maps.find(map) != maps.end()) {
    967974            std::ostringstream msg;
     
    18041811        int index = 0;
    18051812        while (_reader_bits::readToken(line, map)) {
     1813          if(map == "-") {
     1814              if(index!=0)
     1815                throw FormatError("'-' is not allowed as a map name");
     1816              else if (line >> std::ws >> c)
     1817                throw FormatError("Extra character at the end of line");
     1818              else break;
     1819            }
    18061820          if (maps.find(map) != maps.end()) {
    18071821            std::ostringstream msg;
  • test/CMakeLists.txt

    r539 r1067  
    1919  heap_test
    2020  kruskal_test
     21  lgf_test
    2122  maps_test
    2223  random_test
  • test/Makefile.am

    r228 r1067  
    1919        test/heap_test \
    2020        test/kruskal_test \
     21        test/lgf_test \
    2122        test/maps_test \
    2223        test/random_test \
     
    4243test_heap_test_SOURCES = test/heap_test.cc
    4344test_kruskal_test_SOURCES = test/kruskal_test.cc
     45test_lgf_test_SOURCES = test/lgf_test.cc
    4446test_maps_test_SOURCES = test/maps_test.cc
    4547test_path_test_SOURCES = test/path_test.cc
Note: See TracChangeset for help on using the changeset viewer.