Ben*_*Ben 5 c++ boost boost-graph
我正在使用捆绑属性和adjacency_list,并希望使用子图类.
struct Vertex
{
   int index;
   int seed;
}; 
struct Edge
{
 bool visted;
 double weight;
};
typedef adjacency_list<listS, listS, undirectedS, Vertex, property<edge_index_t,int,Edge> > Graph;
typedef subgraph<Graph> testSubgraph;
property<edge_index_t,int,Edge>需要该部分,因为子图需要edge_index_t比较两个边.
现在我的问题是如何在子图中使用捆绑属性添加Edge?在没有property<edge_index_t,int,Edge>我的正常图表中添加如下边缘:
Edge e;
vertex_descriptor u,v; 
// fill in u and v;
e.weight = 1.0;
e.visted=false;
add_edge(u,v,e,graph);
但这对Subgraph不起作用.
希望有人知道解决方案.
谢谢
本
邻接表没有edge_index:es。您需要自己分配一个索引,但这就像将 a 添加size_t index到Edge,并在创建边时分配索引一样简单。
您可能不需要为子图创建边,因为增强子图是诱导子图。因此,图中两个端点都在子图中的所有边都将包含在子图中。
| 归档时间: | 
 | 
| 查看次数: | 1744 次 | 
| 最近记录: |