Commit 20fc25d0 authored by Tiago Peixoto's avatar Tiago Peixoto

* fix bug in graph/graph_extended_clustering.cc (error in BFS target management)

* fix bug in graph/graph_correlations_combined.cc (precision error when error is very small)


git-svn-id: https://svn.forked.de/graph-tool/trunk@40 d4600afd-f417-0410-95de-beed9576f240
parent 224bd568
......@@ -150,9 +150,14 @@ struct get_average_combined_degree_correlation
size_t N = count[iter->first];
iter->second.first /= N;
if (N > 1)
iter->second.second = sqrt((iter->second.second - N*iter->second.first*iter->second.first)/(N*(N-1)));
{
double err = (iter->second.second - N*iter->second.first*iter->second.first)/(N*(N-1));
iter->second.second = (err<0.0)?0.0:sqrt(err);
}
else
{
iter->second.second = 0.0;
}
}
}
DegreeSelector1& _deg1;
......
......@@ -121,7 +121,9 @@ struct get_extended_clustering
try
{
distance_map[*a] = 0;
bfs_max_depth_watcher<neighbour_set_t,InitializedPropertyMap<dmap_t> > watcher(targets, cmaps.size(), distance_map);
neighbour_set_t specific_targets = targets;
specific_targets.erase(*a);
bfs_max_depth_watcher<neighbour_set_t,InitializedPropertyMap<dmap_t> > watcher(specific_targets, cmaps.size(), distance_map);
breadth_first_visit(fg, *a, visitor(make_bfs_visitor(make_pair(record_distances(distance_map, boost::on_tree_edge()),watcher))).
color_map(color_map));
}
......
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