COIN-OR::LEMON - Graph Library

source: lemon-0.x/demo/grid_graph_demo.cc @ 1680:4f8b9cee576b

Last change on this file since 1680:4f8b9cee576b was 1680:4f8b9cee576b, checked in by Balazs Dezso, 15 years ago

Fixing and improving GridGraph?

File size: 670 bytes
Line 
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
9using namespace lemon;
10using namespace std;
11
12int 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}
Note: See TracBrowser for help on using the repository browser.