Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-10-05 12:09:08


Krishna Padmasola writes:
> Hi Jeremy,
>
> Is the graph class designed to be inheritable? Or should one just use
> composition to include the graph in an application class?
>
> I prefer using composition but which is the recommended approach?

This depends on whether you want your new class to:

a) act like a graph, or
b) contain something that acts like a graph

For a) use inheritance, for b) use containment.

You typically would only needed to do a) if there is some graph
operation that is not in adjacency_list that you would like to add. I
don't suggest adding non-graph operations this way... you end up
mixing abstractions.

> Secondly, I notice from properties.hpp that there is a GraphProperty.
> Does that mean that we can associate properties with the graph as well
> (in addition to vertices and edges)? Are there any examples on this?

Yes, that is the idea. Though the interface to this still needs to be
updated to be orthogonal with the vertex and edge property maps.
Currently you use the "get_property()" function defined in
boost/graph/adjacency_list.hpp. The name should be changed to just
"get()". I'll do this now.

Cheers,

Jeremy


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