Boost logo

Boost Users :

From: Stephen Torri (storri_at_[hidden])
Date: 2005-03-10 09:57:02


Here is my visitor after making the suggested changes. I am not sure
this does the job because I don't understand the following:

1) How is a custom visitor used as a replacement to depth_first_search?
The code for how to handle the coloring of the vertex nodes seems to be
handled by the depth_first_search algorithm and not the associated
visitor.

2) When is the operator() called?

Stephen

-------- CODE --------

  template <class VertexType, class Graph>
  class filter_visitor
    : public boost::base_visitor< filter_visitor<Visitor> >
  {
  private:
    typedef on_discover_vertex event_filter;

  public:
    
    filter_visitor (Graph const& g)
      : m_color (internal_map (num_vertices(g)))
    {}

    template <class Vertex, class Graph>
    void operator() (Vertex child_node, Graph& g)
    {
      
      Vertex parent_node = g[child_node].get_parent_node();

      typename graph_traits<Graph>::edge_descriptor e =
        edge(child_node, parent_node, g).first;
      
      g[child_node].send_message (g[parent_node].get_object(),
                                  g[e]);
    }
  private:
    ColorMap m_color;

  };


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net