demo/dim_to_lgf.cc
changeset 1744 51d5d41e15b1
parent 1641 77f6ab7ad66f
child 1794 79397d64f742
     1.1 --- a/demo/dim_to_lgf.cc	Wed Oct 26 10:59:51 2005 +0000
     1.2 +++ b/demo/dim_to_lgf.cc	Wed Oct 26 11:09:29 2005 +0000
     1.3 @@ -161,28 +161,42 @@
     1.4      Node s, t;
     1.5      StringMap cost(graph), capacity(graph);
     1.6      readDimacs(is, graph, capacity, s, t, cost);
     1.7 -    writeGraph(os, graph, capacity, s, t, cost);
     1.8 +    GraphWriter<Graph>(os, graph).
     1.9 +      writeEdgeMap("capacity", capacity).
    1.10 +      writeNode("source", s).
    1.11 +      writeNode("target", t).
    1.12 +      writeEdgeMap("cost", cost).
    1.13 +      run();
    1.14    } else if (typeName == "maxflow") {
    1.15      Graph graph;
    1.16      Node s, t;
    1.17      StringMap capacity(graph);
    1.18      readDimacs(is, graph, capacity, s, t);
    1.19 -    writeGraph(os, graph, capacity, s, t);
    1.20 +    GraphWriter<Graph>(os, graph).
    1.21 +      writeEdgeMap("capacity", capacity).
    1.22 +      writeNode("source", s).
    1.23 +      writeNode("target", t).
    1.24 +      run();
    1.25    } else if (typeName == "shortestpath") {
    1.26      Graph graph;
    1.27      Node s;
    1.28      StringMap capacity(graph);
    1.29      readDimacs(is, graph, capacity, s);
    1.30 -    writeGraph(os, graph, capacity, s);
    1.31 +    GraphWriter<Graph>(os, graph).
    1.32 +      writeEdgeMap("capacity", capacity).
    1.33 +      writeNode("source", s).
    1.34 +      run();
    1.35    } else if (typeName == "capacitated") {
    1.36      Graph graph;
    1.37      StringMap capacity(graph);
    1.38      readDimacs(is, graph, capacity);
    1.39 -    writeGraph(os, graph, capacity);
    1.40 +    GraphWriter<Graph>(os, graph).
    1.41 +      writeEdgeMap("capacity", capacity).
    1.42 +      run();
    1.43    } else if (typeName == "plain") {
    1.44      Graph graph;
    1.45      readDimacs(is, graph);
    1.46 -    writeGraph(os, graph);
    1.47 +    GraphWriter<Graph>(os, graph).run();
    1.48    } else {
    1.49      cerr << "Invalid type error" << endl;
    1.50      return -1;