array of small world graphs

Hi all, new to boost and experiencing a bit of an issue with generating a collection of small worlds.
Basically i want for each pass of the loop to generate a small world with a certain pRewire.
Here's some code
typedef small_world_iterator

On Thu, 4 Feb 2010, Vasilis Hatzopoulos wrote:
Hi all, new to boost and experiencing a bit of an issue with generating a collection of small worlds. Basically i want for each pass of the loop to generate a small world with a certain pRewire.
Here's some code
typedef small_world_iterator
SWGen; base_generator_type generator(1u);
for(int i = 0; i < num_graphs; i++){
Graph g( SWGen( generator, N, k, pRewire, SWGen(), N ); . . some operations on g, i.e. path lengths e.t.c. }
As it happens all graphs g are the same graph while what i want is a collection of different small worlds with the same pRewire. Why does the state of the generator not advance after the first Graph is generated?
I believe the generator is taken in by copy. See if either "&generator" or "boost::ref(generator)" works instead of "generator" in your construction of the graph. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
Vasilis Hatzopoulos