[BGL] Extending own Graph type to work with BGL
Hi guys and girls,
I've got an existing Graph structure, consisting of node and edge
classes. The graph structure itself is implicit in the sense that
every node contains a list of out edges, and edges know where they
start from and go to.
I'm using Qt's container classes for simplicity mostly, eg. a node has
a QList of successors (QList
on Wed Jul 09 2008, "Christiaan Putter"
Hi guys and girls,
I've got an existing Graph structure, consisting of node and edge classes. The graph structure itself is implicit in the sense that every node contains a list of out edges, and edges know where they start from and go to.
I'm using Qt's container classes for simplicity mostly, eg. a node has a QList of successors (QList
), and all the nodes and edges get stored in a Network class using QHash etc... I've been trying to extend this to work with the BGL, following the LEDA and SGB examples.
As far as I know I can simply use the BGL functions on an instance of my own Network, ie. no need to recreate the graph. Is this correct?
Yes, that's what makes BGL a generic library :-) -- Dave Abrahams BoostPro Computing http://www.boostpro.com
Hi guys,
Thanks for the clarification Dave, after struggling for for 2 days I
wasn't so sure any more. Still not getting it right though.
It seems the basic structure of the BGL interface works on my graph.
I can run a bfs with "visitor(default_bfs_visitor())" , and it
searches through the graph quite well. However when adding my own
visitor...
Taken from the bfs visitor example:
class bfs_name_printer : public default_bfs_visitor {
public:
bfs_name_printer() { };
template &,
boost::detail::error_property_not_found) [with VertexListGraph =
Network,
P = bfs_name_printer ()(), T = boost::graph_visitor_t, R =
boost::no_property]':
N:/_tools/boost_1_35_0/boost/graph/breadth_first_search.hpp:255:
instantiated from `void boost::breadth_first_search(const
VertexListGraph&, typename boost::graph_traits<G>::vert
ex_descriptor, const boost::bgl_named_params &) [with
VertexListGraph = Network, P = bfs_name_printer ()(), T =
boost::graph_visitor_t, R = boost::no_property]'
N:\_devel\_workspace\GWISeo\src\core\solution.cpp:186: instantiated from here
N:/_tools/boost_1_35_0/boost/graph/breadth_first_search.hpp:226:
error: function return type cannot be function
N:/_tools/boost_1_35_0/boost/graph/named_function_params.hpp:656:
error: function return type cannot be function
N:/_tools/boost_1_35_0/boost/graph/breadth_first_search.hpp:226:
error: function return type cannot be function
N:/_tools/boost_1_35_0/boost/graph/named_function_params.hpp: In
function `typename boost::property_value &,
boost::detail::error_property_not_found) [with VertexListGraph =
Network, P
= bfs_name_printer ()(), T = boost::graph_visitor_t, R = boost::no_property]'
N:/_tools/boost_1_35_0/boost/graph/breadth_first_search.hpp:255:
instantiated from `void boost::breadth_first_search(const
VertexListGraph&, typename boost::graph_traits<G>::vert
ex_descriptor, const boost::bgl_named_params &) [with
VertexListGraph = Network, P = bfs_name_printer ()(), T =
boost::graph_visitor_t, R = boost::no_property]'
N:\_devel\_workspace\GWISeo\src\core\solution.cpp:186: instantiated from here
N:/_tools/boost_1_35_0/boost/graph/named_function_params.hpp:656:
error: function return type cannot be function
N:/_tools/boost_1_35_0/boost/graph/breadth_first_search.hpp:226:
instantiated from `static void
boost::detail::bfs_dispatchboost::detail::error_property_not_found::apply(Vertex
ListGraph&, typename boost::graph_traits<G>::vertex_descriptor, const
boost::bgl_named_params &,
boost::detail::error_property_not_found) [with VertexListGraph =
Network, P
= bfs_name_printer ()(), T = boost::graph_visitor_t, R = boost::no_property]'
N:/_tools/boost_1_35_0/boost/graph/breadth_first_search.hpp:255:
instantiated from `void boost::breadth_first_search(const
VertexListGraph&, typename boost::graph_traits<G>::vert
ex_descriptor, const boost::bgl_named_params &) [with
VertexListGraph = Network, P = bfs_name_printer ()(), T =
boost::graph_visitor_t, R = boost::no_property]'
N:\_devel\_workspace\GWISeo\src\core\solution.cpp:186: instantiated from here
N:/_tools/boost_1_35_0/boost/graph/named_function_params.hpp:662:
error: invalid conversion from `bfs_name_printer (*)()' to `int'
etc.
etc.
***********************************
***********************************
I'm quite sure their must be something I've left out or done wrong
when writing the BGL interface for my graph. If anybody can point me
in the right direction I'd be very grateful.
And advice on how to implement the bundle concept in my own graph
would be great too.
Have a nice day,
Christiaan
2008/7/9 David Abrahams on Wed Jul 09 2008, "Christiaan Putter" Hi guys and girls, I've got an existing Graph structure, consisting of node and edge
classes. The graph structure itself is implicit in the sense that
every node contains a list of out edges, and edges know where they
start from and go to. I'm using Qt's container classes for simplicity mostly, eg. a node has
a QList of successors (QList I've been trying to extend this to work with the BGL, following the
LEDA and SGB examples. As far as I know I can simply use the BGL functions on an instance of
my own Network, ie. no need to recreate the graph. Is this correct? Yes, that's what makes BGL a generic library :-) --
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, Christian,
Seems the error message you have does not indicate to your specialized
functions. It is more likely of incorrect BFS call. Does the call of
boost::get(vertex_index, g) returns a vertex_index property map?
The bundled property maps can be understood from its implementaion, I
think. Just take a look:
http://svn.boost.org/svn/boost/trunk/boost/graph/properties.hpp
#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES
template
Hi guys,
Thanks for the clarification Dave, after struggling for for 2 days I wasn't so sure any more. Still not getting it right though.
It seems the basic structure of the BGL interface works on my graph. I can run a bfs with "visitor(default_bfs_visitor())" , and it [snip]
Node* s = _network.getNodes().value(20);
bfs_name_printer vis(); breadth_first_search(_network, s, visitor(vis));
Passing my own visitor causes the whole thing not to compile, with the error message:
*********************************** ***********************************
[a lot of g++ compilation errors]
N:\_devel\_workspace\GWISeo\src\core\solution.cpp:186: instantiated from here N:/_tools/boost_1_35_0/boost/graph/named_function_params.hpp:662: error: invalid conversion from `bfs_name_printer (*)()' to `int'
etc. etc.
*********************************** ***********************************
I'm quite sure their must be something I've left out or done wrong when writing the BGL interface for my graph. If anybody can point me in the right direction I'd be very grateful.
And advice on how to implement the bundle concept in my own graph would be great too.
Have a nice day, Christiaan
2008/7/9 David Abrahams
:
Hi all I would like to know where I can get some information about how to use the relaxed heaps in Boost? I would also like to know which file/files it is located in? Are there any bugs on relaxed heaps that has been fixed since 1.33.1 ? Thanks alot for your help. Line
Hi Line,
afaik there is no real documentation for the relaxed heap. It resides
in boost/pending/relaxed_heap.hpp. There's also a binary heap in
mutable_queue.hpp. Find below some basic code on how to initialize the
heaps
typedef graph_traits
Hi all I would like to know where I can get some information about how to use the relaxed heaps in Boost? I would also like to know which file/files it is located in? Are there any bugs on relaxed heaps that has been fixed since 1.33.1 ?
Thanks alot for your help. Line
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks Moritz
for the information and the examples. It is expecially merging heaps I am interested in and it seems that relaxed_heap has a combine method to merge heaps.
Thanks alot for the help.
Line
________________________________
Fra: boost-users-bounces@lists.boost.org på vegne af moritz Hilger
Sendt: fr 11-07-2008 09:55
Til: boost-users@lists.boost.org
Emne: Re: [Boost-users] Relaxed heaps
Hi Line,
afaik there is no real documentation for the relaxed heap. It resides
in boost/pending/relaxed_heap.hpp. There's also a binary heap in
mutable_queue.hpp. Find below some basic code on how to initialize the
heaps
typedef graph_traits
Hi all I would like to know where I can get some information about how to use the relaxed heaps in Boost? I would also like to know which file/files it is located in? Are there any bugs on relaxed heaps that has been fixed since 1.33.1 ?
Thanks alot for your help. Line
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (5)
-
Christiaan Putter
-
David Abrahams
-
Dmitry Bufistov
-
Line Blander Reinhardt
-
moritz Hilger