What is the feature or improvement you would like to see?
The local_scan() function allows to compute statistics for vertex neighborhoods that are defined based on edge weights. However, it exposes this functionality through a boolean argument weighted. If set to TRUE, this will use edge weights if and only if the edges have a weight attribute. In (as far as I know) all other igraph functions that use edge weights, you can also provide a vector of edge weights, and do not need the weight attribute per se. I think it would be great if local_scan() also offered this flexibility. As far as I could find, setting the weights is all done in R code, and should be easy to update.
My proposal would be to keep the boolean weighted argument, for backward compatibility but also to not make weighted neighborhoods the default whenever the weight edge attribute is present. In addition, there would be a argument weights that whenever weighted = TRUE works the same as in all other igraph functions with this argument: if NULL (default), the weight edge attribute is used whenever present, but you can also provide a vector of edge weights. If weighted = FALSE, the weights argument is ignored. This is fully backward compatible. And similar behavior already exists e.g. in transitivity(), where the weights argument is ignored whenever the type argument is not set to weighted.
Or am I missing any obvious reason to not let user specify weights like this in local_scan()?
Use cases for the feature
More flexibility for weighted neighborhood statistics, and more compliant with other functions in igraph.
What is the feature or improvement you would like to see?
The
local_scan()function allows to compute statistics for vertex neighborhoods that are defined based on edge weights. However, it exposes this functionality through a boolean argumentweighted. If set to TRUE, this will use edge weights if and only if the edges have a weight attribute. In (as far as I know) all other igraph functions that use edge weights, you can also provide a vector of edge weights, and do not need the weight attribute per se. I think it would be great iflocal_scan()also offered this flexibility. As far as I could find, setting the weights is all done in R code, and should be easy to update.My proposal would be to keep the boolean
weightedargument, for backward compatibility but also to not make weighted neighborhoods the default whenever the weight edge attribute is present. In addition, there would be a argumentweightsthat wheneverweighted = TRUEworks the same as in all other igraph functions with this argument: if NULL (default), the weight edge attribute is used whenever present, but you can also provide a vector of edge weights. Ifweighted = FALSE, theweightsargument is ignored. This is fully backward compatible. And similar behavior already exists e.g. intransitivity(), where theweightsargument is ignored whenever thetypeargument is not set to weighted.Or am I missing any obvious reason to not let user specify weights like this in
local_scan()?Use cases for the feature
More flexibility for weighted neighborhood statistics, and more compliant with other functions in igraph.