Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-01-29 10:13:39


Jeremy Siek wrote:
> Hi Volodya,
>
> On Tue, 10 Dec 2002, Vladimir Prus wrote:
> ghost> Looking at BGL's MutablePropertyGraph docs I can't understand
> ghost> two things:
> ghost>
> ghost> ep is an object of type G::edge_property_type
> ghost>
> ghost> Is that really so? Why not graph_traits<G>::edge_property_type?
>
> Actually, I think it really should be edge_property<G>::type and
> vertex_property<G>::type.

OK.

> Also MutablePropertyGraph should be split into
> VertexMutablePropertyGraph and EdgeMutablePropertyGraph.

Oh.. I only now realized how to use ReabablePropertyGraph concept:

   function_requires< ReadablePropertyGraphConcept<G, edge, edge_weight_t> >();

Are you suggesting that this become

   function_requires< EdgePropertyGraphConcept<G, edge_weight_t> >();

and the same split done to PropertyGraphConcept and LvaluePropertyGraphConcept?

> The BGL book is
> more up-to-date than the online-docs, so I'd look there for the final
> story. If you see discrepencies between the online-docs and the book, feel
> free to update the html to match the book.

Alas, I don't have the book, so can't compare the two.

>
> ghost> Unfortunately, this description says nothing about that concept
> ghost> these types model. As the result, I don't know how can I
> ghost> use 'add_edge' and 'add_vertex' as defined in MutablePropertyGraph.
> ghost>
> ghost> Can it be clarified?
>
> Yes, that is a problem. We need some more concepts for this. If you're
> dealing with an adjacency_list you know that they are nested instances of
> the property class, but this doesn't help generic code.
>
> I'm not sure how this could be made generic... maybe if we hade a concept
> that covered what the property class does (BTW, a better name for the
> property class would be static_alist). Also, it would be good to have a
> notion of what copying these objects does.

I agree. The type basically is a structure, which fields are not named in a
regular C++ way, but are identified by type. A subscript operator can take the
"tag" type and return the value (or reference to it). Lookings at the code,
it seems like this is actually implemented.
BTW the following code does not compile for me at the moment. Is it correct?

     typedef adjacency_list<vecS, vecS, property<vertex_name_t, int,
                                    property<vertex_distance_t, int> > > G;
                                
     vertex_property<G>::type p;
     // p[vertex_edge_t()] = 10;

I think the best approach would be to make this concept explicit, and
independent from BGL. Something like

   type_indexed_container<
     mpl::list<
        pair<vertex_name_t, int >,
        pair<vertex_distance_t, int> > > c;
   c[vertex_name_t()] = 10;
        
I wonder if something like this already exists... I vaguely recall someone
was doing that.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk