I have a graph that I am having difficulty making a graph visitor. I
thought a breadth first visitor would do but there is a issue of order.
I cannot guarantee what the order of visits to all the vertices will be
on a graph. My graph that I am testing against is a directed graph of
Component objects. Each Component requires input from the parent
Component objects in the graph. For example,
(Graph)
C1
|
------------------
| | | |
C20 C30 C40 |
| | | |
-------------------
|
C5
(Table of inputs)
C1 C20 C30 C40 C5
C1
C20 x
C30 x
C40 x
C5 x x x x x
I thought a breadth first search visitor would work. The behavior I was
expecting was visits in the following order: C1, C20, C30, C40, Cc5.
What I found was that I had C1, C40 and then C5. My program will abort
at that point that c5 is visited since it is missing inputs from C20 and
C30. When I take away calls to my code in the visitor and include just a
simple "Hey I am at Component X" message I get the order I suspect.
My graph is defined as:
typedef property< vertex_index_t,
uint32_t,
property< vertex_name_t,
boost::shared_ptr<Component> > >
VertexProperty_t;
typedef adjacency_list