Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] getting an edge_descriptor of a reverse_graph
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-12-20 11:22:19


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<reverse_graph_edge_descriptor, bool> 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


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