[graph] Unique vertices using setS

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)); Output: 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? cheers Nick

Is there any place where I could enforce unique properties? (i.e. not add a new vertex if it's properties are the same as an existing vertex) My graph is actually an implicit search tree for an A* search so there's lots of nodes which will be revisited via different paths. My current thought is to create the new vertex (which is a search tree state), then simply iterate through all existing vertices to see if any are identical in properties. However if the vertices were sorted by their properties in a set (i.e. weakly ordered), this would be much faster. -Nick
participants (1)
-
Nicholas Dahm