COIN-OR::LEMON - Graph Library

source: lemon-0.x/demo/reader_writer_demo.cc @ 1571:68ce4302fb0b

Last change on this file since 1571:68ce4302fb0b was 1534:b86aad11f842, checked in by athos, 14 years ago

Doc.

File size: 794 bytes
Line 
1#include <iostream>
2#include <lemon/smart_graph.h>
3#include <lemon/invalid.h>
4#include <lemon/graph_reader.h>
5#include <lemon/graph_writer.h>
6
7
8using namespace lemon;
9
10int main() {
11  SmartGraph graph;
12
13  try {
14    std::string filename="sample.lgf";
15    GraphReader<SmartGraph> reader(filename,graph);
16    SmartGraph::EdgeMap<int> cap(graph);
17    reader.readEdgeMap("capacity",cap);
18    reader.run();
19
20    std::cout << "Hello! We have read a graph from file " << filename<<
21      " and some maps on it: now we write this to the standard output!" <<
22      std::endl;
23
24
25    GraphWriter<SmartGraph> writer(std::cout, graph);
26    writer.writeEdgeMap("multiplicity", cap);
27    writer.run();
28     
29  } catch (DataFormatError& error) {
30    std::cerr << error.what() << std::endl;
31  }
32
33
34  return 0;
35}
Note: See TracBrowser for help on using the repository browser.