python-igraph icon indicating copy to clipboard operation
python-igraph copied to clipboard

added support for weighted average_path_length

Open FdeFabricio opened this issue 7 years ago • 2 comments

The same way we can provide weights for the diameter, it would be a good idea to have a weighted average_path_length

FdeFabricio avatar Jul 08 '18 16:07 FdeFabricio

The underlying C library does not provide a weighted average path length function, only an unweighted one. (The diameter function exists in both variants: igraph_diameter() and igraph_diameter_dijkstra()). The only way to get around it at the moment would be to calculate the full path length matrix and then do the averaging in the Python layer.

ntamas avatar Jul 09 '18 07:07 ntamas

@ntamas This is now implemented in the 0.9-series C core as igraph_average_path_length_dijkstra(), but it's not exposed in Python yet for some reason.

Also, the current docs are now wrong when they say,

Otherwise for all unconnected vertex pairs, a path length equal to the number of vertices is used.

Adding to 0.9.9 milestone, if that's okay.

szhorvat avatar Dec 13 '21 15:12 szhorvat

Implemented in 562c05f

ntamas avatar Sep 11 '22 13:09 ntamas