
All, First, I'm very new to boost and BGL, so please forgive me if this is trivial. I've created a graph (adjacency_list) using bundled properties and am now trying to write it as a dot file. I've written my property writer, but when I compile, I get several of: /usr/include/boost/graph/graphviz.hpp: In function `void boost::write_graphviz(std::ostream&, const Graph&, VertexPropertiesWriter, EdgePropertiesWriter, GraphPropertiesWriter, VertexID) [with Graph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, VertexPropertiesWriter = map::placeWriter, EdgePropertiesWriter = boost::default_writer, GraphPropertiesWriter = boost::default_writer, VertexID = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>]': /usr/include/boost/graph/graphviz.hpp:260: instantiated from `void boost::write_graphviz(std::ostream&, const Graph&, VertexPropertiesWriter, EdgePropertiesWriter, GraphPropertiesWriter) [with Graph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, VertexPropertiesWriter = map::placeWriter, EdgePropertiesWriter = boost::default_writer, GraphPropertiesWriter = boost::default_writer]' /usr/include/boost/graph/graphviz.hpp:278: instantiated from `void boost::write_graphviz(std::ostream&, const Graph&, VertexWriter) [with Graph = map::mapType, VertexWriter = map::placeWriter]' topologicalMap.h:282: instantiated from here /usr/include/boost/graph/graphviz.hpp:241: error: no match for 'operator<<' in 'out << boost::get [with PropertyMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>, Reference = const boost::detail::error_property_not_found&, K = void*](((const boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >&)((const boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*) ((boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, map::place, map::link, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*) (&vertex_id)))), ((void* const&)((void* const*) (+(&i)->std::_List_iterator<_Tp>::operator* [with _Tp = void*]()))))' /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.5/include/g++-v3/bits/ostream.tcc:63: note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>] Not being very good at deciphering all that, I'm not sure what is happening. I do understand that it's missing an extraction operator but I'm not sure on what. The actual line in graphviz.hpp is: out << get(vertex_id, *i); Two questions: - Could somebody tell me exactly what that get returns? - From the dot format, this should be the name of the vertex in the dot file. So this seems to relate to the class used as a property. My second question is then: If this is the case, why then do we need the property writer since we apparently also need the operator<< that could do exactly the same thing? (And isn't a ' ' (space) missing between the vertex name and whatever the property writer writes (or should that be included in it, which is not mentioned by the documentation)? That was 3 questions then ;-) Thanks in advance for any replies. Cheers, Fred

On 4/19/06, Fred Labrosse <ffl@aber.ac.uk> wrote:
All,
First, I'm very new to boost and BGL, so please forgive me if this is trivial.
I've created a graph (adjacency_list) using bundled properties and am now trying to write it as a dot file. I've written my property writer, but when I compile, I get several of:
/usr/include/boost/graph/graphviz.hpp: In function `void [snip] Not being very good at deciphering all that, I'm not sure what is happening. I do understand that it's missing an extraction operator but I'm not sure on what. The actual line in graphviz.hpp is:
out << get(vertex_id, *i);
Two questions:
- Could somebody tell me exactly what that get returns?
get returns the value from vertex_descriptor *i in the property map vertex_id In your code, your adjacency_list uses listS so this vertex_id property is not define! That's the problem. When you call write_graphviz, specify a property map to get an index from a vertex_descriptor (follow the example with write_graphviz and dynamic properties)
- From the dot format, this should be the name of the vertex in the dot file. So this seems to relate to the class used as a property. My second question is then: If this is the case, why then do we need the property writer since we apparently also need the operator<< that could do exactly the same thing? (And isn't a ' ' (space) missing between the vertex name and whatever the property writer writes (or should that be included in it, which is not mentioned by the documentation)? That was 3 questions then ;-)
I don't understand your second question, neither question 3... I think it relates to your first question.
Thanks in advance for any replies.
Cheers,
Regards, -- Johan

On Wednesday 19 Apr 2006 16:46, Johan Oudinet wrote:
On 4/19/06, Fred Labrosse <ffl@aber.ac.uk> wrote:
All,
First, I'm very new to boost and BGL, so please forgive me if this is trivial.
I've created a graph (adjacency_list) using bundled properties and am now trying to write it as a dot file. I've written my property writer, but when I compile, I get several of:
/usr/include/boost/graph/graphviz.hpp: In function `void [snip] Not being very good at deciphering all that, I'm not sure what is happening. I do understand that it's missing an extraction operator but I'm not sure on what. The actual line in graphviz.hpp is:
out << get(vertex_id, *i);
Two questions:
- Could somebody tell me exactly what that get returns?
get returns the value from vertex_descriptor *i in the property map vertex_id
In your code, your adjacency_list uses listS so this vertex_id property is not define! That's the problem.
When you call write_graphviz, specify a property map to get an index from a vertex_descriptor (follow the example with write_graphviz and dynamic properties)
Many thanks for replying. However, I'm not sure how to do that. Here are the relevant bits of my code (sorry for the length): class place { public: place(const imalib::imageD3* anAppearance, const std::string& aName, unsigned short aNumber) : appearance(anAppearance), name(aName), number(aNumber) { } ~place(); const imalib::imageD3* getAppearance() const { return(appearance); } const std::string& getName() const { return(name); } unsigned short getNumber() const { return(number); } private: const imalib::imageD3* appearance; std::string name; unsigned short number; }; class placeWriter { public: placeWriter(const mapType& g) : g(g) {} void operator()(std::ostream& out, const mapType::vertex_descriptor& v) const { static imalib::imageRGB anImage; out << "[label=\"" << g[v].getNumber() << "\",shapefile=\"" << g[v].getName() << "\"];\n"; g[v].getAppearance()->toRGB(&anImage); anImage.write(g[v].getName()); } private: const mapType& g; }; typedef boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, place, link> mapType; mapType theMap; std::ofstream of(filename.c_str()); placeWriter pw(theMap); write_graphviz(of, theMap, pw); Should that be something like: default_writer dw; default_writer gw; write_graphviz(of, theMap, pw, dw, gw, get(&place.getNumber(), theMap)); ??? This was actually taken from an example on bundled properties. Cheers, Fred

class place { public: place(const imalib::imageD3* anAppearance, const std::string& aName, unsigned short aNumber) : appearance(anAppearance), name(aName), number(aNumber) { } ~place(); const imalib::imageD3* getAppearance() const { return(appearance); } const std::string& getName() const { return(name); } unsigned short getNumber() const { return(number); } private: const imalib::imageD3* appearance; std::string name;
On 4/19/06, Fred Labrosse <ffl@aber.ac.uk> wrote: public:
unsigned short number; };
[snip] Should that be something like:
default_writer dw; default_writer gw; write_graphviz(of, theMap, pw, dw, gw, get(&place.getNumber(), theMap));
No, you're get parameter is wrong, try this : write_graphviz (of, theMap, pw, dw, gw, get (&place::number, theMap));
??? This was actually taken from an example on bundled properties.
Cheers,
-- Johan

On Wednesday 19 Apr 2006 21:26, Johan Oudinet wrote:
Should that be something like:
default_writer dw; default_writer gw; write_graphviz(of, theMap, pw, dw, gw, get(&place.getNumber(), theMap));
No, you're get parameter is wrong, try this : write_graphviz (of, theMap, pw, dw, gw, get (&place::number, theMap));
Yes, I gathered that last night when I tried it. This also means that I need to have public attributes instead of get functions... :-( Thanks anyway. Fred
participants (2)
-
Fred Labrosse
-
Johan Oudinet