calculate_conductance.m 625 Bytes
Newer Older
Raghvendra Mall's avatar
Raghvendra Mall committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function CC = calculate_conductance(filename,weighted,outputlabel)

network = load([filename,'.txt'],'-ascii');
if (weighted~=1)
    network = [network(:,1) network(:,2); network(:,2) network(:,1)];
else
    network = [network(:,1) network(:,2) network(:,3); network(:,2) network(:,1) network(:,3)];
end
%% Construct network
network = unique(network,'rows');
N_rows = length(network);

%% For unweighted or weighted network 
if (weighted ~= 1)
    adj_matrix = [network ones(N_rows,1)];
    A = spconvert(adj_matrix);
else
    A = spconvert(network);
end;

CC = cutcond(A,outputlabel);
clear A network adj_matrix outputlabel