demo/grid_graph_demo.cc
changeset 1680 4f8b9cee576b
child 1681 84e43c7ca1e3
equal deleted inserted replaced
-1:000000000000 0:17bd65983925
       
     1 #include <lemon/grid_graph.h>
       
     2 #include <lemon/graph_adaptor.h>
       
     3 #include <lemon/graph_to_eps.h>
       
     4 #include <lemon/xy.h>
       
     5 
       
     6 #include <iostream>
       
     7 #include <fstream>
       
     8 
       
     9 using namespace lemon;
       
    10 using namespace std;
       
    11 
       
    12 int main() {
       
    13   GridGraph graph(5, 7);
       
    14   GridGraph::NodeMap<xy<double> > coord(graph);
       
    15   for (int i = 0; i < graph.width(); ++i) {
       
    16     for (int j = 0; j < graph.height(); ++j) {
       
    17       coord[graph(i, j)] = xy<double>(i * 10.0, j * 10.0);
       
    18     }
       
    19   }
       
    20   graphToEps(graph, "grid_graph.eps").scaleToA4().
       
    21     title("Grid graph").
       
    22     copyright("(C) 2005 LEMON Project").
       
    23     coords(coord).
       
    24     enableParallel().
       
    25     nodeScale(.45).
       
    26     drawArrows().
       
    27     run();
       
    28   return 0;
       
    29 }