Boost logo

Boost Users :

From: Ferng, Andrew D (andrew.d.ferng_at_[hidden])
Date: 2007-11-05 15:14:49


Hi Aaron,
Thanks for the help! Still trying to understand how to use BGL.

As for the original graph type, I was using:
typedef adjacency_list<
vecS,
vecS,
undirectedS,
property<vertex_index_t, long>,
property<edge_index_t, long> > ConnectionGraph;

Having had no luck with it, I changed it back to the example using name
/ string and then it worked.

typedef adjacency_list<
vecS,
vecS,
undirectedS,
property<vertex_name_t, std::string>,
property<edge_name_t, std::string> > ConnectionGraph;

So I'm still confused as to why it would be a l-value issue in one case
but not in the other.
In both of these situations, the goal is trying to populate the property
map right?

-----Original Message-----
From: Aaron Windsor [mailto:aaron.windsor_at_[hidden]]
Sent: Saturday, November 03, 2007 5:54 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [BGL] property_map not compiling because it's
notl-value?

Hi Andrew,

Your code didn't show the type of graph you're using for interfaceGraph,
but I'm going to assume that it's an adjacency_list using a std::vector
to store the vertices. In that case, the vertex index is populated
automatically with the indices of each vertex descriptor in the
underlying vector, making the vertex index map read-only. In other
configurations (for example, using a std::list to store the vertices)
you can set the vertex index - in fact, you have to initialize it
yourself if you're going to use it.

The vertex index and edge index are used by most BGL algorithms to
create property maps from vertices and edges to arbitrary types, so I'd
recommend against using them for anything else (in your code, you're
using them to store a grid id and connecting element id). Check out the
documentation on bundled properties, which allow you to augment graphs
with arbitrary properties easily
(http://www.boost.org/libs/graph/doc/bundles.html).

Regards,
Aaron
_______________________________________________
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