BGL:删除顶点

时间:2021-06-07 16:56:12

标签: c++ boost boost-graph

我正在使用

typedef boost::adjacency_matrix<boost::undirectedS, boost::no_property,boost::property<boost::edge_weight_t, int>> Graph;
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;

我正在尝试通过

从我的图表中删除一个顶点
int id = // Index that I associate the node with
boost::remove_vertex(Vertex(id),g);

但是,这会导致以下错误消息

void boost::remove_vertex(typename boost::adjacency_matrix<D, VP, EP, GP, A>::vertex_descriptor, boost::adjacency_matrix<D, VP, EP, GP, A>&) [with D = boost::undirectedS; 
VP = boost::no_property; EP = boost::property<boost::edge_weight_t, int>; GP = boost::no_property; A = std::allocator<bool>; 
typename boost::adjacency_matrix<D, VP, EP, GP, A>::vertex_descriptor = long unsigned int]: Assertion `false' failed.

有人可以向我解释一下这是什么意思吗?我怀疑我需要使用某种适当的索引;到目前为止,我只是使用值 0,1,...,n-1 来访问我的顶点。 id 的值肯定小于 num_vertices(g)

0 个答案:

没有答案
相关问题