Hello all.
I'm having issues getting property maps to work properly with my
custom adjacency_list. Here's a snippet of the code:
// Definitions
// define some of the properties the graphs will have
// http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.htm...
struct posx_t { typedef vertex_property_tag kind; };
struct posy_t { typedef vertex_property_tag kind; };
typedef property
On Sat, 27 Feb 2010, Trevin Murakami wrote:
Hello all.
I'm having issues getting property maps to work properly with my custom adjacency_list. Here's a snippet of the code:
// Definitions // define some of the properties the graphs will have // http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.htm... struct posx_t { typedef vertex_property_tag kind; }; struct posy_t { typedef vertex_property_tag kind; };
typedef property
VertexPosX; // chain to add in posy typedef property VertexPos; // chain to add in vertex_index typedef property VertexProperty; // define our special graph typedef adjacency_list
> AGraph; ...
template<class T> void boostToVAGraph(const AGraph & g, const int num_nodes, const int num_edges, T ** idata, T ** odata, unsigned int ** segment_descriptor, unsigned int ** cross_pointers, unsigned int ** head_flags, T ** reference, const testrigOptions & testOptions) { typedef AGraph Graph;
// define the manipulator for our special properties // http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.htm... // requires property_map.hpp // BROKEN!!!!! property_map
::type getposx = get(posx_t(), g); property_map ::type getposy = get(posy_t(), g); ...
I used another function to generate the AGraph and apply values. And using property map there seems to work. However, I then pass it to this function using:
boostToVAGraph(g, num_nodes, num_edges, idata, odata, segment_descriptor, cross_pointers, head_flags, reference, testOptions);
On compile, I get this error: 1>agraph.cpp 1>c:/Documents and Settings/All Users/Application Data/NVIDIA Corporation/NVIDIA GPU Computing SDK/C/src/test/agraph.cpp(94) : error C2440: 'initializing' : cannot convert from 'boost::adj_list_vertex_property_map
' to 'boost::adj_list_vertex_property_map ' 1> with 1> [ 1> Graph=AGraph, 1> ValueType=int, 1> Reference=const int &, 1> Tag=posx_t 1> ] 1> and 1> [ 1> Graph=AGraph, 1> ValueType=int, 1> Reference=int &, 1> Tag=posx_t 1> ] 1> No constructor could take the source type, or constructor overload resolution was ambiguous
The error seems to be that you are trying to convert from the const
property map type (because the graph in boostToVAGraph is const) to the
non-const one (property_map
Thanks. That fixed it.
-Trevin "<3" Murakami
On Sun, Feb 28, 2010 at 9:14 AM, Jeremiah Willcock
On Sat, 27 Feb 2010, Trevin Murakami wrote:
Hello all.
I'm having issues getting property maps to work properly with my custom adjacency_list. Here's a snippet of the code:
// Definitions // define some of the properties the graphs will have // http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.htm... struct posx_t { typedef vertex_property_tag kind; }; struct posy_t { typedef vertex_property_tag kind; };
typedef property
VertexPosX; // chain to add in posy typedef property VertexPos; // chain to add in vertex_index typedef property VertexProperty; // define our special graph typedef adjacency_list
> AGraph; ...
template<class T> void boostToVAGraph(const AGraph & g, const int num_nodes, const int num_edges, T ** idata, T ** odata, unsigned int ** segment_descriptor, unsigned int ** cross_pointers, unsigned int ** head_flags, T ** reference, const testrigOptions & testOptions) { typedef AGraph Graph;
// define the manipulator for our special properties // http://www.boost.org/doc/libs/1_42_0/libs/graph/doc/using_adjacency_list.htm... // requires property_map.hpp // BROKEN!!!!! property_map
::type getposx = get(posx_t(), g); property_map ::type getposy = get(posy_t(), g); ...
I used another function to generate the AGraph and apply values. And using property map there seems to work. However, I then pass it to this function using:
boostToVAGraph(g, num_nodes, num_edges, idata, odata, segment_descriptor, cross_pointers, head_flags, reference, testOptions);
On compile, I get this error: 1>agraph.cpp 1>c:/Documents and Settings/All Users/Application Data/NVIDIA Corporation/NVIDIA GPU Computing SDK/C/src/test/agraph.cpp(94) : error C2440: 'initializing' : cannot convert from 'boost::adj_list_vertex_property_map
' to 'boost::adj_list_vertex_property_map ' 1> with 1> [ 1> Graph=AGraph, 1> ValueType=int, 1> Reference=const int &, 1> Tag=posx_t 1> ] 1> and 1> [ 1> Graph=AGraph, 1> ValueType=int, 1> Reference=int &, 1> Tag=posx_t 1> ] 1> No constructor could take the source type, or constructor overload resolution was ambiguous The error seems to be that you are trying to convert from the const property map type (because the graph in boostToVAGraph is const) to the non-const one (property_map
::type). I believe you would want property_map ::const_type as the property map type in your function instead. -- Jeremiah Willcock _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Jeremiah Willcock
-
Trevin Murakami