function [N,NN,NC]=neighbors(C, center_positions, neighbor_region) %Extracts the Nearest Neighbors, 'N', Next Nearest Neighbors, 'NN', and the %number of common vertices shared amongst cells, NC, in a cellular array %'C'. Shared vertices and Neighbors are computed for cells whose 'center_positions' are within a %distance 'neighbor_region' of each other. % % N - (number of cells) x (number of cells) matrix, with 1 where i^th cell % is nearest neighbour of j^th cell % N - (number of cells) x (number of cells) matrix, with 1 where i^th cell % is nearest neighbour of j^th cell % NC - (number of cells) x (number of cells) matrix, with number of common vertices between i^th cell % and j^th cell in the (i,j) position, for nearest neighbor cells. % C - cell array referring to list of vertices comprising individual cells % center_positions - Positions of centers of individual cells % neighbor_region - distance between individual cells to be considered % neighbors % %For bugs, comments, etc. please contact Kapil Krishan : %kkrishan@uci.edu %www.physics.uci.edu/~foams %version: I x=center_positions(:,1);y=center_positions(:,2); %'NC' is a matrix indicating the number of common vertices between %cells NC=zeros(size(C,1),size(C,1)); for cell_no=1:size(C,1) cell_nbhd1=find(abs(x(cell_no)-x)