How do i access graph property?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do i access graph property?

Jef Driesen
Suppose I have defined the following graph:

typedef boost::adjacency_list<
    boost::setS,      // Adjacency list
    boost::setS,      // Vertex list
    boost::undirectedS,   // Undirected graph
    unsigned int,      // Vertex property (unique label)
    boost::no_property,   // Edge property
    unsigned int,      // Graph property (next unique label)
    boost::listS      // Edge list
 > graph;

How do I access the graph property? For the vertex property this is a
very simple operation:

graph g = ...;
vertex_descriptor u = ...;
vertex_property label = g[u];

But I can't find a way to access property associated with my graph. How
can I do this?

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: How do i access graph property?

Doug Gregor
On Jan 31, 2006, at 6:37 AM, Jef Driesen wrote:

> Suppose I have defined the following graph:
>
> typedef boost::adjacency_list<
>     boost::setS,      // Adjacency list
>     boost::setS,      // Vertex list
>     boost::undirectedS,   // Undirected graph
>     unsigned int,      // Vertex property (unique label)
>     boost::no_property,   // Edge property
>     unsigned int,      // Graph property (next unique label)
>     boost::listS      // Edge list
>> graph;
>
> But I can't find a way to access property associated with my graph.  
> How
> can I do this?

This is an omission (bug) in the BGL. If you change your graph type  
to this:

typedef boost::adjacency_list<
     boost::setS,      // Adjacency list
     boost::setS,      // Vertex list
     boost::undirectedS,   // Undirected graph
     unsigned int,      // Vertex property (unique label)
     boost::no_property,   // Edge property
     boost::property<boost::graph_name_t, unsigned int>,      //  
Graph property (next unique label)
     boost::listS      // Edge list
   > graph;

You can get at the graph property with:

   get_property(graph_instance, boost::graph_name())

We'll find a better way to handle this in the next Boost release.

        Doug
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users