Boost logo

Boost :

Subject: Re: [boost] [BGL] Why source() needs a graph argument?
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-10-02 10:41:27

On Fri, 2 Oct 2009, Cosimo Calabrese wrote:

> Hi to all,
> the question is in subject. I don't understand it. Either source() and
> target() functions only return the m_source member and the m_target of
> edge_base. They don't use the graph argument, that is not even used.
> I need to know it because I'm implementing an union_graph adaptor, that
> provides the join's view of 2 graph. When I call the source() function on a
> union_graph, I provide an edge_descriptor; but whereas the source() function
> of an adjacency_list needs a graph argument, I need to know which graph
> belongs the edge, which is an 2 * O|E| operation on 2 graphs.

Some edge descriptors need information from the graph and do not contain a
pointer to it (which would use extra space). For example, the compressed
sparse row graph's edge descriptor contains a source vertex and edge
index, and computes the target from that index and a table in the graph.
I would suggest using the Boost.Variant technique I mentioned in a
previous email to make it easy (and constant time) to distinguish which
edge descriptors are in each graph.

-- Jeremiah Willcock

Boost list run by bdawes at, gregod at, cpdaniel at, john at