Graph and Network Algorithms - centrality.m

35 views (last 30 days)
Linford Briant
Linford Briant on 13 Jan 2017
Commented: Qiang on 3 Apr 2017
I have MATLAB 9.1.0.441655 (R2016b) and want to use some of the functions in the Graph and Network Algorithm section on the MathWorks website ( https://uk.mathworks.com/help/matlab/graph-and-network-algorithms.html ) - specifically "measuring node importance" with
centrality.m
This function says that it was introduced in R2016a. However, in my version of matlab there are no such functions, and I can't find anywhere on the internet whether this is because it is a specific package/toolbox that you have to download/buy.
Can someone let me know how I get this?
Thanks, L
  1 Comment
Qiang
Qiang on 3 Apr 2017
Has anyone ever used this built-in function? I'm using Matlab 2016a and it has this function. I tried using it to calculate betweenness centrality and it was so surprisingly FASTER than the classic algorithms I could find online (seconds versus tens of hours).
Can someone please explain why the Matlab built-in Centrality is so fast?
Thanks in advance,
Qiang

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 13 Jan 2017
What does this command return?
which -all centrality
It should show two versions of that function, one the centrality method for graph objects and the other the method for digraph objects. Note that because this is a method, you will need to call it on an object of one of those two classes. For instance this would work:
rng default
A = sprand(100, 100, 0.1);
G = digraph(A);
C = centrality(G, 'betweenness');
This would not, even though A is the adjacency matrix of the digraph object G.
C2 = centrality(A, 'betweenness');

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!