Boost logo

Boost Users :

From: Peter Aronsson (petar_at_[hidden])
Date: 2004-03-30 07:15:44


Hi. I am having a problem with depth_first_search.
The thing I do different is that I do not put any info in a property map
and I do not want to bother myself with colormaps etc.

The application code does:

Graph g;
pass2_visitor vis;

depth_first_search(g,boost::visitor(vis));

But I get a compilation error, saying that it can not find a suitable
operator+ in the property_map...
See attached files for complete example.

Grateful for all help!
(I am running from HEAD on sourceforge cvs )

Regards Peter Aronsson

-- 
 _________________________________________________________________
/ Peter Aronsson, Phd Student at PELAB (Programming Environments  \ 
| Laboratory ) Department for Computer & Information Science      | 
| Linköping University, Sweden                                    | 
|=================================================================|
| petar_at_[hidden] , phone +46 (0)13-28 1737 Room 3B:490          |
\_________________________________________________________________/

#include "tg.hpp"

int main() {

  TaskGraph g;
  
  pass2_visitor vis;

  depth_first_search(g,boost::visitor(vis));

}


#ifndef _TASKGRAPH_H
#define _TASKGRAPH_H

#include <boost/config.hpp>
#include <iostream> // for std::cout
#include <utility> // for std::pair
#include <algorithm> // for std::for_each
#include <boost/utility.hpp> // for boost::tie
#include <boost/graph/graph_traits.hpp> // for boost::graph_traits
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/adjacency_iterator.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/graph/depth_first_search.hpp>

//Task graph types
using namespace std;

using boost::tie;

struct vertex_execcost_t {
  typedef boost::vertex_property_tag kind;
};

struct vertex_unique_id_t {
  typedef boost::vertex_property_tag kind;
};

struct edge_result_set_t {
  typedef boost::edge_property_tag kind;
};

typedef boost::property<boost::vertex_name_t,string,
         boost::property<vertex_execcost_t,float,
          boost::property<vertex_unique_id_t, int >
>
> VertexProperty;
  
typedef boost::property<boost::edge_weight_t, int > EdgeProperty;
  
typedef boost::adjacency_list<boost::listS, boost::listS,
                              boost::bidirectionalS,
                       VertexProperty, EdgeProperty> TaskGraph;
  
  
typedef boost::graph_traits<TaskGraph>::vertex_descriptor VertexID;

class pass2_visitor : public boost::default_dfs_visitor {
public:
  pass2_visitor(/* initialize containers to store stuff in*/) { };
  template <typename Vertex, typename Graph>
  void discover_vertex(Vertex u, const Graph & g) const
  {
    // Do some stuff
  };
};
  
#endif


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