On 8/6/07, David Callu
Hi,
I try to write my graph to std::cout with boost::write_graphviz. In the example boost/libs/graph/example/graphviz.cpp, the graph used is a boost::adjacency_list
, property > and all work fine.
my graph is a
boost::adjacency_list
, property , property , listS > If a do "write_graphviz(std::cout, g);" I have a very big error. (why BGL didn't use boost concept check ???) I search in boost code and i found !!! In the file boost/graph/graphviz.hpp line 257 (boost 1.34) "out << get(vertex_id, *i);"
<snip>
In the complete signature function : void write_graphviz(std::ostream &, const VertexListGraph & g vertexPropertyWrite vpw, EdgePropertyWriter epw, GraphPropertyWriter gpw, VertexID vertex_id);
I can give the property_tag to used in the function. But, In opposition to other BGL algorithm which accept an external PropertyMap, this property must be in the graph. And I don't want to add a index property.
Question : How to use write_graphviz algorithm with boost::adjacency_list
? Is there a magic boost property tag to use with a boost::adjacency_list
like the boost::vertex_index_t tag and the boost::adjacency_list is there another solution ??
Hi David, write_graphviz takes a parameter "vertex_id", of type "VertexID", where VertexID is any type that models the readable property map concept. If you don't provide one, the algorithm looks for one by calling get(vertex_index, g) - which gets the interior vertex index. The vertex_id parameter is an actual property map - it's supposed to map each vertex in the graph to a distinct non-negative integer in the range [0,1,...,num_vertices(g)). If, as you say, you don't want to add an interior property to do this, you need to (1) create an exterior property map and pass it as the vertex_id parameter (see http://tinyurl.com/yhju58 for more information on how to do this) and (2) explicitly pass this vertex index map to the function, instead of allowing it to default to the interior index. Regards, Aaron