【发布时间】:2021-12-26 17:59:04
【问题描述】:
我在 boost 中的示例 geometry/07_a_graph_route_example 之后对我的图进行建模。
我的图表如下所示:
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, gG_vertex_property<string, double, pointClass>, gG_edge_property<listClass, pointClass>> graph_type;
graph_type Graph;
将gG_vertex_property 和gG_edge_property 作为自定义属性。
现在每次我尝试用 dijkstra_shortest_path 拨打电话
boost::dijkstra_shortest_paths(Graph, endVert, // Graph Object, End of Search Object
&predecessors[0], &costs[0], // Vectors to store predecessors and costs
boost::get(boost::edge_weight, Graph),
boost::get(boost::vertex_index, Graph), // Vertex Index Map
std::less<double>(), std::plus<double>(), // Cost calculating operators
(std::numeric_limits<double>::max)(), double(), // limits
boost::dijkstra_visitor<boost::null_visitor>()); // Visitior, does nothing at the moment
我得到的 WeightMap:
错误:没有匹配函数调用'get' boost::get(boost::edge_weight, Graph)
还有很多不适合我用例的 add 模板。我如何阅读文档,这是执行此操作的标准方法。我的属性是否缺少某些内容?
我做错了什么?
感谢您的帮助。
【问题讨论】:
-
你的
gG_vertex_property好像有问题,所以需要minimal reproducible example。 -
我正在看这个空间,但仍然没有代码详细信息?您要添加这些,还是我们应该关闭问题?
标签: c++ boost boost-graph