boost::remove_vertex函数介绍及测试程序
在使用Boost库中的Graph库时,有时候我们需要对图进行一些操作,如添加或删除节点等。而boost::remove_vertex就是用来删除节点的一个便利函数。下面我将介绍该函数的用法,并提供一个测试程序供大家参考。
函数定义
该函数的定义如下:
template <class VertexListGraph, class Vertex>
inline void remove_vertex(Vertex v, VertexListGraph& g)
{
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept ));
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<
typename property_map<VertexListGraph, vertex_index_t>::const_type,
Vertex
> ));
typedef typename graph_traits::vertex_descriptor VertexDescriptor;
typedef typename std::vector VertexVector;
typedef typename property_map<VertexListGraph, vertex_index_t>::type VertexIndexMap;
VertexIndexMap index = get(vertex_index, g);
理解Boost Graph库的boost::remove_vertex函数
本文介绍了Boost库中的boost::remove_vertex函数,用于删除图中的节点。详细解释了函数的参数、实现原理,并提供了一个测试程序,展示了如何在实际中使用此函数删除图节点。
订阅专栏 解锁全文
152

被折叠的 条评论
为什么被折叠?



