demo/lgf_demo.cc
changeset 293 47fbc814aa31
parent 209 765619b7cbb2
child 294 cbe3ec2d59d2
equal deleted inserted replaced
6:fab0a5144c36 8:568a552ed6a3
    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(g, "digraph.lgf"). // 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
    51       run();
    51       run();
    52   } catch (DataFormatError& error) { // check if there was any error
    52   } catch (DataFormatError& error) { // check if there was any error
    58   std::cout << "Number of nodes: " << countNodes(g) << std::endl;
    58   std::cout << "Number of nodes: " << countNodes(g) << std::endl;
    59   std::cout << "Number of arcs: " << countArcs(g) << std::endl;
    59   std::cout << "Number of arcs: " << countArcs(g) << std::endl;
    60 
    60 
    61   std::cout << "We can write it to the standard output:" << std::endl;
    61   std::cout << "We can write it to the standard output:" << std::endl;
    62 
    62 
    63   digraphWriter(std::cout, g).     // write g to the standard output
    63   digraphWriter(g).                // write g to the standard output
    64     arcMap("capacity", cap).       // write cap into 'capacity'
    64     arcMap("capacity", cap).       // write cap into 'capacity'
    65     node("source", s).             // write s to 'source'
    65     node("source", s).             // write s to 'source'
    66     node("target", t).             // write t to 'target'
    66     node("target", t).             // write t to 'target'
    67     run();
    67     run();
    68 
    68