|
Boost Users : |
From: Luis Quesada (luque_at_[hidden])
Date: 2005-11-30 14:06:03
Dear all,
Sorry for the newbie question!
Given the index of a vertex, how can I get its descriptor? I guess
function vertex (page 225 of The Boost Graph Library) does that but the
function is not defined.
In fact, what I want to do is to check whether an edge belongs to a
graph in a context where descriptors get invalidated after vertex removals?
Suppose I have done this:
// create a typedef for the Graph type
typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
// Make convenient labels for the vertices
enum { A, B, C, D, E, N };
const int num_vertices = N;
const char* name = "ABCDE";
// writing out the edges in the graph
typedef std::pair<int, int> Edge;
Edge edge_array[] = { Edge(A,B), Edge(A,D), Edge(C,A), Edge(D,C),
Edge(C,E), Edge(B,D), Edge(D,E) };
const int num_edges = sizeof(edge_array)/sizeof(edge_array[0]);
// declare a graph object
Graph g(num_vertices);
Then I remove some vertices. Now I want to check whether edge <A,B> is
still there. Calling edge(A,B,g) would not be OK because the descriptors
are no longer referring to the same vertices....
Thanks in advance for your answer,
Luis
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