Boost logo

Boost Users :

Subject: [Boost-users] [graph] Unique vertices using setS
From: Nicholas Dahm (n.dahm_at_[hidden])
Date: 2014-08-27 02:47:33

Hi All,

I'm trying to create a graph with unique vertices using setS for vertices, but it doesn't seem to be working.

To test it I've made a simple example simply using int's for the vertex properties:

        typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, int, int> gtype;
        typedef boost::graph_traits<gtype>::vertex_descriptor gvd;

        gtype gr;
        int v1 = 4;
        gvd vd1 = add_vertex(v1, gr);
        gvd vd2 = add_vertex(v1, gr);
        printf("vd1: %ld, gr[vd1]: %d\n", vd1, gr[vd1]);
        printf("vd2: %ld, gr[vd2]: %d\n", vd2, gr[vd2]);
        printf("num_vertices: %d\n", num_vertices(gr));


        vd1: 17473168, gr[vd1]: 4
        vd2: 17473248, gr[vd2]: 4
        num_vertices: 2

So my graph has two vertices represented by the int 4, suggesting it's not a set! Any idea what I'm missing? Is the set for vertex descriptors, but the vertices themselves stored elsewhere?



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