Hi folks,
I've written a program which makes use of the Boost Graph library to
construct a graph. I've then attached properties to both the vertices
and edges, giving a result like this:
http://www-users.york.ac.uk/~rl522/test.pdf
However, I want to now search the graph in order to do this:
1. When the edge is the last, i.e. the outdegree of the target is 0:
2. Total the edge values for all the edges followed to get here all
the way back to the root, and add 19.
3. If this total is the same value as the root node value, set a
particular property on each vertex those edges are connected to.
I've tried a depth_first_search using a Visitor. I wanted to push
each edge onto a temporary vector as I found it, and then pop it when
the algorithm backtracked, but this doesn't work. The aim here was to
know the path taken to get to a particular edge when that edge was
found. I'm completely new to using graphs (I'm actually a Biologist),
and I think I'm missing how I should really be using the
depth_first_search or breadth_first_search visitors to do what I need.
It also doesn't appear to like me using the visitor to alter the
properties on the vertices or edges during the search. Is this
allowed? I'm not altering the graph, just wanting to set a few
property values (internally stored, in this case).
I would be very grateful for any ideas or suggestions for approaching
this problem.
Many thanks,
Roger Leigh
PS. This is the visitor I wrote, but this appears to be completely
wrong. The full source is at
http://www-users.york.ac.uk/~rl522/massgraph-0.1.0.tar.gz
(ms_analysis.cc|h).
class peak_visitor : public boost::default_dfs_visitor
{
public:
peak_visitor(double target_mass,
ms_analysis::vertex_set& vs,
std::vector