Boost logo

Boost Users :

From: Rui Carvalho (rui.carvalho_at_[hidden])
Date: 2004-12-08 07:26:07


Hi,

I must be missing something basic as my use of random_vertex returns always
the same vertex each time I run the code (which is listed below).

Help would be much appreciated. I'm using MSVC 7.1 and boost 1.32 on windows
XP.

TIA,
Rui

#include <iostream>

#include <boost/graph/random.hpp>

#include <boost/random/mersenne_twister.hpp>
                                        
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>

using namespace boost;
using namespace std;

int main(int,char*[])
{
        
        typedef adjacency_list < vecS,
                vecS,

                directedS >

                Graph;

        //Builds graph with vertices, but no edges
        Graph g(100);
        
        typedef graph_traits<Graph>::vertex_descriptor Vertex;

        mt19937 gen;
        Vertex i;

        i = random_vertex(g, gen);
        cout << "Random vertex:" << i << endl;
}

        


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