Hi all: Is it possible to access the container type that represents the edge-list of a graph. That is, if a graph type is like so: typedef adjacency_list< vecS, vecS, bidirectionalS > graph_type; then, is it possible to do write something like this: typedef typename graph_type::EdgeListContainer EdgeListC; Ditto for the container type that represents the vertex set of a graph. Thanks very much, S
On Mar 17, 2005, at 6:58 PM, Sachin Ahuja wrote:
Hi all:
Is it possible to access the container type that represents the edge-list of a graph.
That is, if a graph type is like so: typedef adjacency_list< vecS, vecS, bidirectionalS > graph_type; then, is it possible to do write something like this: typedef typename graph_type::EdgeListContainer EdgeListC;
Ditto for the container type that represents the vertex set of a graph.
It is not possible to access this information in an adjacency_list right now, although we can easily add the typedefs. However, the element types of these containers are implementation details, so I'm not quite sure how much useful information you'll actually get from the typedefs. Doug
Douglas Gregor
writes: <snip> It is not possible to access this information in an adjacency_list right now, although we can easily add the typedefs. However, the element types of these containers are implementation details, so I'm not quite sure how much useful information you'll actually get from the typedefs. Doug
Here is a situation where typedefs for EdgeList etc can prove to be very useful. template < class graph_type > void foo( graph_type& g ) { // I would like to create another graph type which depends // on the value of the template parameter graph_type // e.g. typedef adjacency_list< graph_type::EdgeList, graph_type::VertexList, undirectedS > another_graph_type; // note that graph_type could have been directedS or bidirectionalS // but I would like to ignore that when creating another_graph_type another_graph_type ag; copy_graph( g, ag ); // and so we have an undirected version of the input graph - g } What do you think? S
On Mar 18, 2005, at 1:53 AM, S wrote:
Here is a situation where typedefs for EdgeList etc can prove to be very useful.
template < class graph_type > void foo( graph_type& g ) { // I would like to create another graph type which depends // on the value of the template parameter graph_type // e.g.
typedef adjacency_list< graph_type::EdgeList, graph_type::VertexList, undirectedS
another_graph_type; // note that graph_type could have been directedS or bidirectionalS // but I would like to ignore that when creating another_graph_type
another_graph_type ag; copy_graph( g, ag ); // and so we have an undirected version of the input graph - g }
To be really picky, since "graph_type" has to be an adjacency list
anyway, one possibility is to do this:
template
What do you think?
I had originally thought you wanted something different. I'm not at all opposed to providing these typedefs. I'm just about to check in changes that provide the typedefs out_edge_list_selector, vertex_list_selector, directed_selector, and edge_list_selector for the OutEdgeListS, VertexListS, DirectedS, and EdgeListS template parameters, respectively. Doug
Doug Gregor
I'm just about to check in changes that provide the typedefs out_edge_list_selector, vertex_list_selector, directed_selector, and edge_list_selector for the OutEdgeListS, VertexListS, DirectedS, and EdgeListS template parameters, respectively. <snip> Thanks, Doug.
participants (4)
-
Doug Gregor
-
Douglas Gregor
-
S
-
Sachin Ahuja