Help using graph library for bundled properties
I just started using the graph library.....
I want to store a class I created called bbox as vertices of a graph.
So, I just used the bundled properties mentioned as mentioned in the
documentation.
So here is a relevant portion of the code:
vector<bbox> A;
boost::adjacency_list
Abde Ali Kagalwalla wrote:
I just started using the graph library..... I want to store a class I created called bbox as vertices of a graph. So, I just used the bundled properties mentioned as mentioned in the documentation.
So here is a relevant portion of the code:
vector<bbox> A;
boost::adjacency_list
G; for (int i=0; i
But bbox is not accepted as a valid vertex_descriptor for add_edge function.
Right, your graph's vertex descriptor type is
boost::graph_traits<
adjacency_list
::vertex_descriptor
which is almost certainly something like an int or a std::size_t -- Dave Abrahams BoostPro Computing http://www.boostpro.com
Hi Dave,
It is still not clear.
What should my parameters be for the function add_edge() to construct the
graph with bbox objects as edges?
Thanks,
Abde Ali
On Tue, Jun 24, 2008 at 5:45 AM, David Abrahams
Abde Ali Kagalwalla wrote:
I just started using the graph library..... I want to store a class I created called bbox as vertices of a graph. So, I just used the bundled properties mentioned as mentioned in the documentation.
So here is a relevant portion of the code:
vector<bbox> A;
boost::adjacency_list
G; for (int i=0; i
But bbox is not accepted as a valid vertex_descriptor for add_edge function.
Right, your graph's vertex descriptor type is
boost::graph_traits< adjacency_list
::vertex_descriptor
which is almost certainly something like an int or a std::size_t
-- Dave Abrahams BoostPro Computing http://www.boostpro.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Abde Ali Kagalwalla wrote:
Hi Dave,
It is still not clear. What should my parameters be for the function add_edge() to construct the graph with bbox objects as edges?
I'm not sure how to answer you helpfully because there seem to be a few misconceptions here. To start with, the edge properties are not the edges themselves; they're just associated properties. Secondly, the graph you've declared doesn't specify any bundled edge properties; it specifies bbox as a bundled vertex property. ...but the straightforward answer to your question is that the first two parameters to add_edge should be vertex descriptors, usually as obtained from the add_vertex function.
Thanks,
Abde Ali
On Tue, Jun 24, 2008 at 5:45 AM, David Abrahams
mailto:dave@boostpro.com> wrote: Abde Ali Kagalwalla wrote: > I just started using the graph library..... > I want to store a class I created called bbox as vertices of a graph. > So, I just used the bundled properties mentioned as mentioned in the > documentation. > > So here is a relevant portion of the code: > > vector<bbox> A; > > boost::adjacency_list
G; > > for (int i=0; i for(int j=i+1; j add_edge(A[i], A[j], G); > }} >
HTH, -- Dave Abrahams BoostPro Computing http://www.boostpro.com
Hi,
I want to use bbox as a bundled vertex property, not a bundled edge
property. This is the code I was trying to compile:
vector<bbox> A;
adjacency_list
Abde Ali Kagalwalla wrote:
Hi Dave,
It is still not clear. What should my parameters be for the function add_edge() to construct the graph with bbox objects as edges?
I'm not sure how to answer you helpfully because there seem to be a few misconceptions here. To start with, the edge properties are not the edges themselves; they're just associated properties. Secondly, the graph you've declared doesn't specify any bundled edge properties; it specifies bbox as a bundled vertex property.
...but the straightforward answer to your question is that the first two parameters to add_edge should be vertex descriptors, usually as obtained from the add_vertex function.
Thanks,
Abde Ali
On Tue, Jun 24, 2008 at 5:45 AM, David Abrahams
mailto:dave@boostpro.com> wrote: Abde Ali Kagalwalla wrote: > I just started using the graph library..... > I want to store a class I created called bbox as vertices of a
graph.
> So, I just used the bundled properties mentioned as mentioned in
the
> documentation. > > So here is a relevant portion of the code: > > vector<bbox> A; > > boost::adjacency_list
G; > > for (int i=0; i for(int j=i+1; j add_edge(A[i], A[j], G); > }} > HTH,
-- Dave Abrahams BoostPro Computing http://www.boostpro.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi, Abde Ali Kagalwalla escribió:
for(pi = boxVector.begin(); pi!=boxVector.end(); pi++){
for( pj = pi+1 ; pj!=boxVector.end(); pj++){
add_edge(*pi, *pj, G); }}
Should'nt bbox now be accepted as a valid vertex descriptor by the add_edge function?
I think that no.
on compiling this, I get that "no matching function for add_edge
>" So, how should I implement this to get bbox as a bundled vertex property? Try this one:
for(size_t i = 0; i < boxVector.size(); ++i){ for( size_t j = i + 1 ; i < boxVector.size(); ++j){ add_edge(i, j, G); }}
Thanks
Abde Ali
Good luck, Dmitry
Hi,
This works but then I am just storing int objects as vertices of the graph.
I want to store bbox objects as vertices of the graph.
What should I change in the above code to store bbox objects as vertices of
the graph with bundled vertex properties.
Thanks,
Abde Ali
On Tue, Jun 24, 2008 at 12:49 PM, Dmitry
Hi,
Abde Ali Kagalwalla escribió:
for(pi = boxVector.begin(); pi!=boxVector.end(); pi++){
for( pj = pi+1 ; pj!=boxVector.end(); pj++){
add_edge(*pi, *pj, G); }}
Should'nt bbox now be accepted as a valid vertex descriptor by the add_edge function?
I think that no.
on compiling this, I get that "no matching function for add_edge
bbox&,adjacency_list
>" So, how should I implement this to get bbox as a bundled vertex property? Try this one:
for(size_t i = 0; i < boxVector.size(); ++i){
for( size_t j = i + 1 ; i < boxVector.size(); ++j){
add_edge(i, j, G); }}
Thanks
Abde Ali
Good luck,
Dmitry
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Abde Ali Kagalwalla wrote:
Hi,
This works but then I am just storing int objects as vertices of the graph. I want to store bbox objects as vertices of the graph. What should I change in the above code to store bbox objects as vertices of the graph with bundled vertex properties.
Thanks,
Abde Ali, Take a look on the attached example. Does it do what you want ? Dmitry
Hi Dmitry,
This is doing exactly what I am looking for.
Thanks a lot.
Abde Ali
On Wed, Jun 25, 2008 at 7:05 AM, Dmitry Bufistov
Abde Ali Kagalwalla wrote:
Hi,
This works but then I am just storing int objects as vertices of the graph. I want to store bbox objects as vertices of the graph. What should I change in the above code to store bbox objects as vertices of the graph with bundled vertex properties.
Thanks,
Abde Ali,
Take a look on the attached example. Does it do what you want ?
Dmitry
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Abde Ali Kagalwalla
-
David Abrahams
-
Dmitry
-
Dmitry Bufistov