Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closeness_centrality uses 'distance' keyword, instead of weight: #860

Closed
FedericoV opened this issue Mar 28, 2013 · 3 comments
Closed

Closeness_centrality uses 'distance' keyword, instead of weight: #860

FedericoV opened this issue Mar 28, 2013 · 3 comments
Assignees
Milestone

Comments

@FedericoV
Copy link

To conform with the rest of the networkx API, closeness_centrality should use the weight parameter to specify which edge attribute should be use to calculate the shortest path length, it shouldn't use distance.

http://networkx.github.com/documentation/latest/reference/generated/networkx.algorithms.centrality.closeness_centrality.html?highlight=closeness_centrality#networkx.algorithms.centrality.closeness_centrality

@hagberg
Copy link
Member

hagberg commented Jun 6, 2013

I believe we did it that way on purpose since in this case higher-weight (longer distance) leads to lower centrality and we thought it would be less confusing. In some cases you might e.g. want something like distance = 1/weight.

@ghost ghost assigned hagberg Jul 19, 2013
@hagberg hagberg closed this as completed Jul 19, 2013
@ramirogalvez
Copy link

I believe we did it that way on purpose since in this case higher-weight (longer distance) leads to lower centrality and we thought it would be less confusing. In some cases you might e.g. want something like distance = 1/weight.

Hagberg, one question. Isn't this the exact case for betweeness centrality? However, in that case the name of the parameter is "weight" and not "distance". Or maybe I am not understanding correctly. Is it the case that in both cases (betweeness and closeness) the weights capture distances (something that one wants to minimize), or this is the case only for closeness?

@CandyZyy
Copy link

So exciting that someone meets the same question with me! How do you deal with the betweeness centrality now? Can we just use 1/weight=distance or just use weight directly? I prefer the first one that is consistent with closeness centrality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants