%%%%%%%% % % n = 1000 % % base case: straight connectivity. %%%%%%% rad = .010:.005:.100; times = 1000; n = 1000; GComp = [3.566000 3.877000 4.744000 7.694000 13.370000 25.741000 63.934000 ... 235.006000 780.282000 970.566000 993.315000 998.093000 ... 999.372000 999.775000 999.929000 999.973000 999.992000 ... 999.996000 999.998000 ]; connCtr = [ 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.001000 0.075000 0.447000 0.745000 ... 0.885000 0.962000 0.981000 0.993000 0.998000 0.999000 ... 1.000000 1.000000 1.000000 0.998000 ]; rr = sqrt( log(1000) / (1000* pi)) figure(1) plot(rad,connCtr, 'x-.') hold on plot([rr rr], [ 0 1]) grid on xlabel('r: Communication Radius') ylabel('P_c: Probability of Connectivity') figure(2) plot(rad,GComp/n, '^--') hold on plot([rr rr], [ 0 1]) grid on axis([0.01 .1 0.0 1.0]) xlabel('r: Communication Radius') ylabel('Average fraction of the nodes in the giant component') %%%%%%%%%%%%%%%%% % % effect of an attack on the network... how much more rad does it take % to get to reach connectivity % % p = .8 % % %%%%%%%%%%%%%%%%%%% times = 100; n = 1000;p = 0.800000; rad = [0.0100 0.0150 0.0200 0.0250 0.0300 0.0350 0.0400 0.0450 0.0500 0.0550 0.0600 0.0650 0.0700 0.0750 0.0800 0.0850 0.0900 0.0950 0.1000 ]; connCtr8 = [0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.010000 0.050000 0.430000 0.700000 0.870000 0.910000 0.980000 0.990000 0.990000 1.000000 1.000000 1.000000 ]; GComp8 = [4.030000 6.300000 10.140000 17.400000 33.790000 78.340000 261.310000 634.610000 771.990000 796.710000 802.540000 802.370000 802.500000 803.440000 803.190000 804.880000 805.780000 805.370000 804.600000 ]; rr8 = sqrt( log(1000) / (1000* .8*pi)) figure(3) plot(rad,connCtr8, 'x-.') hold on plot([rr8 rr8], [ 0 1]) grid on xlabel('r: Communication Radius') ylabel('P_c: Probability of Connectivity') figure(4) plot(rad,GComp8/(.8*n), '^--') hold on plot([rr8 rr8], [ 0 1]) grid on axis([0.01 .1 0.0 1.0]) xlabel('r: Communication Radius') ylabel('Average fraction of the nodes in the giant component') %%%%%%%%%%%%%%% % % effect of an attack on the network... how much more rad does it take % to get to reach connectivity % % p_s = .8 % sensor failure. % %%%%%%%%%%%%%%%%% connCtr8s = [ 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.070000 0.370000 0.700000 0.890000 0.900000 0.970000 0.980000 1.000000 1.000000 1.000000 1.000000 ]; %% Connectivity with 20% Compromised figure(5) plot(rad,connCtr, 'x-.') hold on plot([rr rr], [ 0 1]) plot(rad,connCtr8, 'rx-.') plot([rr8 rr8], [ 0 1], 'r') grid on xlabel('r: Communication Radius') ylabel('P_c: Probability of Connectivity') %% 20% comped, with 800nodes figure(6) plot(rad,connCtr8s, 'x-.') hold on plot(rad,connCtr8, 'rx-.') grid on xlabel('r: Communication Radius') ylabel('P_c: Probability of Connectivity')