On 20/05/14 23:12, Nick Edmonds wrote:
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 http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/compressed_sparse_row.ht....
Thanks Nick, I know about the in-place constructor, and that is what I used before I needed a weighted graph. But now I need to have weights on arcs, and since the arcs are chosen among N^2 node couples (and there is no way I can avoid checking N^2 node pairs), I opted for Intel's TBB. It is convenient to use a TBB concurrent vector of tuples since push_back is guaranteed to work, and that is just what I need. However, if I switch to a concurrent vector for arcs and another one for weights, I might need a semaphore, hurting performances. Moreover, I've been thinking about using a concurrent vector and a hash map from pairs to weights, but I don't know if this can be useful in a boost CSR constructor. I really hope I could get rid of these temporaries! Thanks!