我使用adjacency_list和子图适配器来创建我的图表类型 .
#include <boost/graph/subgraph.hpp>
#include <boost/graph/adjacency_list.hpp>
struct VertexProperties
{
bool bIsExpandable;
string sId;
string sCoord_X;
string sCoord_Y;
std::size_t order;
};
struct EdgeProperties
{
string sId;
bool bBidirectional;
};
//Graph properties
enum graph_index_t {graph_index=111};
namespace boost{
BOOST_INSTALL_PROPERTY(graph,index);
}
typedef boost::property<boost::vertex_index_t, std::size_t , VertexProperties> vertex_prop;
typedef boost::property<boost::edge_index_t, std::size_t , EdgeProperties> edge_prop;
typedef boost::property<graph_index_t, std::size_t> graph_prop;
typedef boost::adjacency_list<
boost::listS,
boost::vecS,
boost::bidirectionalS,
vertex_prop ,
edge_prop,
graph_prop>
Graph;
typedef boost::subgraph<Graph> Subgraph;
我正在使用顶点和边的捆绑属性 . 我已经尝试将捆绑属性提供给'graph',对于adjacency_list它工作正常但不能用于子图适配器,我发现它不受boost子图适配器的支持 . 所以我将graph_index_t添加到图表属性中,但我无法访问它 . 我已经编写了以下属性映射来访问它,但似乎它不是正确的方法 .
typedef property_map<Subgraph , graph_index_t>::type GraphIndexPropertyMap;
它在adjacency_list.hpp中给出错误
d:\boost_1_53_0\boost\graph\detail\adjacency_list.hpp:2543: error: forming reference to void
我检查了boost 1.53文档,但找不到与此相关的方法 .
所以我有两个问题:
1)如何获得graph_index属性的读写权限?
2)我可以以某种方式使用带有boost子图的'graph'的捆绑属性吗?
有人可以帮忙吗?
谢谢,
PRATIK
1 回答
以下是您的问题的解决方案,它使用捆绑属性和动态属性来考虑boost子图中的访问方法,如下所示: