This repository has been archived on 2021-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
NC/mp2/Project_2_Maggioni_Claudio/degcentrality.m

14 lines
No EOL
414 B
Matlab

function degcentrality(names, A)
counts = full(sum(A, 2));
ranks = sortrows([counts, (1:size(counts,1))'], 'descend');
for i = 1:size(ranks, 1)
fprintf("%14s %2d: ", names(ranks(i, 2)), ranks(i, 1)-1);
for j = 1:size(A, 2)
if ranks(i, 2) ~= j && A(ranks(i, 2), j) > 0
fprintf("%s, ", names(j));
end
end
fprintf("\n");
end
end