
clear;clc

cd /home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted

files=dir('fixnormed*.txt');


clustering_coefficient_nodal(1:10,1:length(files))=zeros;
characteristic_path_length_nodal(1:10,1:length(files))=zeros;
Eloc_nodal(1:10,1:length(files))=zeros;


for l=1:length(files)
    
    connection_matrix(1:90,1:90)=zeros;
    files(l).name
    temp1=load(files(l).name);
    connection_matrix(1:90,1:90)=temp1;
    W_fix=weight_conversion(connection_matrix,'autofix');
    connection_matrix=weight_conversion(W_fix, 'normalize');
    clear temp1; clear W_fix;

   chk=1;
for threshold = 0.01:0.01:1 %0.0279:0.0029:0.054
    
    temp2=connection_matrix;
    temp2(temp2>threshold)=0;
    thresholded_connection_matrix=temp2;
    
    clear temp2;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % nodal clustering coefficient

  clustering_coefficient_nodal(chk,l)=clustering_coef_wu(thresholded_connection_matrix);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % characteristic path length 

   L=1./thresholded_connection_matrix;
   L(L==Inf)=0;
   D=mean(distance_wei(L));
   characteristic_path_length(chk,l)=charpath(D);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % Nodal local efficiency and local efficiency
   
   Eloc_nodal(chk,l) = efficiency_wei(thresholded_connection_matrix,1);
   chk=chk+1;


end 
clear chk; clear connection_matrix;
end

save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted/kden_network.txt','kden','-ascii')
save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted/ClusCoeff_network.txt','clustering_coefficient','-ascii')
save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted/CharPathLength_network.txt''characteristic_path_length','-ascii')
save('/home/subhadip/Autism_AnatNet/austistic_study/Diffusion_Analysis/90_regions/adj_matrixes/Connectivity_Probability_weighted/Eglob_network.txt','Eglob','-ascii')

