demo/lgf_demo.cc
changeset 281 e9b4fbe163f5
parent 193 65cba1032f90
child 290 f6899946c1ac
child 293 47fbc814aa31
equal deleted inserted replaced
5:fd6dfbad5773 6:fab0a5144c36
     1 /* -*- C++ -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2008
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
    19 ///\ingroup demos
    19 ///\ingroup demos
    20 ///\file
    20 ///\file
    21 ///\brief Demonstrating graph input and output
    21 ///\brief Demonstrating graph input and output
    22 ///
    22 ///
    23 /// This program gives an example of how to read and write a digraph
    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 
    24 /// and additional maps from/to a stream or a file using the
    25 /// \ref lgf-format "LGF" format.
    25 /// \ref lgf-format "LGF" format.
    26 ///
    26 ///
    27 /// The \c "digraph.lgf" file:
    27 /// The \c "digraph.lgf" file:
    28 /// \include digraph.lgf
    28 /// \include digraph.lgf
    29 ///
    29 ///
    40 
    40 
    41 int main() {
    41 int main() {
    42   SmartDigraph g;
    42   SmartDigraph g;
    43   SmartDigraph::ArcMap<int> cap(g);
    43   SmartDigraph::ArcMap<int> cap(g);
    44   SmartDigraph::Node s, t;
    44   SmartDigraph::Node s, t;
    45   
    45 
    46   try {
    46   try {
    47     digraphReader("digraph.lgf", g). // read the directed graph into g
    47     digraphReader("digraph.lgf", g). // read the directed graph into g
    48       arcMap("capacity", cap).       // read the 'capacity' arc map into cap
    48       arcMap("capacity", cap).       // read the 'capacity' arc map into cap
    49       node("source", s).             // read 'source' node to s
    49       node("source", s).             // read 'source' node to s
    50       node("target", t).             // read 'target' node to t
    50       node("target", t).             // read 'target' node to t