Boost logo

Boost Users :

From: Ashwin N (ashwin.n_at_[hidden])
Date: 2008-07-24 22:14:46


Hi,

I'm trying to get a simple undirected_dfs example to work. The aim is
simple, to create an undirected graph and print its nodes in DFS
order.
Here's my code:

/////////////////////////////////////////////////////////////////////////////////////
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/undirected_dfs.hpp>
#include <iostream>
using namespace std;

typedef boost::adjacency_list<boost::listS, boost::vecS,
boost::undirectedS> MyGraph;
typedef boost::graph_traits<MyGraph>::vertex_descriptor MyVertex;
typedef boost::graph_traits<MyGraph>::edge_descriptor MyEdge;

class MyVisitor : public boost::default_dfs_visitor
{
public:
        void discover_vertex(MyVertex v, const MyGraph& g) const
        { cerr << v << endl; }
};

int main()
{
        MyGraph g;
        boost::add_edge(0, 1, g);
        boost::add_edge(0, 2, g);
        boost::add_edge(1, 3, g);

        MyVisitor vis;
        boost::undirected_dfs(g, boost::visitor(vis));

        return 0;
}
/////////////////////////////////////////////////////////////////////////////////////

I get the following errors which just make no sense to me:
/////////////////////////////////////////////////////////////////////////////////////
Error 1 error C2780: 'void boost::put(T Bundle::*
,boost::adjacency_list<OutEdgeListS,VertexListS,DirectedS,VertexProperty,EdgeProperty,GraphProperty,EdgeListS>
&,const Key &,const T &)' : expects 4 arguments - 3
provided d:\boost\boost\graph\undirected_dfs.hpp 149
Error 2 error C2780: 'void
boost::put(Property,boost::adj_list_helper<Config,Base> &,const Key
&,const Value &)' : expects 4 arguments - 3
provided d:\boost\boost\graph\undirected_dfs.hpp 149
Error 3 error C2784: 'void boost::put(const
boost::put_get_helper<Reference,PropertyMap> &,K,const V &)' : could
not deduce template argument for 'const
boost::put_get_helper<Reference,PropertyMap> &' from
'boost::detail::error_property_not_found' d:\boost\boost\graph\undirected_dfs.hpp 149
Error 4 error C2784: 'void boost::put(const
boost::writable_property_map_archetype<KeyArchetype,ValueArchetype>
&,const writable_property_map_archetype<KeyArchetype,ValueArchetype>::key_type
&,const writable_property_map_archetype<KeyArchetype,ValueArchetype>::value_type
&)' : could not deduce template argument for 'const
boost::writable_property_map_archetype<KeyArchetype,ValueArchetype> &'
from 'boost::detail::error_property_not_found' d:\boost\boost\graph\undirected_dfs.hpp 149
Error 5 error C2784: 'void put(T *,ptrdiff_t,const V &)' : could not
deduce template argument for 'T *' from
'boost::detail::error_property_not_found' d:\boost\boost\graph\undirected_dfs.hpp 149
/////////////////////////////////////////////////////////////////////////////////////

What am I doing wrong? How do I get to print nodes in DFS order? I'm
on VC++ 2008 Express Edition.

I have looked at the undirected_dfs example given here:
<http://www.boost.org/doc/libs/1_35_0/libs/graph/example/undirected_dfs.cpp>

That code seems to be trying to achieve something else.

TIA,
~ash

-- 
Groucho Marx  - "A hospital bed is a parked taxi with the meter running."

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