Boost logo

Boost Users :

From: Trevor Bain (bainx028_at_[hidden])
Date: 2008-06-04 15:11:34


I have a Graph here:

*********************************
        //! value (i.e. voltage) of vertex
        struct value_t {
                typedef boost::vertex_property_tag kind;
        };
        typedef boost::property<value_t, float> Value;
        
        
        /*! Defining the graph type 'digraph'
        *
        * The listS and vecS types are selectors that determine the data
        * structure used inside the adjacency_list (listS has faster time
        * complexity whereas vecS has lower space complexity).
        *
        * The directedS type specifies that the graph should be singly
        * directed and (versus undirected, or bidirectionalS).
        */
        typedef boost::adjacency_list<
                boost::vecS, // EdgeList
                boost::vecS, // VertexList
                boost::directedS,
                Value,
                boost::property<boost::edge_weight_t, float>
> Digraph;
        
        Digraph net;
        
        int N;
        
        //! Edge description
        typedef std::pair<int, int> Edge;
        
        //! Vertex description
        typedef Digraph::vertex_descriptor Vertex;
        
        //! Property map to access value (voltage)
        boost::property_map<Digraph, value_t>::type value;
        
        //! Structure for creating BFSvisitor
        struct rand_val : public boost::base_visitor<rand_val> {
                  typedef boost::on_discover_vertex event_filter;
                  template <class Vertex, class Digraph>
                  void operator()(Vertex v, Digraph& G) {
                                boost::put(value, v, normal_sampler());
                  }
        };

*********************************

and I try to implement it here (in the Poly.cpp file)

*********************************
void Poly::propagate() {
        
        // The source vertex
        Vertex s = *(boost::vertices(net).first);
        
        // BFS needs to "color" the vertices.
        // using std::vector as exterior property storage.
        std::vector<boost::default_color_type> colors(N);
        
        // Breadth First Visit with appropiate visitor
        boost::breadth_first_visit(
                net,
                s,
                make_bfs_visitor(rand_val()),
                colors.begin()
        ); // i think either 'net' or 's' is broken (not correct models)
        
}

*********************************

when I compile I get the error:

Poly.cpp: In member function 'void Poly::propagate()':
Poly.cpp:61: error: no matching function for call to
'breadth_first_visit(boost::adjacency_list<boost::vecS, boost::vecS,
boost::directedS, boost::property<Poly::value_t, float,
boost::no_property>, boost::property<boost::edge_weight_t, float,
boost::no_property>, boost::no_property, boost::listS>&, size_t&,
boost::bfs_visitor<Poly::rand_val>,
__gnu_cxx::__normal_iterator<boost::default_color_type*,
std::vector<boost::default_color_type,
std::allocator<boost::default_color_type> > >)'
make: *** [Poly.o] Error 1

which means my arguments don't match the function arguments . . . but
I've been problem solving this for a while and I can't figure out
which ones don't match? I'm thinking it must be my graph but I meet
all of the stated requirements for the graph so I'm confused? Any help
would be greatly appreciated.

Here are the source files:
http://svn.reducis.org/polyneuron/src/Poly.cpp
http://svn.reducis.org/polyneuron/src/Poly.hpp

- Trevor


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