|
Boost : |
From: Tim Culver (tim.gmane_at_[hidden])
Date: 2002-09-16 16:01:19
I read an archived discussion of vertex and edge descriptors, but I'm
not sure I understood it. Is this the proper way to handle these:
typedef adjacency_list<listS, listS, ...> Graph;
typedef graph_traits<Graph>::vertex_descriptor Vdesc;
typedef graph_traits<Graph>::edge_descriptor Edesc;
Vdesc find_vertex(Graph& g) {
Vdesc v, v_end;
for (tie(v, v_end)=g.vertices(); v!=v_end; v++)
if (my criterion)
return v;
return Vdesc();
}
Vdesc v = find_vertex(g);
if (v != Vdesc()) {
// found
} else {
// not found
}
1. Is this correct as written? (Semantically, I mean--does it do what I
obviously want it to do?)
2. Is this still correct if I change both listS to vecS?
Thanks,
Tim
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk