[BGL] Bundled Properties and setS Edgelist container

I know that if I use a setS for the edgelist container for an adjacency_list class, each edge of my graph will only be added once as I build it. This functionality is very desirable for me, but I've found I can't seem to use it with the equally desirable Bundled Property Maps. Specifically, this line of code doesn't seem to work: (*g)[i].paper_id = atoi(row[0]); g is a pointer to my graph. The exact compiler error with g++ 4.1.1 is: error: invalid conversion from 'size_t' to 'void*' Is there anyway I can use these two features together? If not, I'm going to be very disappointed. If that's the case I'd advise making a large note of it in the bundled properties documentation as I wouldn't have bothered with bundled properties if I knew they carried this limitation. -- Sam Peterson peabody@freeshell.org peabodyenator@gmail.com

Hi Sam, On 8/28/07, Sam Peterson <peabodyenator@gmail.com> wrote:
An example would be very helpful, as the following compiles fine for me with boost 1.33.1 and g++ 4.1.2: Cheers, Stephan #include <iostream> #include <boost/graph/adjacency_list.hpp> struct Vertex{ }; struct Edge{ std::size_t paperid; }; int main() { using namespace boost; typedef adjacency_list<setS, vecS, directedS, Vertex, Edge, no_property, setS> Graph; typedef graph_traits<Graph>::edge_descriptor edge_descriptor; typedef graph_traits<Graph>::edge_iterator edge_iterator; Graph g; Graph* p_g = &g; std::pair<edge_descriptor, bool> p = add_edge(0,1, g); if(p.second){ g[p.first].paperid = 1; } else{ std::cout << "Could not insert edge" << std::endl; } edge_iterator it, end; for(tie(it, end) = edges(g); it != end; ++it){ std::cout << (*p_g)[*it].paperid <<std::endl; } return 0; }

On 8/28/07, Stephan Diederich <stephan.diederich@googlemail.com> wrote:
typedef adjacency_list<setS, vecS, directedS, Vertex, Edge,
-----------------------------------------------------, setS I think the issue only occurred when the edge list was changed to setS. You only did the vertex list. Jon

Hi Jon, On 8/28/07, Jonathan Franklin <franklin.jonathan@gmail.com> wrote:
Just rechecked, but I think I chose setS: (maybe bad formatting?) typedef adjacency_list<setS, vecS, directedS, Vertex, Edge,no_property, setS> Graph; Cheers, Stephan

On 8/28/07, Stephan Diederich <stephan.diederich@googlemail.com> wrote:
No, you chose setS for the vertex list, try this and see if it works for you: typedef adjacency_list<vecS, setS, directedS, Vertex> Graph; -- Sam Peterson peabody@freeshell.org peabodyenator@gmail.com

On 8/28/07, Sam Peterson <peabodyenator@gmail.com> wrote:
This is inconsistent IMO: template <class OutEdgeListS = vecS, // a Sequence or an AssociativeContainer class VertexListS = vecS, // a Sequence or a RandomAccessContainer class DirectedS = directedS, class VertexProperty = no_property, class EdgeProperty = no_property, class GraphProperty = no_property, class EdgeListS = listS> class adjacency_list Jon
participants (3)
-
Jonathan Franklin
-
Sam Peterson
-
Stephan Diederich