Dear all, Reading all the documentation online about memory reservation in a graph, I am still wondering if it would be possible to reserve memory in advance. With a vecS container it would be quite an advantage to reserve memory, but let me be clear, I am not saying that I know the number of edges in advance, so CRS isn't an option. Until now I know of two ways to do this. The first is to add & remove an edge: add_edge(0, num_vertices(g) + list.size() - 1, g); remove_edge(0, num_vertices(g) + list.size() - 1, g); however, it won't work in my context since I could (as you see from the code) add edges to an existing graph, and I am getting weird results. I am sure this is due to my code, however, add/remove isn't really a neat solution. The second option is weird: g.m_vertices.resize(list.size() - 1); This could be used, but m_* members should, as far as I understand, be private or protected. Is there any other nice possibility? For instance, a static function in the traits that reserves memory? In case, why this cannot be done by BGL APIs? Thanks!
participants (1)
-
Sensei