Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Matlab-Programs-for-Nonlinear-Dynamics/clustercoef.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (26 sloc)
714 Bytes
This file contains 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
%function [cluscoef,eicoef,clus,ei] = clustercoef(node) | |
% cluscoef = average of 2E/k(k-1) | |
% eicoef = average number of shared edges | |
% clus = clustering of node | |
% ei = shared edges of node | |
function [cluscoef,eicoef,clus,ei] = clustercoef(node) | |
[Adjac,degree,Lap] = adjacency(node); | |
[dum,N] = size(Adjac); | |
for iloop = 1:N | |
temp = 0; | |
for rowloop = 1:N | |
for coloop = 1:N | |
temp = temp + 0.5*Adjac(iloop,rowloop)*Adjac(rowloop,coloop)*Adjac(coloop,iloop); | |
end | |
end | |
ei(iloop) = temp; | |
ki = node(iloop).numlink; | |
if ki > 1 | |
clus(iloop) = 2*ei(iloop)/ki/(ki-1); | |
else | |
clus(iloop) = 0; | |
end | |
end | |
cluscoef = mean(clus); | |
eicoef = mean(ei); | |
%keyboard | |