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
c1c2aa9c
Commit
c1c2aa9c
authored
Sep 06, 2009
by
Tiago Peixoto
Browse files
Fix openmp bug in community_structure()
Call to random() must be protected by "omp critical".
parent
0ac9b1f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/community/graph_community.hh
View file @
c1c2aa9c
...
...
@@ -140,10 +140,15 @@ struct get_communities
size_t
k
=
out_degree_no_loops
(
v
,
g
);
double
curr_e
=
gamma
*
Nnnks
(
k
,
s
[
v
])
-
ns
[
s
[
v
]];
double
new_e
=
gamma
*
Nnnks
(
k
,
new_s
)
-
ns
[
new_s
];
double
new_e
=
gamma
*
Nnnks
(
k
,
new_s
)
-
ns
[
new_s
];
if
(
new_e
<
curr_e
||
random
()
<
exp
(
-
(
new_e
-
curr_e
)
/
T
))
double
r
;
{
#pragma omp critical
r
=
random
();
}
if
(
new_e
<
curr_e
||
r
<
exp
(
-
(
new_e
-
curr_e
)
/
T
))
{
temp_s
[
v
]
=
new_s
;
curr_e
=
new_e
;
...
...
Write
Preview
Supports
Markdown
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