demo/reader_writer_demo.cc
author athos
Fri, 22 Jul 2005 09:41:20 +0000
changeset 1580 a9e4208cf4e3
parent 1530 d99c3c84f797
child 1583 2b329fd595ef
permissions -rw-r--r--
Some changes to kruskal stuff.
     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 
     8 using namespace lemon;
     9 
    10 int 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 }