Commit 5c935bdd authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix problem with filtered graph in absolute_trust()

parent 1a3d219f
...@@ -119,6 +119,7 @@ struct get_absolute_trust ...@@ -119,6 +119,7 @@ struct get_absolute_trust
size_t bi = final_queue.bottom(); size_t bi = final_queue.bottom();
final_queue.pop_bottom(); final_queue.pop_bottom();
// do not augment if the path is the removed bottom
if (bi == pi) if (bi == pi)
continue; continue;
} }
...@@ -152,7 +153,8 @@ struct get_absolute_trust ...@@ -152,7 +153,8 @@ struct get_absolute_trust
get<0>(np).first *= c[*e]; get<0>(np).first *= c[*e];
} }
weight_sum[a] += get<0>(np).second; weight_sum[a] += get<0>(np).second;
t[v][a] += get<0>(np).second*get<0>(np).first; t[v][vertex_index[a]] +=
get<0>(np).second*get<0>(np).first;
get<1>(np).insert(a); get<1>(np).insert(a);
get<2>(np).push_back(*e); get<2>(np).push_back(*e);
......
...@@ -536,7 +536,8 @@ def absolute_trust(g, trust_map, source = None, vprop=None, n_paths=10000, ...@@ -536,7 +536,8 @@ def absolute_trust(g, trust_map, source = None, vprop=None, n_paths=10000,
g.pop_filter(reversed=True) g.pop_filter(reversed=True)
if source != -1: if source != -1:
vprop_temp.a = numpy.array(vprop[g.vertex(source)]) n = len(vprop[g.vertex(source)])
vprop_temp.a[:n] = numpy.array(vprop[g.vertex(source)])
vprop = vprop_temp vprop = vprop_temp
return vprop return vprop
......
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