Skip to content

Instantly share code, notes, and snippets.

@wanirepo
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wanirepo/4181a1dba5ab025cb060 to your computer and use it in GitHub Desktop.
Save wanirepo/4181a1dba5ab025cb060 to your computer and use it in GitHub Desktop.
Network analysis PS#1 6a, 6b
datdir = '/Users/clinpsywoo/Documents/2011-2016yr/2014-2015(4th_GS)/Network_modeling/Problem_sets/FB100 dataset/facebook100';
datfiles = filenames(fullfile(datdir, '*mat'), 'absolute');
for i = 1:numel(datfiles)
fprintf('\nWorking on %02d/%02d...\t', i, numel(datfiles));
tic;
load(datfiles{i});
% number of vertex
n = length(A);
% mean degree <ku>
mean_ku(i) = sum(sum(A,2))/n;
% mean degree <kv>
mean_kv(i) = sum((A * sum(A,2))./(sum(A,1)'))/n;
% network level MNDs - two ways
Network_MND1(i) = sum(sum(A,2).^2)/sum(sum(A,2));
Network_MND2(i) = sum(A * sum(A,2))/sum(sum(A));
t = toc;
fprintf('Done in %04dmin %02dsec.\n', floor(t/60),rem(t,60));
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment