
Cosimo, you might also consider using a snapshot of the graph (i.e copy) in each explorer thread. This might well outperform a mutexed solution when the number of concurrent accesses to edges is high. The only thing to be synchronized then is generating a copy of the graph. Best regards, Christoph On Fri, Sep 18, 2009 at 2:47 PM, Cosimo Calabrese <cosimo.calabrese@tellus.it> wrote:
Now I'm trying to implement the EdgeMutableGraph concept, in order to obtain the add_edge() support, but I've a problem.
template <typename G> std::pair<typename sync_adjacency_list<G>::edge_descriptor, bool> add_edge(const typename sync_adjacency_list<G>::vertex_descriptor u, const typename sync_adjacency_list<G>::vertex_descriptor v, const sync_adjacency_list<G>& g) { interprocess::scoped_lock<interprocess::interprocess_mutex> lock( sync_adjacency_list_mutex ); return add_edge(u, v, g.m_g); }
When I try to use it with G = adjacency_list< listS, vecS, directedS, vertexs_properties, edges_properties >, I'm obtaining the follow compile error message:
"error C2665: 'boost::add_edge' : none of the 2 overloads could convert all the argument types"
It seems that the compiler can't find the right implementation of add_edge(). It's strange, because I'm sure that the add_edge() exists for adjacency_list<...>. The add_edge() version I've implementated is only a wrapper of it.
Where I'm wrong? Is it a MSVC 2005 function resolution bug?
I've found the add_edge() problem: I've defined 'const' the internal graph reference of sync_adjacency_list... without const, it works. This is the adaptor (the 'const' is now commented):
template <typename Graph> class sync_adjacency_list { typedef graph_traits<Graph> Traits; typedef sync_adjacency_list<Graph> self; public: typedef Graph graph_type; sync_adjacency_list( /*const*/ Graph& g) : m_g(g) { }
// .....
/*const*/ Graph& m_g; }
Now, I'll test it...
Cosimo Calabrese.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost