Commit 8848d6c7 authored by Tiago Peixoto's avatar Tiago Peixoto

Fix bug in absolute_trust()

Random salt should be protected with "omp critical", and edge sampler
should check for the case when all edges have zero probability, and
sample uniformly.
parent cdfc8b05
......@@ -78,7 +78,11 @@ struct get_absolute_trust
tr1::unordered_set<size_t> path_set;
tr1::uniform_int<size_t>
random_salt(0, numeric_limits<size_t>::max());
size_t salt = random_salt(rng);
size_t salt;
{
#pragma omp critical
salt = random_salt(rng);
}
for (size_t bias = 0; bias < 3; ++bias)
for (size_t iter = 0; iter < n_iter; ++iter)
......@@ -133,7 +137,7 @@ struct get_absolute_trust
{
// select edge according to its probability
typename graph_traits<Graph>::edge_descriptor e;
if (bias != 1)
if (!out_prob.empty() && out_prob.back() > 0)
{
typedef tr1::uniform_real<t_type> dist_t;
tr1::variate_generator<rng_t&, dist_t>
......
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