由于传统卷积神经网络CNN一般处理
欧式空间的
数据,但是有些非欧式空间的数据如社交网络,实体关系等都是拓扑空间,具备拓扑结构
,其基础理论是图,因此本文详细介绍图算法以及boost graph algorithm的应用
1.1 计算顶点数目
// Counting the number of vertices
#include <cassert>
#include <boost/graph/adjacency_list .hpp>
template <typename graph>
int get_n_vertices(const graph& g) {
const int n{
static_cast<int>(boost :: num_vertices(g))
};
assert (static_cast<unsigned == boost