Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Accelerating property value-retrieval
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-04-08 10:33:23

On Fri, 8 Apr 2011, Cedric Laczny wrote:

> Hi,
> I would like to know if there is a way to accelerate the retrieval of
> properties of an edge or a vertex?
> Actually, I define a new vertex-property (vertex_properties) and this again
> uses a "struct VertexProperties { ... }" to specify the details of the
> properties.
> However, when I want to get the properties of say vertex v, I need to first get
> the properties-map from the graph and then get the property for v. This
> obviously suffers from the lookup in the property_map and I would like to know
> if there is a way to accelerate this?

You can save the property map in a variable to avoid repeated lookups, but
I suspect they are not too expensive.

> In particular, when using vecS as the
> vertex_container because the vertices could generally be used as indices...
> I would find this very convenient, especially in combination with filtered_graph
> when filtering only on vertices that have certain properties (e.g. a category)
> and one only wants to see those that have a specific character (e.g. color).

Fast lookups will probably require external properties, since those are
much simpler and have fewer layers of indirection (no pointers to members,
for example). Can you copy your properties to an iterator_property_map
(built on a vector) before the high-performance parts of your code?

-- Jeremiah Willcock

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at