First, you have not succeeded in giving your graph any properties,
either vertex or edge.
Something like this would do the trick for edge properties:
enum edge_Datum_t { edge_Datum };
namespace boost {
BOOST_INSTALL_PROPERTY(edge,Datum);
}
typedef std::pair
Hi everyone, I've got a fairly simple use for boost::graph, and I've been trying to get it working, but the documentation, whilst thorough, isn't being too helpful in getting me started.
What I'm trying to do, is build a graph of polygon mesh edges, which are simply pairs of unsigned ints. I need to find contiguous edge lists. Here's the setup code:
// setup graph typedef std::pair
Edge; typedef adjacency_list Graph; Graph g; // add an edge add_edge(6,7, g);
cout << "Total number of vertices: " << num_vertices(g) << endl;
Which then outputs that I have 8 vertices in my graph (0 through 7), instead of just the one I've added. So, it appears that the vertex list is automatically managed to be contiguous.
Should I instead be adding all my edges, not caring about their vertex index, and adding a per-vertex property to keep track of their associated polygon mesh vertex numbers?
If so, then I presume my code for adding the edges becomes something like (only psuedo-code here):
vertex_descriptor v1 = add_vertex(g); vertex_descriptor v2 = add_vertex(g); set_property(v1, MyIndexProperty, 6); set_property(v2, MyIndexProperty, 7); add_edge(v1,v2,g);
..instead of what I had:
add_edge(6,7, g);
Does that sound right?
In that case, is there a quick way of locating vertex_descriptor in a graph based on a vertex property? Something like:
find_vertex(g, MyIndexProperty, 6);
Sorry for all the lack of understanding, but it is quite a simple thing I'm wanting to use the library for, and I'm finding the documentation quite overwhelming. I suppose it is intended for when you're using the graphs in a much more complex scenario.
Thanks in advance for any tips.
AC.