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
#include
#include <iostream>
using namespace std;
typedef boost::adjacency_list 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
&,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 &,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 &,K,const V &)' : could
not deduce template argument for 'const
boost::put_get_helper &' 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
&,const writable_property_map_archetype::key_type
&,const writable_property_map_archetype::value_type
&)' : could not deduce template argument for 'const
boost::writable_property_map_archetype &'
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."