Thanks for all the help so far. I'm not there yet, though! The documentation for add_edge() says that the first two parameters are of type boost::graph_traits<G>::vertex_descriptor. In the example in quick_tour.html it is called with integers (from an enum) as its first two parameters. Is that because: i. add_edge is overloaded to take integers as the first two parameters; ii. boost::graph_traits<G>::vertex_descriptor just happens to be an integer type in this case; iii. boost::graph_traits<G>::vertex_descriptor is /always/ an integer type; or iv. some other reason I haven't thought of. Thanks in advance.
On Friday 25 June 2004 4:52 pm, Tim Rowe wrote:
The documentation for add_edge() says that the first two parameters are of type boost::graph_traits<G>::vertex_descriptor. In the example in quick_tour.html it is called with integers (from an enum) as its first two parameters. Is that because:
i. add_edge is overloaded to take integers as the first two parameters;
Not this one; add_edge really does take vertex descriptors, only.
ii. boost::graph_traits<G>::vertex_descriptor just happens to be an integer type in this case;
Exactly. When the type of the vertex list for an adjacency list is "vecS", the descriptors are just integers. It tends to make many things much easier when this is the case! Doug
On Fri, 25 Jun 2004 16:53:51 -0500, Doug Gregor wrote:
On Friday 25 June 2004 4:52 pm, Tim Rowe wrote:
The documentation for add_edge() says that the first two parameters are of type boost::graph_traits<G>::vertex_descriptor. In the example in quick_tour.html it is called with integers (from an enum) as its first two parameters. Is that because:
i. add_edge is overloaded to take integers as the first two parameters;
Not this one; add_edge really does take vertex descriptors, only.
ii. boost::graph_traits<G>::vertex_descriptor just happens to be an integer type in this case;
Exactly. When the type of the vertex list for an adjacency list is "vecS", the descriptors are just integers. It tends to make many things much easier when this is the case!
Thanks -- is that documented? I couldn't find it. And what about when the type of the vertex list is something else -- is the type of boost::graph_traits<G>::vertex_descriptor available to the user for anything more than declaring variables to identify vertices?
On Jun 26, 2004, at 5:33 AM, Tim Rowe wrote:
On Fri, 25 Jun 2004 16:53:51 -0500, Doug Gregor wrote:
Exactly. When the type of the vertex list for an adjacency list is "vecS", the descriptors are just integers. It tends to make many things much easier when this is the case!
Thanks -- is that documented? I couldn't find it.
*Technically* yes, it's documented, as in "you could find something in the docs that says that this is the case." Granted, it's an aside in the description of add_edge for an adjacency_list: "VertexList selector is vecS, and if either vertex descriptor u or v (which are integers) has a value greater than the current number of vertices in the graph, the graph is enlarged so that the number of vertices is std::max(u,v) + 1." I'm going to add a more obvious description into the documentation for our upcoming release. Thanks for pointing out how confusing this was!
And what about when the type of the vertex list is something else -- is the type of boost::graph_traits<G>::vertex_descriptor available to the user for anything more than declaring variables to identify vertices?
Nope, that's it: a vertex descriptor just describes a particular vertex when coupled with an appropriate graph. Doug
participants (2)
-
Doug Gregor
-
Tim Rowe