Research Article

Energy Efficient Wireless Sensor Network Modelling Based on Complex Networks

Algorithm 2

Function of struct_property().
function struc_data = stuct_property(clust_point, num_categ, A, D)
% Work out value for individuals, adjacency matrix, distance matrix, give back the structure struc_data
% clust_point: cluster individuals of per line
% num_categ: numbers of cluster
% A: initial data adjacency matrix
% D: initial data distance matrix
% struc_data
nc = size(clust_point); % size
for i = 1 : num_categ
data(i).point = ; % individual of the cluster
data(i).center = ; % cluster center
data(i).A = ; % adjacency matrix of the cluster
data(i).D = ; % distance of the cluster
% cluster individuals
for j = 1 : nc(1, 2)
  if clust_point(i, j) ~= 0
   data(i).point = [data(i).point, clust_point(i, j)];
  end
end
% adjacency + distance
np = length(data(i).point);
for j = 1 : np
  for k = 1 : np
   data(i).A(j, k) = A(data(i).point(j), data(i).point(k));
   data(i).D(j, k) = D(data(i).point(j), data(i).point(k));
  end
end
% cluster center
sum_D = sum((data(i).D));
[sum_min_D, flag] = min(sum_D); % center with shortest path
data(i).center = data(i).point(flag);
end
struc_data = data;