提升子图和捆绑属性 [英] Boost Subgraph and Bundled properties

查看:85
本文介绍了提升子图和捆绑属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用捆绑的属性和adjacency_list,并且想使用子图类.

I'm using bundled properties and adjacency_list and would like to use the subgraph class.

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来比较两个边.

The property<edge_index_t,int,Edge> part is needed, as subgraph needs edge_index_t to compare two edges.

现在我的问题是如何使用子图中的捆绑属性添加Edge? 在没有property<edge_index_t,int,Edge>的普通图中,我添加一条边,如下所示:

Now my question is how do I add an Edge using bundled properties in a Subgraph? In the normal graph without property<edge_index_t,int,Edge> I add an edge as following:

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.

But this doesn't work for Subgraph.

希望有人知道解决方案.

Hope someone knows a solution for this.

谢谢

推荐答案

在尝试使用add_vertex()函数添加顶点时,我遇到了一个类似的问题,发现存在一个(很旧的)未解决的问题Boost Bugtracker:

I just ran into the a similar issue when trying to add a vertex with the add_vertex() function and found that there is a (very old) unresolved issue on the boost bugtracker:

门票#380:支持图形适配器中的捆绑属性:

图形适配器(例如子图形)不支持捆绑 属性,但它们应该.

The graph adaptors (such as subgraph) do not support bundled properties, but they should.


进一步的搜索导致以下两个补丁,这些补丁尚未合并,但似乎最终带来了对子图中捆绑属性的支持:


Further searching lead to the following 2 patches, which are not yet merged but appear to finally bring the support for bundled properties in subgraphs:

  • Ticket #10708: Property support in add_vertex() method for subgraph
  • Ticket #10709: Graph bundled property support in subgraph

所以我想答案是:现在,不要使用捆绑属性.但是将来,这个问题应该会消失.

So I guess the answer is: For now, don't use bundled properties. But in the future, the issue should disappear.

这篇关于提升子图和捆绑属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆