Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
8eef438b
Commit
8eef438b
authored
Apr 12, 2016
by
Tiago Peixoto
Browse files
graph_distance_sampled.hh: improve performance
parent
0c92adbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph/stats/graph_distance_sampled.hh
View file @
8eef438b
...
...
@@ -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
,
...
...
src/graph/topology/graph_all_distances.cc
View file @
8eef438b
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment