/
usr
/
include
/
boost
/
graph
/
distributed
/
/usr/include/boost/graph/distributed
mkdir
upload
Name
Size
Mode
Actions
adjlist/
-
0755
rm
detail/
-
0755
rm
adjacency_list.hpp
149777
0644
edit
dl
rm
betweenness_centrality.hpp
70132
0644
edit
dl
rm
boman_et_al_graph_coloring.hpp
12987
0644
edit
dl
rm
breadth_first_search.hpp
5209
0644
edit
dl
rm
compressed_sparse_row_graph.hpp
81805
0644
edit
dl
rm
concepts.hpp
7028
0644
edit
dl
rm
connected_components.hpp
28401
0644
edit
dl
rm
connected_components_parallel_search.hpp
15059
0644
edit
dl
rm
crauser_et_al_shortest_paths.hpp
25342
0644
edit
dl
rm
dehne_gotz_min_spanning_tree.hpp
38687
0644
edit
dl
rm
delta_stepping_shortest_paths.hpp
19415
0644
edit
dl
rm
depth_first_search.hpp
10437
0644
edit
dl
rm
dijkstra_shortest_paths.hpp
8719
0644
edit
dl
rm
distributed_graph_utility.hpp
4560
0644
edit
dl
rm
eager_dijkstra_shortest_paths.hpp
16294
0644
edit
dl
rm
filtered_graph.hpp
1943
0644
edit
dl
rm
fruchterman_reingold.hpp
12963
0644
edit
dl
rm
graphviz.hpp
8672
0644
edit
dl
rm
hohberg_biconnected_components.hpp
38093
0644
edit
dl
rm
local_subgraph.hpp
6057
0644
edit
dl
rm
mpi_process_group.hpp
26592
0644
edit
dl
rm
named_graph.hpp
48162
0644
edit
dl
rm
one_bit_color_map.hpp
4046
0644
edit
dl
rm
page_rank.hpp
8003
0644
edit
dl
rm
queue.hpp
10249
0644
edit
dl
rm
reverse_graph.hpp
1223
0644
edit
dl
rm
rmat_graph_generator.hpp
5913
0644
edit
dl
rm
selector.hpp
1375
0644
edit
dl
rm
shuffled_distribution.hpp
2833
0644
edit
dl
rm
strong_components.hpp
40396
0644
edit
dl
rm
st_connected.hpp
6158
0644
edit
dl
rm
two_bit_color_map.hpp
4041
0644
edit
dl
rm
unsafe_serialize.hpp
380
0644
edit
dl
rm
vertex_list_adaptor.hpp
16252
0644
edit
dl
rm
Edit:
/usr/include/boost/graph/distributed/rmat_graph_generator.hpp
(5913B)
// Copyright 2004, 2005 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Nick Edmonds // Andrew Lumsdaine #ifndef BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP #define BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" #endif #include <boost/assert.hpp> #include <boost/graph/parallel/algorithm.hpp> #include <boost/graph/parallel/process_group.hpp> #include <math.h> namespace boost { // Memory-scalable (amount of memory required will scale down // linearly as the number of processes increases) generator, which // requires an MPI process group. Run-time is slightly worse than // the unique rmat generator. Edge list generated is sorted and // unique. template<typename ProcessGroup, typename Distribution, typename RandomGenerator, typename Graph> class scalable_rmat_iterator { typedef typename graph_traits<Graph>::directed_category directed_category; typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; typedef typename graph_traits<Graph>::edges_size_type edges_size_type; public: typedef std::input_iterator_tag iterator_category; typedef std::pair<vertices_size_type, vertices_size_type> value_type; typedef const value_type& reference; typedef const value_type* pointer; typedef void difference_type; // No argument constructor, set to terminating condition scalable_rmat_iterator() : gen(), done(true) { } // Initialize for edge generation scalable_rmat_iterator(ProcessGroup pg, Distribution distrib, RandomGenerator& gen, vertices_size_type n, edges_size_type m, double a, double b, double c, double d, bool permute_vertices = true) : gen(), done(false) { BOOST_ASSERT(a + b + c + d == 1); int id = process_id(pg); this->gen.reset(new uniform_01<RandomGenerator>(gen)); std::vector<vertices_size_type> vertexPermutation; if (permute_vertices) generate_permutation_vector(gen, vertexPermutation, n); int SCALE = int(floor(log(double(n))/log(2.))); boost::uniform_01<RandomGenerator> prob(gen); std::map<value_type, bool> edge_map; edges_size_type generated = 0, local_edges = 0; do { edges_size_type tossed = 0; do { vertices_size_type u, v; boost::tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); if (permute_vertices) { u = vertexPermutation[u]; v = vertexPermutation[v]; } // Lowest vertex number always comes first (this // means we don't have to worry about i->j and j->i // being in the edge list) if (u > v && is_same<directed_category, undirected_tag>::value) std::swap(u, v); if (distrib(u) == id || distrib(v) == id) { if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { edge_map[std::make_pair(u, v)] = true; local_edges++; } else { tossed++; // special case - if both u and v are on same // proc, ++ twice, since we divide by two (to // cover the two process case) if (distrib(u) == id && distrib(v) == id) tossed++; } } generated++; } while (generated < m); tossed = all_reduce(pg, tossed, boost::parallel::sum<vertices_size_type>()); generated -= (tossed / 2); } while (generated < m); // NGE - Asking for more than n^2 edges will result in an infinite loop here // Asking for a value too close to n^2 edges may as well values.reserve(local_edges); typename std::map<value_type, bool>::reverse_iterator em_end = edge_map.rend(); for (typename std::map<value_type, bool>::reverse_iterator em_i = edge_map.rbegin(); em_i != em_end ; ++em_i) { values.push_back(em_i->first); } current = values.back(); values.pop_back(); } reference operator*() const { return current; } pointer operator->() const { return ¤t; } scalable_rmat_iterator& operator++() { if (!values.empty()) { current = values.back(); values.pop_back(); } else done = true; return *this; } scalable_rmat_iterator operator++(int) { scalable_rmat_iterator temp(*this); ++(*this); return temp; } bool operator==(const scalable_rmat_iterator& other) const { return values.empty() && other.values.empty() && done && other.done; } bool operator!=(const scalable_rmat_iterator& other) const { return !(*this == other); } private: // Parameters shared_ptr<uniform_01<RandomGenerator> > gen; // Internal data structures std::vector<value_type> values; value_type current; bool done; }; } // end namespace boost #endif // BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP
Save
cmd:
run