[BGL] getting an edge_descriptor of a reverse_graph
I upgraded from boost 1.45 to 1.48 and there are some breaking changes
related to reverse_graph
The main problem that I encounter is that boost::edge(u ,v, graph)
returns a edge_descriptor to the graph that underlies reverse_graph,
rather than reverse_graph itself . The following therefore does not
compile:
template<typename Graph>
void foo(Graph& graph)
{
boost::graph_traits<Graph>::edge_descriptor e = boost::edge(0, 1,
graph).first;
}
int main() {
boost::adjacency_list
On Tue, 20 Dec 2011, Alex Hagen-Zanker wrote:
I upgraded from boost 1.45 to 1.48 and there are some breaking changes related to reverse_graph
The main problem that I encounter is that boost::edge(u ,v, graph) returns a edge_descriptor to the graph that underlies reverse_graph, rather than reverse_graph itself . The following therefore does not compile:
template<typename Graph> void foo(Graph& graph) { boost::graph_traits<Graph>::edge_descriptor e = boost::edge(0, 1, graph).first; }
That is a bug in that case; please file a ticket about it. boost::edge should always return an edge in the graph you call it on.
Do you have suggestions how to rewrite foo(Graph& graph) in order to generically work for both plain and reversed graphs? For now I have rewritten the boost::edge function in reverse_graph.hpp to return a pair
but that does not seem right.
That is the right solution, actually, to match the specification of boost::edge. Please send a patch if you can. -- Jeremiah Willcock
On 20/12/2011 16:22, Jeremiah Willcock wrote:
On Tue, 20 Dec 2011, Alex Hagen-Zanker wrote:
I upgraded from boost 1.45 to 1.48 and there are some breaking changes related to reverse_graph
The main problem that I encounter is that boost::edge(u ,v, graph) returns a edge_descriptor to the graph that underlies reverse_graph, rather than reverse_graph itself . The following therefore does not compile:
template<typename Graph> void foo(Graph& graph) { boost::graph_traits<Graph>::edge_descriptor e = boost::edge(0, 1, graph).first; }
That is a bug in that case; please file a ticket about it. boost::edge should always return an edge in the graph you call it on.
Do you have suggestions how to rewrite foo(Graph& graph) in order to generically work for both plain and reversed graphs? For now I have rewritten the boost::edge function in reverse_graph.hpp to return a pair
but that does not seem right. That is the right solution, actually, to match the specification of boost::edge. Please send a patch if you can.
On 20/12/2011 17:00, Alex Hagen-Zanker wrote:
On 20/12/2011 16:22, Jeremiah Willcock wrote:
On Tue, 20 Dec 2011, Alex Hagen-Zanker wrote:
I upgraded from boost 1.45 to 1.48 and there are some breaking changes related to reverse_graph Dear Jeremiah,
Thank you for applying the earlier patch to the trunk. Using the trunk version now rather than 1.48, I ran into some other issues that I thought required a patch too: https://svn.boost.org/trac/boost/ticket/6313 I hope I am right in using detail::reverse_graph_edge_property_map as a reversed edge wrapper around my existing edge_property_maps. For use with some property maps it did require me to add a default constructor and const reference operator[](key) const {} though. The class reverse_graph_edge_property_map seems very useful, if not essential, will it remain in the detail namespace? Or are you planning a more generic reverse_graph_property_map (would be happy to make a patch for that too). Thanks, Alex
On Thu, 22 Dec 2011, Alex Hagen-Zanker wrote:
On 20/12/2011 17:00, Alex Hagen-Zanker wrote:
On 20/12/2011 16:22, Jeremiah Willcock wrote:
On Tue, 20 Dec 2011, Alex Hagen-Zanker wrote:
I upgraded from boost 1.45 to 1.48 and there are some breaking changes related to reverse_graph Dear Jeremiah,
Thank you for applying the earlier patch to the trunk. Using the trunk version now rather than 1.48, I ran into some other issues that I thought required a patch too:
https://svn.boost.org/trac/boost/ticket/6313
I hope I am right in using detail::reverse_graph_edge_property_map as a reversed edge wrapper around my existing edge_property_maps. For use with some property maps it did require me to add a default constructor and const reference operator[](key) const {} though.
The class reverse_graph_edge_property_map seems very useful, if not essential, will it remain in the detail namespace? Or are you planning a more generic reverse_graph_property_map (would be happy to make a patch for that too).
The reverse_graph_edge_property_map class is in fact internal; see the documentation for how to get that map in an "official" way. -- Jeremiah Willcock
On 23/12/2011 14:44, Jeremiah Willcock wrote:
On Thu, 22 Dec 2011, Alex Hagen-Zanker wrote:
I hope I am right in using detail::reverse_graph_edge_property_map as a reversed edge wrapper around my existing edge_property_maps. For use with some property maps it did require me to add a default constructor and const reference operator[](key) const {} though. The reverse_graph_edge_property_map class is in fact internal; see the documentation for how to get that map in an "official" way.
Could you maybe point me to the right place in the documentation?
I have a function that has a graph and a property map(with edge
descriptors as keys) as arguments. Depending on a third argument it
either acts on the graph or the reverse graph:
template
On Tue, 3 Jan 2012, Alex Hagen-Zanker wrote:
On 23/12/2011 14:44, Jeremiah Willcock wrote:
On Thu, 22 Dec 2011, Alex Hagen-Zanker wrote:
I hope I am right in using detail::reverse_graph_edge_property_map as a reversed edge wrapper around my existing edge_property_maps. For use with some property maps it did require me to add a default constructor and const reference operator[](key) const {} though. The reverse_graph_edge_property_map class is in fact internal; see the documentation for how to get that map in an "official" way.
Could you maybe point me to the right place in the documentation?
Look for edge_underlying in URL:https://svn.boost.org/svn/boost/trunk/libs/graph/doc/reverse_graph.html. -- Jeremiah Willcock
participants (2)
-
Alex Hagen-Zanker
-
Jeremiah Willcock