COIN-OR::LEMON - Graph Library

Changeset 193:65cba1032f90 in lemon for demo


Ignore:
Timestamp:
07/06/08 08:49:03 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
194:74cd0c58b348, 195:aa45ff44fcf3, 197:5893bacaa720
Parents:
192:7bf5f97d574f (diff), 191:abc5b9d0c67e (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • demo/lgf_demo.cc

    r192 r193  
    2121///\brief Demonstrating graph input and output
    2222///
    23 /// This program gives an example of how to load a directed graph from
    24 /// an \ref lgf-format "LGF" file with the \ref lemon::DigraphReader
    25 /// "DigraphReader" class.
     23/// This program gives an example of how to read and write a digraph
     24/// and additional maps from/to a stream or a file using the
     25/// \ref lgf-format "LGF" format.
    2626///
    2727/// The \c "digraph.lgf" file:
    2828/// \include digraph.lgf
    2929///
    30 /// And the program which reads it:
     30/// And the program which reads it and prints the digraph to the
     31/// standard output:
    3132/// \include lgf_demo.cc
    3233
     
    4243  SmartDigraph::ArcMap<int> cap(g);
    4344  SmartDigraph::Node s, t;
    44 
    45   digraphReader("digraph.lgf", g). // read the directed graph into g
    46     arcMap("capacity", cap).       // read the 'capacity' arc map into cap
    47     node("source", s).             // read 'source' node to s
    48     node("target", t).             // read 'target' node to t
    49     run();
     45 
     46  try {
     47    digraphReader("digraph.lgf", g). // read the directed graph into g
     48      arcMap("capacity", cap).       // read the 'capacity' arc map into cap
     49      node("source", s).             // read 'source' node to s
     50      node("target", t).             // read 'target' node to t
     51      run();
     52  } catch (DataFormatError& error) { // check if there was any error
     53    std::cerr << "Error: " << error.what() << std::endl;
     54    return -1;
     55  }
    5056
    5157  std::cout << "A digraph is read from 'digraph.lgf'." << std::endl;
Note: See TracChangeset for help on using the changeset viewer.