Re: [Boost-users] [Graph] Questions and remarks
On Sun, Apr 6, 2014 4:14 AM PDT Albert Yiamakis wrote:
Hello,
Some questions and remarks regarding Boost.Graph:
i) Why does write_graphviz require a VertexEdgeListGraph? I was unable to invoke it on an adjacency_list using sets as containers for vertices and edges; instead I had to switch to vectors. However, the function is meant to output - does the efficiency of the traversal really matter?
The issue is more likely to be a missing vertex index map than that concept constraint. Graphs with setS as vertex container do not have that by default, and I believe the graphviz writer needs that. You can look online for how to create that map.
ii) Would it be possible to mutate the graph in the visitors of an algorithm? For instance, generating the graph during a breadth-first search, by adding vertices and edges. Presumably, it would be the user's responsibility to color the vertices appropriately. (Interestingly, visitors take a non-const reference to the graph - but compilation failed at some other point).
That would almost always be dangerous because of iterator and descriptor invalidation. The loop variables, current source vertex, etc. would often become invalid (and thus invalid to use) because of the structural modifications.
iii) The documentation of the distance_recorder states that
"A WritablePropertyMap where the key type and the value type are the vertex descriptor type of the graph."
which has to be a mistake. It seems this has already been pointed out in the past (http://boost.2283326.n4.nabble.com/BGL-distance-recorder-td2571349.html)
but is yet to be corrected.
Yes, that does appear to be a bug. -- Jeremiah Willcock
participants (1)
-
Jeremiah Willcock