|
Boost Users : |
From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2007-07-06 15:21:34
On Fri, 2007-07-06 at 13:17 -0500, jiangfan shi wrote:
> HI, All,
>
> I could not get a instance of reversed graph by calling
> make_reverse_graph(g).
>
> That is, I have following type:
> typedef adjacency_list<
> listS,
> listS,
> bidirectionalS,
> property<vertex_index_t, std::size_t>, no_property> G;
>
> typedef reverse_graph<G, G&> ReverseG; //Maybe something wrong here.
>
> After I call make_revserse_graph(G) as following, I could not get a
> instance of modified graph by accessing some fields of ReverseG.
>
> ReverseG tmp=boost::make_reverse_graph(g); //I try to get the
> reservsed graph here.
>
> The only field is tmp.m_g, which is G& type and the original graph,
> but is not the reversed graph.
The reverse_graph class template in the BGL is a reversed *view* of the
existing graph. It costs essentially nothing to build this view, but
when you look at the reverse_graph of a graph you see all of its edges
going backwards (the actual storage in the graph is unchanged). Because
it's a view, changes to the original graph will show up immediately in
the reversed graph.
- Doug
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