On Tue, May 20, 2014 at 8:52 AM, Sensei <senseiwa@gmail.com> wrote:
Dear all,

I need to construct (and use) a graph that can handle millions of nodes, with minimal overhead, and as suggested I am using a CSR graph. As I understand from the documentation, it is unmodifiable.

Arcs are created at runtime in a parallel fashion, and my choice was to use a vector of std::tuple<std::size_t, std::size_t, int> (that is, node, node, weight) with Intel's TBB.

This is the problem: can I avoid temporary vectors to construct my graph?

Right now the only way I see is to create the vector of arcs (as std::pair) and the vector of weights, but this is a waste of time and memory.

Do you have any helpful suggestions?


Cheers & Thanks!

(apologies for the double-post, had to update my mailing list subscription)

There is an in-place constructor to the CSR graph, but you'll need three separate vectors (sources, targets, properties) rather than a vector of tuples.  See the in-place ctors here.

HTH,
Nick