Boost logo

Boost Users :

From: Gustavo Sánchez (gustsanc_at_[hidden])
Date: 2004-03-17 11:13:41


I have to build a graph from data in a file, some information is strings which are related to vertexes. I want to prove if those vertexes already exist in the graph before the insert operation. Next is the source:
 
typedef adjacency_matrix<undirectedS,VertexProperty,EdgeProperty> UGraph; // an undirected graph
 UGraph g(0); // start from scratch
property_map<UGraph, edge_name_t>::type ename = get(edge_name, g); // not sure if this is right (the graph have no elements at this point)
property_map<UGraph, vertex_name_t>::type vname = get(vertex_name, g);
typedef property_map<UGraph, vertex_name_t>::type vname_type;

typedef boost::property_traits<vname_type>::key_type vktype;
typedef boost::property_traits<vname_type>::value_type vvtype;

 
vktype indice_nombre;
vvtype valor_nombre;
 
for(i=0;i<datgen.NumHilos;i++){
 valor_nombre = hiloNormal[i].viaOrigen; /// here we get the string
 indice_nombre = vname[valor_nombre]; /// here I try to get the index
/// I think this is not posible because there isn't [] operator in this way
 valor_nombre = vname[1]; /// if I do this the compiler is right but that isn't useful for me because the information I have is the string not the index.I can use vertex iterators and search for the string, but if posible i prefer not to do that.
 
thanks a lot.

---------------------------------

    Antivirus • Filtros antispam • 6 MB gratis
    ¿Todavía no tienes un correo inteligente?



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