当前位置: 首页>>代码示例>>C++>>正文


C++ Graph::GetGraphIdDistributor方法代码示例

本文整理汇总了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);
        }
    }
开发者ID:starostinak,项目名称:ig_quast,代码行数:43,代码来源:concurrent_edge_algorithm.hpp


注:本文中的Graph::GetGraphIdDistributor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。