5 Oct
2012
5 Oct
'12
10:40 p.m.
On Fri, 5 Oct 2012, eric wrote:
Is there a way to tell if a labeled graph already contains a key? As I'm constructing my graph from database data, I would like to check whether a node's parent already exists, and if not create it.
One thing to do is to try to insert it using insert_vertex() or label_vertex() and check the return value. It looks like you can also call the vertex() method with the label (or vertex_by_label() as a free function in trunk version r80879 or above) and see if the return value is graph_traits<GraphType>::null_vertex() (which is returned if the label was not found). -- Jeremiah Willcock