Boost logo

Boost Users :

From: Jeffrey Holle (jeff.holle_at_[hidden])
Date: 2004-11-08 15:17:28


I believe you need to use boost::make_label_writer.
Here is how I use it to place information from an external property map:

ofstream os("workFlow.dot");
write_graphviz(os,workFlowGraph_,make_label_writer(workFlowVertexLabeler(workFlowGraph_)));

Where workFlowVertexLabeler is:

struct workFlowVertexLabeler
{
   workFlowVertexLabeler(WorkFlowGraph& workFlowGraph) :
workFlowGraph_(workFlowGraph) {}
   std::string operator[](const WorkFlowVertex& v) const
   {
     return workFlowGraph_.getWorkFlowData()[v].getLabel();
   }
private:
   WorkFlowGraph& workFlowGraph_;

Stephen torri wrote:
> How does one write out the proper edge node names when the vertex data
> is a boost::shared_ptr? My graph is defined as:
>
> typedef property< vertex_index_t, uint32_t,
> property< vertex_name_t, boost::shared_ptr<Component> > >
> VertexProperty;
>
> typedef adjacency_list<setS, // OutEdgeList
> setS, // VertexList
> directedS, // Directed
> VertexProperty> // VertexProperties
> Graph_Type;
>
> The call in graphviz.hpp at line 269 has me confused. I understand that
> the node ids are printed out by looking for the value stored in the
> vertex_index_t property, graphviz.hpp at line 263. So if the value
> stored at the vertex_index_t property was the value '3' the node's name
> would be '3'. The edges are what have me confused. I would expect that
> the source id and the target it would be the value of the
> vertex_index_t property. So if there are two nodes the dot file would
> be:
>
> 0[label="A"];
> 1[label="B"];
> 0 -> 1;
>
> Yet with a boost::shared_ptr stored in a vertex_name_t property I get:
>
> 0[label="A"];
> 1[label="B"];
> 0x807a108->0x807a128;
>
> Well anything starting with a '0x' is ambigiuos to the dot parser. It
> breaks the 0x807a108 into two names.
>
> I need to use a boost::shared_ptr for my data. I believe I have not used
> the right boost::property type. Is that right?
>
> What I expect to see as output for the dot file is:
>
> 0[label="A"];
> 1[label="B"];
> 0->1;
>
> Stephen


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