I'm trying to implement a DFS visitor and using it with
undirected_dfs_visit, but I'm getting a segfault which relates to the
edge color map. I've made the following test app for illustration:
**************** START CODE ****************
#include <vector>
#include
#include
using namespace boost;
struct Types
{
typedef adjacency_list,
property > > GraphType;
typedef std::vector ColorVec;
typedef color_traits Color;
};
int main()
{
Types::GraphType g(6);
add_edge(0,1,g);
add_edge(1,2,g);
add_edge(2,3,g);
add_edge(2,4,g);
add_edge(4,5,g);
Types::ColorVec v_colors(num_vertices(g), Types::Color::white());
Types::ColorVec e_colors(num_edges(g), Types::Color::white());
default_dfs_visitor visitor;
undirected_depth_first_visit(g, 0, visitor,
make_iterator_property_map(&v_colors[0],
get(vertex_index, g)),
make_iterator_property_map(&e_colors[0],
get(edge_index, g)));
};
**************** END CODE ****************
The code crashes in undirected_dfs.hpp line 73 the first time it's
trying to access a color from the edge color map:
EColorValue uv_color = get(edge_color, *ei);
Valgrind turns up a lot of illegal reads/writes to the edge_color_map as
well, so I'm guessing that I've screwed up on the colormap creation.
Could anyone point out my error? Also, is this an error that could be
caught compile time by adding some sort of concept check?
Thanks in advance for any help!
Regards,
--
Tarjei