demo/reader_writer_demo.cc
changeset 1594 0bd9e53c8b28
parent 1534 b86aad11f842
child 1636 260ac104190f
equal deleted inserted replaced
2:5d1f8cfdcbb8 3:d893e024c386
       
     1 /* -*- C++ -*-
       
     2  * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
       
     3  *
       
     4  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
       
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
       
     6  *
       
     7  * Permission to use, modify and distribute this software is granted
       
     8  * provided that this copyright notice appears in all copies. For
       
     9  * precise terms see the accompanying LICENSE file.
       
    10  *
       
    11  * This software is provided "AS IS" with no warranty of any kind,
       
    12  * express or implied, and with no claim as to its suitability for any
       
    13  * purpose.
       
    14  *
       
    15  */
       
    16 
       
    17 ///\ingroup demos
       
    18 ///\file
       
    19 ///\brief Demonstrating graph input and output
       
    20 ///
       
    21 /// This simple demo program gives an example of how to read and write
       
    22 /// a graph and additional maps (on the nodes or the edges) from/to a
       
    23 /// stream. 
       
    24 
       
    25 
     1 #include <iostream>
    26 #include <iostream>
     2 #include <lemon/smart_graph.h>
    27 #include <lemon/smart_graph.h>
     3 #include <lemon/invalid.h>
    28 #include <lemon/invalid.h>
     4 #include <lemon/graph_reader.h>
    29 #include <lemon/graph_reader.h>
     5 #include <lemon/graph_writer.h>
    30 #include <lemon/graph_writer.h>
    16     SmartGraph::EdgeMap<int> cap(graph);
    41     SmartGraph::EdgeMap<int> cap(graph);
    17     reader.readEdgeMap("capacity",cap);
    42     reader.readEdgeMap("capacity",cap);
    18     reader.run();
    43     reader.run();
    19 
    44 
    20     std::cout << "Hello! We have read a graph from file " << filename<< 
    45     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!" << 
    46       " and some maps on it:\n now we write it to the standard output!" << 
    22       std::endl;
    47       std::endl;
    23 
    48 
    24 
    49 
    25     GraphWriter<SmartGraph> writer(std::cout, graph);
    50     GraphWriter<SmartGraph> writer(std::cout, graph);
    26     writer.writeEdgeMap("multiplicity", cap);
    51     writer.writeEdgeMap("multiplicity", cap);