Bundled properties with boyer_myrvold_planarity_test
Can't seem to get this working. I'm not sure if there was something I missed in the docs, but as soon as I use bundled properties boyer_myrvold_planarity_test falls over. void SomeClass::create() { typedef adjacency_list<listS, listS, undirectedS, property <vertex_index_t, int>, property <edge_index_t, int> > Graph; typedef graph_traits<Graph>::vertex_descriptor Vertex; typedef graph_traits<Graph>::edge_descriptor Edge; typedef graph_traits<Graph>::vertex_iterator VertexIterator; BOOST_CONCEPT_ASSERT ((boost::concepts::VertexAndEdgeListGraph<Graph>)); BOOST_CONCEPT_ASSERT ((boost::concepts::IncidenceGraph<Graph>)); //Create graph const int NUM_VERTICES = 5; Graph graph(NUM_VERTICES); //Create vertices and edges Vertex u, v; u = vertex(0, graph); v = vertex(4, graph); //add_edge(u, v, graph); //BAD line! //Other attempted/failed way of adding edges //Edge e; //e = edge(u, v, graph); //Another attempt, doesn't seem to work with //bundled props, unsurprisingly. //add_edge(0, 4, graph); cout << "Vertex and edge additions complete." << endl; //iterate through vertices VertexIterator vItr, vItrEnd; for (tie(vItr, vItrEnd) = vertices(graph); vItr != vItrEnd; ++vItr) { cout << "#"<< endl; //<< graph[*vItr] << endl; } cout << "Vertex iteration complete." << endl; if (boyer_myrvold_planarity_test(graph)) cout << "Test claims graph is planar" << endl; else cout << "Test claims graph is non-planar" << endl; cout << "Planarity testing complete." << endl; } The line commented "BAD line!" causes an exit on calling boyer_myrvold_planarity_test. With the test commented out, the program will run to its normal completion. What am I failing to grasp? TIA -Nick
On Sun, Dec 13, 2009 at 2:47 PM, Nick Wiggill <nick.wiggill@gmail.com> wrote:
Can't seem to get this working. I'm not sure if there was something I missed in the docs, but as soon as I use bundled properties boyer_myrvold_planarity_test falls over.
void SomeClass::create() { typedef adjacency_list<listS, listS, undirectedS, property <vertex_index_t, int>, property <edge_index_t, int> > Graph;
<snip> Hi Nick, It looks like you're not initializing the vertex index map in your graph. This is a common point of confusion, since choosing vecS for the vertex storage gives you an initialized vertex index map automatically (the indices from the underlying vector can be used as indices for the index map) but using anything else, like listS, requires you to manually populate the index map. Read http://www.boost.org/doc/libs/1_41_0/libs/graph/doc/faq.html, #5 for more detail and some sample code showing how to do this. Regards, Aaron
Aaron -- Many thanks!! BR, Nick On Dec 13, 9:01 pm, Aaron Windsor <aaron.wind...@gmail.com> wrote:
On Sun, Dec 13, 2009 at 2:47 PM, Nick Wiggill <nick.wigg...@gmail.com> wrote:
Can't seem to get this working. I'm not sure if there was something I missed in the docs, but as soon as I use bundled properties boyer_myrvold_planarity_test falls over.
void SomeClass::create() { typedef adjacency_list<listS, listS, undirectedS, property <vertex_index_t, int>, property <edge_index_t, int> > Graph;
<snip>
Hi Nick,
It looks like you're not initializing the vertex index map in your graph. This is a common point of confusion, since choosing vecS for the vertex storage gives you an initialized vertex index map automatically (the indices from the underlying vector can be used as indices for the index map) but using anything else, like listS, requires you to manually populate the index map. Readhttp://www.boost.org/doc/libs/1_41_0/libs/graph/doc/faq.html, #5 for more detail and some sample code showing how to do this.
Regards, Aaron _______________________________________________ Boost-users mailing list Boost-us...@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Aaron Windsor
-
Nick Wiggill