Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2004-03-17 12:44:53


Hi Gustavo,

On Mar 17, 2004, at 11:13 AM, Gustavo Sánchez wrote:

> 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

The adjacency_matrix class does not have an add_vertex function, so
this graph
will always be empty :(

Maybe you should use adjacency_list instead?

Also, you have to have vertices in the graph before you can start
working with
their properties.

> 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.
>
>
>
> <image.tiff>    Antivirus • Filtros antispam • 6 MB gratis
>     ¿Todavía no tienes un correo inteligente?
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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