本文整理汇总了C++中Graph::GetGraphIdDistributor方法的典型用法代码示例。如果您正苦于以下问题:C++ Graph::GetGraphIdDistributor方法的具体用法?C++ Graph::GetGraphIdDistributor怎么用?C++ Graph::GetGraphIdDistributor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::GetGraphIdDistributor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glued_vertex_graph
ConcurrentEdgeAlgorithm(const size_t nthreads, Graph& graph, FactoryPtr factory)
: nthreads_(nthreads), graph_(graph), factory_(factory) {
TRACE("Run in " << nthreads_ << " threads")
GluedVertexGraph glued_vertex_graph (graph);
DevisibleTree<GluedVertexGraph> tree (glued_vertex_graph);
const size_t component_size = tree.GetSize() / nthreads;
for (size_t thread = 0; thread < nthreads_; ++thread) {
vector<VertexId> vertices;
if (thread == nthreads_ - 1) {
tree.SeparateVertices(vertices, tree.GetSize());
} else {
tree.SeparateVertices(vertices, component_size);
}
size_t actual_size = vertices.size();
for (size_t i = 0; i < actual_size; ++i) {
vertices.push_back(graph.conjugate(vertices[i]));
}
ComponentPtr ptr (
new ConjugateComponent(
graph,
restricted::PeriodicIdDistributor(graph.GetGraphIdDistributor(),
graph.GetGraphIdDistributor()->GetId(),
nthreads
),
vertices.begin(),
vertices.end()
)
);
components_.push_back(ptr);
}
for (size_t i = 0; i < nthreads_; ++i) {
RunnerPtr ptr (new Runner(*components_[i], factory->CreateAlgorithm(*components_[i])));
runners_.push_back(ptr);
}
}