add nw:betweenness-centrality for links
Closed this issue · 3 comments
Currently nw:betweenness-centrality produces a betweenness centrality score for a given node in the network. It is also possible to calculate betweenness centrality for links - i.e. the proportion of shortest paths between pairs of nodes that pass through a given link.
I imagine this would be relatively simple to implement/extend from the existing version of nw:betweenness-centrality. Please excuse me if I am wrong.
Thanks
Although its not documented, this actually works already! As with node betweenness centrality, it reports the number of shortest paths rather than the proportion. For example:
observer> create-turtles 4 [ create-links-with turtles with [ who = [ who ] of myself + 1 ] ]
links> show nw:betweenness-centrality
(link 1 2): 4
(link 2 3): 3
(link 0 1): 3
There's an issue to add this to the documentation: #29.
Thanks for the request!
i donot know why betweenness-centrality is larger than 1, according the define [https://en.wikipedia.org/wiki/Betweenness_centrality] of it, I think it is less than 1
As that article says:
It is equal to the number of shortest paths from all vertices to all others that pass through that node.
That is, it's an actual count of numbers of paths. Now, you can normalize so that the number is between 0 and 1 with a method suggested in that article:
let min-betweenness min [ nw:betweenness-centrality ] of turtles
let max-betweenness max [ nw:betweenness-centrality ] of turtles
(nw:betweenness-centality - min-betweenness) / (max-betweenness - min-betweenness)