[Graph] float/double weights and brandes_betweenness_centrality
Hi, I wonder whether float/double weights may cause a bug in brandes_betweenness_centrality. In the brandes_dijkstra_visitor, in the case where edge is not relaxed, there is an equality check if (d_w == combine(d_v, w_e)) in order to find if there is equally-short path from v to w. If d_w, d_v, w_e are float/doubles, isn't there gonna be a problem with the "=="? Thanks Ioannis
On Jul 24, 2006, at 12:26 PM, Ioannis Filippis wrote:
Hi,
I wonder whether float/double weights may cause a bug in brandes_betweenness_centrality. In the brandes_dijkstra_visitor, in the case where edge is not relaxed, there is an equality check
if (d_w == combine(d_v, w_e))
in order to find if there is equally-short path from v to w. If d_w, d_v, w_e are float/doubles, isn't there gonna be a problem with the "=="?
Oh, yuck. Yes, this could be a problem. The right fix is probably to add a "equality_compare" function object parameter, that checks if the two values are "close enough." The user might need to tweak that value. Doug
participants (2)
-
Doug Gregor
-
Ioannis Filippis