Boost logo

Boost Users :

Subject: Re: [Boost-users] Getting undirected graph from directed graph discarding properties
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-10-13 17:01:46


On Thu, 11 Oct 2012, Philipp Klaus Krause wrote:

> On 10.10.2012 22:15, Jeremiah Willcock wrote:
>> On Wed, 10 Oct 2012, Philipp Klaus Krause wrote:
>>
>>> I have a directed graph that has some properties, and I want the
>>> underlying undirected graph, but don't need the properties there.
>>> Assuming G is the directed graph with properties, and G_sym is the
>>> undirected without them, up until boost 1.50 I used:
>>>
>>> boost::copy_graph(G, G_sym);
>>>
>>> But as of boost 1.51 and 1.52 this gives an error due to the properties.
>>> Is there an easy way to do what I want to do in boost, and if yes, how?
>>
>> Pass a vertex_copy function that does nothing to copy_graph; see the
>> copy_graph documentation for details, but basically you just want a
>> binary function that takes anything, returns void, and is empty.
>>
>> -- Jeremiah Willcock
>
> My attempt at doing so
>
> template <class G_t, class G2_t>
> struct forget_about_the_properties
> {
> typedef typename boost::graph_traits<G_t>::vertex_descriptor G_desc;
> typedef typename boost::graph_traits<G2_t>::vertex_descriptor G2_desc;
>
> void operator()(G_desc, G2_desc) const
> {
> }
> };

It looks like you are not calling the three-parameter version of
copy_graph in other places in your code, leading to the first two groups
of errors. You will also probably need a dummy edge property copy
function in addition to the one for vertex properties; I see errors in
your list that suggest that as well.

-- 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