Adding a vertex_index to listS graph on the fly for betweenness centrality

久未见 提交于 2019-12-01 15:15:46

As I stated in the update, it looks like the problem was in betweenness centrality. Digging through the dispatches in the source, and looking at the parameters in the docs I found that if vertex_index_map is not passed to the algorithm it defaults to get(vertex_index, g) which as we know does not exist in this particular graph.

After some time wrapping my head around named bgl_named_params, I figured out I could pass the v_index variable as a named parameter.

The following code did the trick:

brandes_betweenness_centrality(g,
            boost::centrality_map(v_centrality_map).edge_centrality_map(e_centrality_map).vertex_index_map(v_index));

I think the error was in the brandes_betweenness_centrality trying to call get(vertex_index,g)and failing on the listS graph.

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