|
Boost Users : |
From: sean yang (seanatpurdue_at_[hidden])
Date: 2006-05-06 23:49:43
I want to add a vertex, which a string as its ID to a graph if a vertex
representing such a string does not exist in the graph. Is there a function
call to test if a vertex exists in a graph?
-----------------------------------------------------------------------
//Here is the simpilfied situation that I want to handle, "IF THERE IS NOT
a vertex representing the //string of the current line" is the predicate I
want to know
typedef adjacency_list<vecS, vecS, directedS,
property<vertex_color_t, default_color_type>,
property<edge_weight_t, int> > Graph;
Graph g();
ifstream infile;
infile.open(argv[1]);
string line;
while( getline(infile, line) ){
if(line.find("Node")!= npos && /*IF THERE IS NOT a vertex representing
the string of the current line*/)
add_vertex( line, g);
}
--------------------------------------------------------------------
A related question I want to ask is whether there exist a function call that
test whether an edge representing [vertext string("Node1") --> vertext
string("Node2") ] exists in a graph.
Thanks a lot,
Sean
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
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