BGL: Problem with parallel edges and filtered_graph

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Jeremy, I think I discovered a problem concerning filtered_graphs and parallel edges: Assume I have a graph containing two edges E1 and E2 connecting node A and node B. Now I crate a boost::filtered_graph (myFilteredGraph) with a filter that returns true for only E1. When I now try to get E1 by calling edge = boost::edge( A, B, myFilteredGraph ).first; the result is undefined. Looking at the code (filtered_graph.hpp) I found out that the edge is return by: edge(typename filtered_graph<G, EP, VP>::vertex_descriptor u, typename filtered_graph<G, EP, VP>::vertex_descriptor v, const filtered_graph<G, EP, VP>& g) { typename G::edge_descriptor e; bool exists; tie(e, exists) = edge(u, v, g.m_g); return std::make_pair(e, exists && g.m_edge_pred(e)); } Here, the line tie(e, exists) = edge(u, v, g.m_g); returns _some_ edge, but not necessarily the _right_ one. The call edge(...) is not called for the filtered graph and g.m_edge_pred(e) is called _after_ getting the wrong edge (resulting in a return value FALSE). One solution would be to call boost::edge_range(A, B, myFilteredGraph) on my filtered_graph to get all visible edges, but this function is not provided. Any ideas how to solve my problem? Michael - -- http://www.ive.uni-hannover.de # kettner@ive.uni-hannover.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9TqUAkCdGnb0kVFMRAlsLAJwKJJ2NSLRu2HUv/H4sAhr4W5WdkACdHXZ6 3kz8fBDvysWKc1vxd5rf/CE= =l+NV -----END PGP SIGNATURE-----

Hi Michael, On Mon, 5 Aug 2002, Michael Kettner wrote: kettne> One solution would be to call kettne> boost::edge_range(A, B, myFilteredGraph) kettne> on my filtered_graph to get all visible edges, but this function is not kettne> provided. Any ideas how to solve my problem? Yep, that's an easy one. I've added edge_range to filtered_graph. You can get it from boost CVS. Also, I added a little example showing its use: example/filtered_graph_edge_range.cpp. Cheers, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Jeremy, thanks for the fix. One question remains: As far as I can see, if I have a multigraphgraph, the call boost::edge(u, v, g) returns _some_ existing edge connecting u and v. Now lets filter the graph so that we have a filtered multigraph gFilter where some of the parallel edges remain visible. The call boost::edge(u, v, gFilter) now returns _some_ existing edge and the information if it is visible. So it can be that this call returns (e, FALSE) even though there are visible edges connecting u and v. I would call this behaviour "surprising" for the developer. What I expect is that in this case some existing AND visible edge is returned, because I am working with a filtered graph "hiding" the filtered edges. Regards, Michael - -- http://www.ive.uni-hannover.de # kettner@ive.uni-hannover.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9T/HbkCdGnb0kVFMRAkXMAJ4l4MeCvGkDA8Kdgh9MyaMAwkJT8gCdHkEo Qlb42BITzUQtzDLs/YDUlk8= =ZNlG -----END PGP SIGNATURE-----

Hi Michael, On Tue, 6 Aug 2002, Michael Kettner wrote: kettne> connecting u and v. I would call this behaviour "surprising" for the kettne> developer. What I expect is that in this case some existing AND visible edge kettne> is returned, because I am working with a filtered graph "hiding" the filtered kettne> edges. That sounds good. How about you return the favor and send me a patch with the fix ;) You'll want to have the edge() function for filtered graph dispatch to two functions based on the edge_parallel_category of the underlying graph. One version will be just like the current implementation, and the other version will do what you describe. I suggest using the underlying graph's edge_range() function. Happy coding, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
participants (2)
-
Jeremy Siek
-
Michael Kettner