12 Oct
2012
12 Oct
'12
4:41 p.m.
On Fri, 12 Oct 2012, eric wrote:
I am trying to iterate over my labeled_graph like so:
struct Vertex { std::string vertType; }; typedef Graph::vertex_iterator VertexIter; VertexIter vertexIter, vertexEnd; for (tie(vertexIter, vertexEnd) = vertices(graph); vertexIter != vertexEnd; vertexIter++) { std::string vertexType = graph[*vertexIter].vertType; }
However, I get a compiler error saying that graph has no operator [] that accepts an unsigned int. How should I be doing what I'm trying to do?
The easiest is probably to use graph.graph()[*vertexIter]. That gets the underlying graph then indexes that using the vertex. -- Jeremiah Willcock