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;