Vertex descriptors in adjacancy_list
Is there any guarantee that Vertex descriptors are some kind of integers? In the examples provided add_edge is called with integers as vertex descriptors. Does the choice of parameters for the adjacency_list graph make a difference on this issue? E.g. whether the we choose vecS or listS as VertexList? If future flexibility of the program being written is a factor (e.g. if we want it to be easy to change the definition of the graphs without necessarily changing other parts of the code) is it better to use add_vertex, followed by add_edge using the vertex descriptors returned by add_vertex? Regards, A. T.
Ali Tofigh wrote:
Is there any guarantee that Vertex descriptors are some kind of integers?
I don't think it's written anywhere, however if this is ever to change, I'm sure a lot of users will be upset, so it's not likely to change ;-)
In the examples provided add_edge is called with integers as vertex descriptors. Does the choice of parameters for the adjacency_list graph make a difference on this issue? E.g. whether the we choose vecS or listS as VertexList?
Yes. vertex_descriptor is integer only for vecS.
If future flexibility of the program being written is a factor (e.g. if we want it to be easy to change the definition of the graphs without necessarily changing other parts of the code) is it better to use add_vertex, followed by add_edge using the vertex descriptors returned by add_vertex?
Yes. It always better to use vertex_descriptor for any real code which is going to be used for arbitrary kind of graph. - Volodya
Hi, On Thu, 27 Nov 2003, Ali Tofigh wrote: alix> Is there any guarantee that Vertex descriptors are some kind of integers? In alix> the examples provided add_edge is called with integers as vertex descriptors. alix> Does the choice of parameters for the adjacency_list graph make a difference alix> on this issue? E.g. whether the we choose vecS or listS as VertexList? Yes it makes a difference. When VertexList=vecS the vertex descriptor is int. When VertexList=listS the vertex descriptor is void*. alix> If future flexibility of the program being written is a factor (e.g. alix> if we want it to be easy to change the definition of the graphs alix> without necessarily changing other parts of the code) is it better alix> to use add_vertex, followed by add_edge using the vertex descriptors alix> returned by add_vertex? Yes. Cheers, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 856-1820 ----------------------------------------------------------------------
On Monday 01 December 2003 14:56, Jeremy Siek wrote:
Yes it makes a difference. When VertexList=vecS the vertex descriptor is int. When VertexList=listS the vertex descriptor is void*.
But is this formally guaranteed, or is it just safe to assume for the time being? And thanks for answering! /A.T.
On Mon, 1 Dec 2003, Ali Tofigh wrote: alix> On Monday 01 December 2003 14:56, Jeremy Siek wrote: alix> > Yes it makes a difference. When VertexList=vecS the vertex descriptor is alix> > int. When VertexList=listS the vertex descriptor is void*. alix> alix> But is this formally guaranteed, or is it just safe to assume for the time alix> being? I couldn't find it in the docs, but I don't expect this to change. However, Vladimir is right in saying that it is better not to rely on this if you don't really need to. Cheers, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 856-1820 ----------------------------------------------------------------------
participants (3)
-
Ali Tofigh
-
Jeremy Siek
-
Vladimir Prus