Using the LEMON C++ library and GraphToEps, I am trying to visualize a grid graph with accompanying edge (or arc) weights, without luck. Here's what I've got in my main() so far:
// Create graph and init maps
GridGraph g = GridGraph(5, 5);
GridGraph::NodeMap<Point> coords(g);
GridGraph::EdgeMap<int> weights(g, 1);
// Set positions of nodes for graphToEps use
for(GridGraph::NodeIt u(g); u != INVALID; ++u ) {
coords[u] = g.pos(u);
}
cout << "Create 'graph.eps'" << endl;
graphToEps(g,"graph.eps").
coords(coords).
title("Sample .eps figure").
run();
I can get node text (which I left out of the above code for simplicity) using graphToEps.nodeTexts(id)
, as shown in the graphToEps demo, but I can't find something like edgeTexts(weights(id))
or arcTexts(weights(id))
.
The output of the above code is shown below, and I would like the weights from the map weights
to be on top of the corresponding edges.
Any help is greatly appreciated.