Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL and threaded graph modification
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-07-30 07:52:03


>
> Well, I am using adjacency list with vecS vecS as storage. So I guess it is
> not possible. BTW, is it possible to reserve the storage for the edges at
> creation time of the graph? This would speed up things in case things get
> large...
>

Not in a very obvious way. The adjacency_list inherits from a metafunction
(sort of) called adj_list_gen<...> type, which turns out to be either an
adj_list_impl or a vec_adj_list_impl, with the latter corresponding to the
vertex list selector == vecS. Both of these have members m_edges, and
m_vertices, which correspond to the global edge and vertex sets. The types
of these containers are (should be?) determined by the vecS, listS stuff,
and (more importantly) appear to be public for both implementations.

I wrote that mainly for my own sake.

If you have a graph g, you might just try writing:

g.m_edges.reserve(n);

Andrew Sutton
andrew.n.sutton_at_[hidden]



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net