BGL Interior properties for implicit graph

二次信任 提交于 2019-12-11 10:06:24

问题


I'm trying to use the A* search from Boost BGL on an implicit graph. I have implemented my own graph type which models the concept of Graph and IncidenceGraph. According to the documentation of A*, I should be using the astar_search_no_init function with implicit graphs.

Just to get the whole thing working, I have tried to implement dummy versions of all of the needed concepts. This includes the graph, the visitor, the heuristic and the vertex type. My main function looks like this

int main()
{
   graph g;
   // The vertex type is a simple wrapper for int.
   vertex start(1);
   vertex goal(10);

   boost::astar_search_no_init(g, start, heuristic(), 
        boost::visitor(visitor(goal)));
}

Without specifying any of the named parameters, the implementation should be using some default values. Apparently these default values require some support from my graph. The graph looks like this:

struct graph
{
   typedef void adjacency_iterator;
   typedef void in_edge_iterator;
   typedef void vertex_iterator;
   typedef void edge_iterator;
   typedef void vertices_size_type;

   typedef void edge_iterator;
   typedef void edges_size_type;

   typedef vertex vertex_descriptor;
   typedef double edge_descriptor;
   typedef boost::directed_tag directed_category;
   typedef boost::disallow_parallel_edge_tag edge_parallel_category;
   typedef boost::incidence_graph_tag traversal_category;

   typedef std::vector<double>::iterator out_edge_iterator;
   typedef int degree_size_type;
};

When compiling, the first and the most interesting error is this:

error C2039: 'edge_property_type' : is not a member of 'graph'

From what I understand, I need to add properties for my graph. I believe these properties should be interior properties. My question is: how do I add interior properties for my own implicit graph type?

来源:https://stackoverflow.com/questions/8620613/bgl-interior-properties-for-implicit-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!