Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/core/open_close_dbase_connection.php on line 0

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/clustering-for-wireless-networks/index.php(0) : eval()'d code on line 22

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/clustering-for-wireless-networks/index.php(0) : eval()'d code on line 35

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/get_ad_type_position.php on line 0

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/load_ads.php on line 0

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/sponsor_found.php on line 0

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/freehos1/public_html/projectus/scripts/load_links.php on line 0

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/clustering-for-wireless-networks/index.php(0) : eval()'d code on line 161

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/clustering-for-wireless-networks/index.php(0) : eval()'d code on line 164

Deprecated: Function split() is deprecated in /home/freehos1/public_html/projectus/clustering-for-wireless-networks/index.php(0) : eval()'d code on line 167
program fragments
projectus.freehost7.com:UG and PG level projects,mini projects and many more here ...



Program fragments

Small fragments of the program are presented as below. Nodes are createdby generating unique ID for each node. As nodes are randomly scattered over an area, their position is located by randomly generating x and y coordinates as shown in the program.

 

Node structure

%Node structure

%create global node;

node=struct('ID',-1,'state','','membership','','x_coord',-1,'y_coord',-1);

% initially all nodes are unclustered for i=1:no_of_nodes

node(i).state='unclustered';

end

% now randomly generate coordinates for nodes

% now we will populate the array

% with random numbers for coordinates

for i=1:no_of_nodes

x_coord_val=round(area_side*rand); % generated random x coordinate for the node node(i).x_coord=x_coord_val;

y_coord_val=round(area_side*rand); % generated random number for y coordinate node(i).y_coord=y_coord_val;

% also assign an ID for that node node(i).ID=i;

end

Structure of cluster

Similar to nodes unique ID is also generated for each cluster. The program fragment show how cluster created.

%============== Now we will define the cluster structures ==========

global cluster_id_global;

cluster_id_global=struct('clusterID','');

cluster=struct('clusterID','','clusterHead',-1,'cluster_members',-1);

% generate n number of clusters with unique IDs i.e. total n number of unique

cluster IDs will be generated

% ----following lines are required by the unique no () function global uniq_array;

uniq_array=zeros(1,no_of_nodes);

global p; global q; p=1; q=1;

% --------populate cluster ID global array --- 2000 clusters supported, so min 2000

nodes will be supported---------------- for i=1:no_of_nodes

temp=unique_no(3); % any argument passed--needed for compilation temp2=num2str(temp);

pp=strcat('clusterID',temp2); % generate unique cluster IDs %disp(pp); cluster_id_global(i).clusterID=pp; % populated the global cluster ID filed end;