demo/grid_graph_demo.cc
changeset 1693 269f0cbfbcc8
parent 1681 84e43c7ca1e3
child 1763 49045f2d28d4
     1.1 --- a/demo/grid_graph_demo.cc	Fri Sep 30 13:13:42 2005 +0000
     1.2 +++ b/demo/grid_graph_demo.cc	Fri Sep 30 13:15:28 2005 +0000
     1.3 @@ -41,28 +41,21 @@
     1.4    std::cout << "The length of shortest path: " << 
     1.5      bfs.run(start, stop) << std::endl;
     1.6  
     1.7 -  GridGraph::NodeMap<xy<double> > coord(graph);
     1.8 -  for (int i = 0; i < graph.width(); ++i) {
     1.9 -    for (int j = 0; j < graph.height(); ++j) {
    1.10 -      coord[graph(i, j)] = xy<double>( i * 10.0, j * 10.0);
    1.11 -    }
    1.12 -  }
    1.13 -  
    1.14 -  FilteredGraph::EdgeMap<Color> color(filtered, Color(0.0, 0.0, 0.0));
    1.15 +  FilteredGraph::EdgeMap<bool> path(filtered, false);
    1.16    
    1.17    for (GridGraph::Node node = stop; 
    1.18         node != start; node = bfs.predNode(node)) {
    1.19 -    color[bfs.pred(node)] = Color(1.0, 0.0, 0.0);
    1.20 +    path[bfs.pred(node)] = true;
    1.21    }
    1.22    
    1.23    graphToEps(filtered, "grid_graph.eps").scaleToA4().
    1.24      title("Grid graph").
    1.25      copyright("(C) 2005 LEMON Project").
    1.26 -    coords(coord).
    1.27 +    coords(scaleMap(indexMap(graph), 10)).
    1.28      enableParallel().
    1.29 -    nodeScale(.45).
    1.30 +    nodeScale(0.5).
    1.31      drawArrows().
    1.32 -    edgeColors(color).
    1.33 +    edgeColors(composeMap(ColorSet(), path)).
    1.34      run();
    1.35    
    1.36    std::cout << "The shortest path is written to grid_graph.eps" << std::endl;