Boost logo

Boost Users :

From: David Callu (ledocc_at_[hidden])
Date: 2007-08-06 14:04:29


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<vecS, vecS, directedS,
                                          property<vertex_name_t,
std::string>,
                                          property<edge_weight_t, double> >

    and all work fine.

    my graph is a

          boost::adjacency_list<listS, listS, bidirectedS,
                                          property<my_vertex_t, my_vertex>,
                                          property<my_edge_t, my_edge>,
                                          property<my_graph_t, my_graph> ,
                                          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);"

    so write_graphviz function get the vertex property with the tag of type
vertex_id.

    By default, the type vertex_id is the enum boost::vertex_index
     which do reference to the type boost::vertex_index_t;

   This property is intrinsically in the type boost::adjacency_list<vecS,
vecS>
     because the vertex_descriptor is the index of the vertex. And so all
work fine with
     the function write_graphviz

   With the type boost::adjacency_list<vecS, listS>, this property is not
available. TOOOOOO

   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<listS,
listS> ?

      Is there a magic boost property tag to use with a
boost::adjacency_list<listS, listS>
      like the boost::vertex_index_t tag and the boost::adjacency_list<vecS,
vecS>

      is there another solution ??

Thank
David Callu



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net