本文整理汇总了C++中graph::num_edges方法的典型用法代码示例。如果您正苦于以下问题:C++ graph::num_edges方法的具体用法?C++ graph::num_edges怎么用?C++ graph::num_edges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::num_edges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_from_graph
void create_from_graph(const graph<VertexData, EdgeData> &g,
const std::vector<vertex_id_type> &partids) {
clear();
size_t nv = g.num_vertices();
logger(LOG_WARNING, "storing vertices...");
#pragma omp parallel for
for (int i = 0;i < (int)nv; ++i) {
vertex_id_type vid = i;
size_t hashloc = (vid) % atoms.size();
//place vertices sequentially
uint16_t owner = partids[i] % atoms.size();
atoms[hashloc]->set_owner(vid, owner);
atoms[owner]->add_vertex(vid, owner, g.vertex_data(i));
atoms[owner]->set_color(vid, g.color(vid));
}
logger(LOG_WARNING, "storing edges...");
#pragma omp parallel for
for (int i = 0;i < (int)(g.num_edges()); ++i) {
vertex_id_type target = g.target(i);
vertex_id_type source = g.source(i);
uint16_t sourceowner = partids[source] % atoms.size();
uint16_t targetowner = partids[target] % atoms.size();
if (sourceowner != targetowner) atoms[sourceowner]->add_edge(source, sourceowner, target, targetowner);
atoms[targetowner]->add_edge(source, sourceowner, target, targetowner, g.edge_data(i));
}
numv.value = g.num_vertices();
nume.value = g.num_edges();
finalize();
}
示例2:
stats_t(graph& g):searchtree_nodes(0), searchtree_depth(0){
input_vertices = g.vertices.size();
input_edges = g.num_edges();
input_FES = get_FES(g);
}