Could the functions eccentricity() and radius() be implemented for weighted graphs?

Could the functions eccentricity() and radius() be updated to support weighted graphs, similar to how distances() and diameter() do when passed the weights argument?

I know I can calculate eccentricity and radius for a weighted graph like this:

g <- sample_pa(1000, directed = FALSE)
E(g)$weight <- runif(ecount(g))
my_eccentricity <- apply(distances(g), 1, max)
my_radius <- min(my_eccentricity)

However, for consistency and usability, I think it would be better if eccentricity() and radius() accepted a weights argument like distances() and diameter() .

I have an unrelated note. The documentation for sample_gnm() currently has the same description as sample_gnp() . The sample_gnm() description should probably be updated to something like: “This model is very simple, a constant number of edges are randomly created out of all possible edges.”

igraph is designed as a C library that has interfaces to multiple high level languages, including R. The R interface has been lagging behind as we didn’t have any R experts on the igraph team, so it is still based on igraph 0.9 instead of the most recent igraph 0.10. Now there’s a new R team, and there’s an effort underway to upgrade the R interface. However, this is a huge amount of work and it’ll take a while to complete.

In fact, if you can spare the time to contribute, that will be very helpful. Simple documentation edits, making sure that the R docs and R functionality are in sync with the C library, as well as testing, is already very helpful.

Weighted eccentricity is already available in the C library, and I’ll add weighted radius as well today.

Please open a feature request in the R/igraph GitHub repo and ask for these features to be exposed once R/igraph is updated to use C/igraph 0.10. I would like you to do this so it’s clear that the request came from a user.

Thanks for pointing this out, I’ll fix this. As I said above, the R interface is still catching up, and there are many improvements that can/should be made to the documentation. If you can contribute on this front, that will be very much appreciated. Feel free to open PRs.

You can always use the C documentation as reference, which is generally more complete and more accurate. This is where I make improvements first, but propagating these improvements to the docs of all three official high-level interfaces is very time consuming and doesn’t always happen immediately.