function conn= nmfconnectivity(cndx)
%
% Jean-Philippe Brunet
% Cancer Genomics 6/10/03
index=cndx';
m=size(index,2);



% compute m x m matrix which is 1 if samples are together, 0 elsewhere

% determine sample assignment by its largest metagene expresion value
% [y,index]=max(h,[],1); 

mat1=repmat(index,m,1); % spread index down
mat2=repmat(index',1,m); % spread index right

conn=mat1==mat2; 