COIN-OR::LEMON - Graph Library

Ignore:
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r565 r574  
    4040ADD_SUBDIRECTORY(lemon)
    4141ADD_SUBDIRECTORY(demo)
     42ADD_SUBDIRECTORY(tools)
    4243ADD_SUBDIRECTORY(doc)
    4344ADD_SUBDIRECTORY(test)
     
    5758    "${PROJECT_NAME} ${PROJECT_VERSION}")
    5859
    59   SET(CPACK_COMPONENTS_ALL headers library html_documentation)
     60  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
    6061
    6162  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
    6263  SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
     64  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
    6365  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
    6466
     
    6769  SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
    6870    "DLL and import library")
     71  SET(CPACK_COMPONENT_BIN_DESCRIPTION
     72    "Command line utilities")
    6973  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
    7074    "Doxygen generated documentation")
  • lemon/Makefile.am

    r569 r575  
    8484        lemon/math.h \
    8585        lemon/max_matching.h \
     86        lemon/min_cost_arborescence.h \
    8687        lemon/nauty_reader.h \
    8788        lemon/path.h \
  • lemon/dimacs.h

    r463 r572  
    296296  }
    297297
    298   /// DIMACS plain digraph reader function.
    299   ///
    300   /// This function reads a digraph without any designated nodes and
     298  template<typename Graph>
     299  typename enable_if<lemon::UndirectedTagIndicator<Graph>,void>::type
     300  _addArcEdge(Graph &g, typename Graph::Node s, typename Graph::Node t,
     301              dummy<0> = 0)
     302  {
     303    g.addEdge(s,t);
     304  }
     305  template<typename Graph>
     306  typename disable_if<lemon::UndirectedTagIndicator<Graph>,void>::type
     307  _addArcEdge(Graph &g, typename Graph::Node s, typename Graph::Node t,
     308              dummy<1> = 1)
     309  {
     310    g.addArc(s,t);
     311  }
     312 
     313  /// DIMACS plain (di)graph reader function.
     314  ///
     315  /// This function reads a (di)graph without any designated nodes and
    301316  /// maps from DIMACS format, i.e. from DIMACS files having a line
    302317  /// starting with
     
    308323  /// If the file type was previously evaluated by dimacsType(), then
    309324  /// the descriptor struct should be given by the \c dest parameter.
    310   template<typename Digraph>
    311   void readDimacsMat(std::istream& is, Digraph &g,
    312                      DimacsDescriptor desc=DimacsDescriptor()) {
    313     typename Digraph::Node u,v;
    314     NullMap<typename Digraph::Arc, int> n;
     325  template<typename Graph>
     326  void readDimacsMat(std::istream& is, Graph &g,
     327                     DimacsDescriptor desc=DimacsDescriptor())
     328  {
    315329    if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is);
    316330    if(desc.type!=DimacsDescriptor::MAT)
    317331      throw FormatError("Problem type mismatch");
    318     _readDimacs(is, g, n, u, v, desc);
     332
     333    g.clear();
     334    std::vector<typename Graph::Node> nodes;
     335    char c;
     336    int i, j;
     337    std::string str;
     338    nodes.resize(desc.nodeNum + 1);
     339    for (int k = 1; k <= desc.nodeNum; ++k) {
     340      nodes[k] = g.addNode();
     341    }
     342   
     343    while (is >> c) {
     344      switch (c) {
     345      case 'c': // comment line
     346        getline(is, str);
     347        break;
     348      case 'n': // node definition line
     349        break;
     350      case 'a': // arc (arc) definition line
     351        is >> i >> j;
     352        getline(is, str);
     353        _addArcEdge(g,nodes[i], nodes[j]);
     354        break;
     355      }
     356    }
    319357  }
    320358
  • test/CMakeLists.txt

    r569 r575  
    3030  maps_test
    3131  max_matching_test
     32  min_cost_arborescence_test
    3233  path_test
    3334  preflow_test
  • test/Makefile.am

    r569 r575  
    2626        test/maps_test \
    2727        test/max_matching_test \
     28        test/min_cost_arborescence_test \
    2829        test/path_test \
    2930        test/preflow_test \
     
    6768test_mip_test_SOURCES = test/mip_test.cc
    6869test_max_matching_test_SOURCES = test/max_matching_test.cc
     70test_min_cost_arborescence_test_SOURCES = test/min_cost_arborescence_test.cc
    6971test_path_test_SOURCES = test/path_test.cc
    7072test_preflow_test_SOURCES = test/preflow_test.cc
  • tools/Makefile.am

    r570 r573  
    22
    33bin_PROGRAMS += \
     4        tools/dimacs-solver \
    45        tools/dimacs-to-lgf \
    56        tools/lgf-gen
     
    910endif WANT_TOOLS
    1011
     12tools_dimacs_solver_SOURCES = tools/dimacs-solver.cc
    1113tools_dimacs_to_lgf_SOURCES = tools/dimacs-to-lgf.cc
    1214tools_lgf_gen_SOURCES = tools/lgf-gen.cc
Note: See TracChangeset for help on using the changeset viewer.