Is it possible to write the code for graph traversal in C++ rather than using
the Python wrappers? I need the graph search to be as fast as possible.
I tried something simple like this: http://pastebin.com/m2pwFQKy
It looks like the typedefs for 'graph_graph_t' don't appear until after the
support code: http://pastebin.com/itT73DxT
Is there an example of how to achieve something similar?
Thanks Tiago Peixoto for developing/maintaining this great library!
Yes, this is possible. The idea is that the *_graph_t types will be
different, depending if your graph is directed, undirected, filtered,
reversed, etc. So it is not defined (typedef'd) before the type of your
graph known. This _could_ be pushed before the support code comes, I
suppose, but the way I use it is to define everything in the support
code as templates, so the actual type gets picked up automatically.
Something like:
class MyVisitor : public boost::default_dfs_visitor
{
public:
template <class Vertex, class Graph>
void discover_vertex(Vertex v, Graph& g)
{
std::cout << v << std::endl;
return;
}
};