Repository navigation
Conversation
This was referenced Jul 20, 2012
Member
|
Superceded by #1555 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements the global reaching centrality measure (a measure of hierarchy), as described in ticket 712 in the networkx developer zone.
It includes unit tests as well.
There is one bit of code that should probably be handled more elegantly. The global reaching centrality, as originally defined, assumes that high edge weights mean high connection strength. At the same time, in the function we need to find the shortest paths between all pairs of nodes, where the shortest paths are the ones with the highest total edge weight. The shortest path finding algorithms implemented in NetworkX assume that edge weight is equivalent to path length, so the semantics are the opposite as in the case of global reaching centrality. For this reason, in the case of weighted networks, for every edge I create an attribute called "grc_lengths" which is used by Dijkstra's algorithm. This is problematic if the user happened to have already set an edge attribute called "grc_lengths"---that attribute vale will be changed (and then removed in the cleanup that takes place at the end).
We could solve this problem by working off a copy of the graph, on which we're allowed to trample on the user's edge attributes.