Boost Users :
Subject: Re: [Boost-users] [BGL] passing a graph from one function to another
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2008-11-19 14:19:49
On Wed, Nov 19, 2008 at 12:39 PM, r89 <r8921025_at_[hidden]> wrote:
> Yes, I tried using add_vertex and add_edge and it works fine. But I assume
> that add_vertex and add_edge is much slower than using
> graph_t myGraph(array, edge_array + num_arcs, weights, num_nodes);
> Is this true or not? Does anyone have experience on that?
> My graph has over 10^6 edges.
It's possible to make it just as fast using some details of BGL.
There is a feature request for .reserve() functionality to be added to
BGL, but for now you can just do this:
// for directed graphs, also do in_edges
With those I can load graphs with close to 2.5 million edges in about
8 seconds (not *too* bad considering the graph is coming from a
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