在 PBGL 中使用“make_distributed_property_map”

Using `make_distributed_property_map` in PBGL

我正在尝试为 P-BGL PageRank. However, the documentation 实例化 属性 映射已过时,因为签名已从

更改
template<typename Key, typename ProcessGroup, typename LocalPropertyMap>
distributed_property_map<ProcessGroup, LocalPropertyMap, Key>
make_distributed_property_map(const ProcessGroup& pg, LocalPropertyMap pmap);

template<typename Key, typename ProcessGroup, typename LocalPropertyMap,
         typename Reduce>
distributed_property_map<ProcessGroup, LocalPropertyMap, Key>
make_distributed_property_map(const ProcessGroup& pg, LocalPropertyMap pmap,
                              Reduce reduce);

template<typename ProcessGroup, typename GlobalMap, typename StorageMap>
inline distributed_property_map<ProcessGroup, GlobalMap, StorageMap>

template<typename ProcessGroup, typename GlobalMap, typename StorageMap,
         typename Reduce>
inline distributed_property_map<ProcessGroup, GlobalMap, StorageMap>
make_distributed_property_map(const ProcessGroup& pg, GlobalMap global,
                              StorageMap storage, Reduce reduce)

从 Boost 1.63 开始,我似乎无法实例化模板参数的正确模型。

这里是一个框架代码,其中指出了差距:

#include <boost/mpi.hpp>
#include <boost/graph/use_mpi.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/graph/erdos_renyi_generator.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/graph/page_rank.hpp>

int main(int argc, char * argv[])
{
    boost::mpi::environment  env(argc, argv);
    boost::mpi::communicator comm;

    typedef boost::adjacency_list<boost::vecS,
            boost::distributedS<boost::graph::distributed::mpi_process_group, boost::vecS>,
            boost::directedS,
            // ????
    > Graph;
    typedef boost::erdos_renyi_iterator<boost::minstd_rand, Graph> generator;
    typedef boost::parallel::distributed_property_map<boost::graph::distributed::mpi_process_group,
            // ????
    > PropertyMap;

    boost::minstd_rand gen;

    Graph g(generator(gen, 100, 0.05), generator(), 100);


    auto map = boost::parallel::make_distributed_property_map< // ????
            boost::graph::distributed::mpi_process_group,
            // ???
            >process_group(g), ???);

    boost::graph::page_rank(g, map);

    return 0;
}

非常感谢任何帮助,几乎没有可用的文档或示例。

graph_parallel/test/distributed_rmat_pagerank.cpp 中有一段未公布的测试代码示例完全符合我的要求:

typedef parallel::variant_distribution<mpi_process_group> Distribution;   Distribution distrib = parallel::block(pg, n);

typedef adjacency_list<vecS, 
        distributedS<mpi_process_group, vecS>,
        bidirectionalS> Graph;

Graph g(...);

page_rank(g, make_iterator_property_map(ranks.begin(), get(boost::vertex_index, g)),
            graph::n_iterations(iters), 0.85, n);

代码位于 https://github.com/boostorg/graph_parallel/blob/develop/test/distributed_rmat_pagerank.cpp