Subject: Re: [boost] [BGL] Multithread problem inserting edges and exploring the same graph
From: Cosimo Calabrese (cosimo.calabrese_at_[hidden])
Date: 2009-10-05 16:25:12


Jeremiah Willcock ha scritto:
> One issue with it is the case where the vertex or edge
> descriptor types of the two graphs are the same. You need separate
> types for "thing from graph 1" and "thing from graph 2"

Yes, it's true.

I thought to use a thing that I haven't never used, that is the 6th
template parameter of adjacency_list: GraphProperties.

adjacency_list<EdgeList, VertexList, Directed,
VertexProperties, EdgeProperties, *GraphProperties*>

I could define two tags:

struct original_graph_tag { };
struct little_graph_tag { };

and pass these types in the 'original' and 'little' graph, respectively.
This could be enough to differentiate the two type of graph, and
therefore the descriptors.

E.G.

typedef adjacency_list< vecS, vecS, directedS,
         no_property, no_property, original_graph_tag > OriginalGraph;

typedef adjacency_list< vecS, vecS, directedS,
         no_property, no_property, little_graph_tag > LittleGraph;

typedef graph_traits<OriginalGraph>::edge_descriptor OrigED;
typedef graph_traits<LittleGraph>::edge_descriptor LittleED;

In this case OrigED and LittleED are *always* different? Is it true?

The GraphProperty has only one value for all the graph, isn't it? It
doesn't create a map, like the EdgeProperty or VertexProperty, is it right?

> (you can use the same wrapper for vertices and edges) to put into the variant.

Referring to "the same wrapper"... I haven't still understand what do
you mean. Please, can you explain to me what is the wrapper about you speak?

> Also, if
> you don't want a variant visitor, you can use get() to dispatch on the
> variant type.

Yes, it simplifies the code. I'll use it.

Thanks again for your help,
Cosimo Calabrese.