Commit 8eef438b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

graph_distance_sampled.hh: improve performance

parent 0c92adbd
......@@ -149,12 +149,14 @@ struct get_sampled_distance_histogram
DistanceMap dist_map, no_weightS) const
{
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
typedef gt_hash_map<vertex_t,default_color_type,
DescriptorHash<VertexIndex> > cmap_t;
cmap_t cmap(0, DescriptorHash<VertexIndex>(vertex_index));
InitializedPropertyMap<cmap_t>
color_map(cmap, color_traits<default_color_type>::white());
typedef typename vprop_map_t<default_color_type>::type::unchecked_t vmap_t;
vmap_t color_map(vertex_index, num_vertices(g));
parallel_vertex_loop
(g,
[&](auto v)
{
color_map[v] = color_traits<default_color_type>::white();
});
breadth_first_visit(g, s,
visitor(make_bfs_visitor
(record_distances(dist_map,
......
......@@ -38,14 +38,13 @@ struct do_all_pairs_search
typedef typename property_traits<DistMap>::value_type::value_type
dist_t;
int i, N = num_vertices(g);
#pragma omp parallel for default(shared) private(i) schedule(runtime)\
if (N > 100)
for (i = 0; i < N; ++i)
{
dist_map[i].clear();
dist_map[i].resize(num_vertices(g), 0);
}
parallel_vertex_loop
(g,
[&](auto& v)
{
dist_map[v].clear();
dist_map[v].resize(num_vertices(g), 0);
});
if (dense)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment