demo/lgf_demo.cc
changeset 192 7bf5f97d574f
parent 164 00d297da491e
child 193 65cba1032f90
equal deleted inserted replaced
2:0561b94b3fc8 4:599c51dbb79e
    32 
    32 
    33 #include <iostream>
    33 #include <iostream>
    34 #include <lemon/smart_graph.h>
    34 #include <lemon/smart_graph.h>
    35 #include <lemon/lgf_reader.h>
    35 #include <lemon/lgf_reader.h>
    36 #include <lemon/lgf_writer.h>
    36 #include <lemon/lgf_writer.h>
    37 #include <lemon/random.h>
       
    38 
       
    39 
    37 
    40 using namespace lemon;
    38 using namespace lemon;
    41 
    39 
    42 int main() {
    40 int main() {
    43   SmartDigraph g;
    41   SmartDigraph g;
    44   SmartDigraph::ArcMap<int> cap(g);
    42   SmartDigraph::ArcMap<int> cap(g);
    45   SmartDigraph::Node s, t;
    43   SmartDigraph::Node s, t;
    46 
    44 
    47   digraphReader("digraph.lgf", g). // read the directeg graph into g
    45   digraphReader("digraph.lgf", g). // read the directed graph into g
    48     arcMap("capacity", cap).       // read the 'capacity' arc map into cap
    46     arcMap("capacity", cap).       // read the 'capacity' arc map into cap
    49     node("source", s).             // read 'source' node to s
    47     node("source", s).             // read 'source' node to s
    50     node("target", t).             // read 'target' node to t
    48     node("target", t).             // read 'target' node to t
    51     run();
    49     run();
    52 
    50 
    53   std::cout << "Digraph read from 'digraph.lgf'" << std::endl;
    51   std::cout << "A digraph is read from 'digraph.lgf'." << std::endl;
    54   std::cout << "Number of nodes: " << countNodes(g) << std::endl;
    52   std::cout << "Number of nodes: " << countNodes(g) << std::endl;
    55   std::cout << "Number of arcs: " << countArcs(g) << std::endl;
    53   std::cout << "Number of arcs: " << countArcs(g) << std::endl;
    56 
    54 
    57   std::cout << "We can write it to the standard output:" << std::endl;
    55   std::cout << "We can write it to the standard output:" << std::endl;
    58 
    56