Boost logo

Boost Users :

From: Meredith L. Patterson (mlp_at_[hidden])
Date: 2004-11-08 21:28:50


Stephen torri wrote:
> The problem with the edge labelling still remains. I see a problem with the
> loop in graphviz.hpp that prints out the edges:
>
> typename graph_traits<Graph>::edge_iterator ei, edge_end;
> for(tie(ei, edge_end) = edges(g); ei != edge_end; ++ei) {
> out << source(*ei, g) << Traits::delimiter() << target(*ei, g) <<
> " ";
> epw(out, *ei); //print edge attributes
> out << ";" << std::endl;
> }
>
> There is no operator<< function for graph_traits so the memory location
> of the vertex_descriptor that is returned is printed instead of the
> vertex_index_t value used to name the nodes above.

I ran into this exact same problem a few days ago, and posted about it
(even referring to the same code snippet you did), but received no
response. I eventually ended up modifying the loop in graphviz.hpp,
replacing

  out << source(*ei, g) << Traits::delimiter() << target(*ei, g)) << " ";

with

  out << get(vertex_index, source(*ei, g)) << Traits::delimiter() <<
      \
      get(vertex_index, target(*ei, g)) << " ";

Let's hear it for the BSD license.

Cheers,
Meredith L. Patterson


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