Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] passing a graph from one function to another
From: r89 (r8921025_at_[hidden])
Date: 2008-11-19 12:39:15

Andrew Sutton-2 wrote:
>> I do have graph typedef as a global.
>> The original problem was, I am not allowed to define
>> graph_t myGraph;
>> without all the arguments like this:
>> graph_t myGraph(array, edge_array + num_arcs, weights, num_nodes);
>> Since I don't know the arguments before fun_A, I need something like a
>> "resize" operator, so that i can define graph_t outside the function, but
>> declare it later inside the function.
> You are definitely allowed to declare graph_t without any arguments, and
> you
> can use add_vertex and add_edge to insert data as needed. The graph will
> by
> dynamically resized as you add elements.
> Andrew Sutton
> andrew.n.sutton_at_[hidden]
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

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.

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at