I am struggling to get a custom property writer to work with BGL.
struct IkGraph_VertexProperty {
int id_ ;
int type_ ;
std::pair<int,int> gaussians_ ; // Type of Joint, Ids of Gaussians
};
struct IkGraph_VertexPropertyTag
{
typedef edge_property_tag kind;
static std::size_t const num;
};
std::size_t const IkGraph_VertexPropertyTag::num = (std::size_t)&IkGraph_VertexPropertyTag::num;
typedef property<IkGraph_VertexPropertyTag, IkGraph_VertexProperty> vertex_info_type;
...custom graph defined in method
typedef adjacency_list<setS, vecS, bidirectionalS, vertex_info_type, IkGraph_EdgeProperty> TGraph ;
TGraph testGraph ;
std::ofstream outStr(filename) ;
write_graphviz(outStr, testGraph, OurVertexPropertyWriter<TGraph,IkGraph_VertexPropertyTag, IkGraph_VertexProperty>(testGraph));
...
template <class Graph, class VertexPropertyTag, class VertexProperty>
struct OurVertexPropertyWriter {
OurVertexPropertyWriter(Graph &g_) : g(g_) {}
template <class Vertex>
void operator() (std::ostream &out, Vertex v) {
VertexProperty p = get (VertexPropertyTag(), g, v);
out << "[label=" << p.gaussians_.first << "]";
}
Graph &g;
};
This produces a stream of errors.
What I would really like to do (and no idea if this is possible) is to be able to generalize this and be pass which custom properties exist / which I would like outputting.