Hello, dear programmers community.
I very need your help, in advance sorry for my bad english.
I try to get planar coords from my graph from function
chrobak_payne_straight_line_drawing
but it calls System.AccessViolationException at the 125 line of file chrobak_payne_drawing.hpp:
I give below my code:
Code:
//Initialize the interior edge index property_map<graph, edge_index_t>::type e_index = get(edge_index, bmTG);
graph_traits<graph>::edges_size_type edge_count = 0;
graph_traits<graph>::edge_iterator ei, ei_end;
for(tie(ei, ei_end) = edges(bmTG); ei != ei_end; ++ei)
put(e_index, *ei, edge_count++);
typedef std::vector< graph_traits<graph>::edge_descriptor > vec_t;
std::vector<vec_t> embedding2(num_vertices(bmTG));
embedding_storage_t embedding_storage(num_vertices(bmTG));
embedding_t embedding(embedding_storage.begin(), get(vertex_index,bmTG));
if(boyer_myrvold_planarity_test(boyer_myrvold_params::graph = bmTG,boyer_myrvold_params::embedding = &embedding2[0])) {
label1->Text = "Planar";
// Find a canonical ordering
typedef std::vector<graph_traits<graph>::vertex_descriptor>
ordering_storage_t;
ordering_storage_t ordering;
make_biconnected_planar(bmTG, &embedding2[0]);
make_maximal_planar(bmTG, &embedding2[0]);
planar_canonical_ordering(bmTG, &embedding2[0], std::back_inserter(ordering));
//Set up a property map to hold the mapping from vertices to coord_t's
typedef std::vector< coord_t > straight_line_drawing_storage_t;
typedef boost::iterator_property_map
< straight_line_drawing_storage_t::iterator,
property_map<graph, vertex_index_t>::type
>
straight_line_drawing_t;
straight_line_drawing_storage_t straight_line_drawing_storage
(num_vertices(bmTG));
straight_line_drawing_t straight_line_drawing
(straight_line_drawing_storage.begin(),
get(vertex_index,bmTG)
);
chrobak_payne_straight_line_drawing(bmTG,
embedding2,
ordering.begin(),
ordering.end(),
straight_line_drawing
);
graph_traits<graph>::vertex_iterator vi, vi_end;
for(tie(vi,vi_end) = vertices(bmTG); vi != vi_end; ++vi)
{
coord_t coord(get(straight_line_drawing,*vi));
this->gI->planarCoord(coord.x, coord.y, *vi);
}
this->gI->setState(PLPAINT);
this->gI->paintGraph();
}
else {
label1->Text = "Not planar";
}
Where bmTG - my Graph.
before using this code, I surely fill the graph..
Please help me with my problem, I am desperate and can not understand the reason for the critical error .. If you do not have too much trouble, give an example of code that will be 100% faithful gave the coordinates for the vertices of the graph, if it is planar, otherwise did not do anything that is not cause critical errors in any case.
I almost forgot, I'm using visual studio 2010
In advance, very big thanks!