当前位置:网站首页>随机网络,无标度网络,小世界网络以及NS小世界的性能对比matlab仿真
随机网络,无标度网络,小世界网络以及NS小世界的性能对比matlab仿真
2022-06-30 06:39:00 【fpga和matlab】
1.软件版本
matlab2021a
2.系统实现过程
1.随机网络(random network)
网络的场景如下所示:

其性能指标如下:
下面,通过不同的攻击类型,来判断网络的鲁棒性,仿真结果如下所示:
clc;
clear;
close all;
warning off;
addpath 'func\'
rng(1);
%产生随机网络
%Num--顶点个数,Per--连接概率,avg_length--边的平均长度
Num = 100;
Per = 0.036;
avg_length = 100;
[matrix,x,y] = func_Random_network(Num,Per,avg_length);
figure;
plot(x,y,'r.','Markersize',18);
hold on;
for i=1:Num
for j=i+1:Num
if matrix(i,j)~=0
plot([x(i),x(j)],[y(i),y(j)],'b--','linewidth',1);
hold on;
end
end
end
hold off
%计算相应的指标
[Cc,Cc_avg] = func_Cluster_Coeff(matrix);
disp(['聚类系数为:',num2str(Cc_avg)]);
[Dds,Dds_avg,M,P_Dds]= func_Degree_Distribution(matrix);
disp(['平均度为:',num2str(Dds_avg)]);
[Lens,Lens_avg] = func_Path_Length(matrix);
disp(['平均路径长度为:',num2str(Lens_avg)]);
figure;
subplot(211);
bar([1:Num],Dds);
xlabel('节点编号');
ylabel('节点的度');
subplot(212);
bar([0:M],P_Dds,'r');
xlabel('节点的度');
ylabel('节点度的概率');
2.无标度网络 (scale-free network)

其性能指标如下:

下面,通过不同的攻击类型,来判断网络的鲁棒性,仿真结果如下所示:

clc;
clear;
close all;
warning off;
addpath 'func\'
rng(1);
%产生随机网络
%Num--顶点个数,Per--连接概率,avg_length--边的平均长度
Num = 100;
[matrix,x,y] = func_scalefree_network(Num);
figure;
plot(x,y,'r.','Markersize',18);
hold on;
for i=1:Num
for j=i+1:Num
if matrix(i,j)~=0
plot([x(i),x(j)],[y(i),y(j)],'b--','linewidth',1);
hold on;
end
end
end
hold off
%计算相应的指标
[Cc,Cc_avg] = func_Cluster_Coeff(matrix);
disp(['聚类系数为:',num2str(Cc_avg)]);
[Dds,Dds_avg,M,P_Dds]= func_Degree_Distribution(matrix);
disp(['平均度为:',num2str(Dds_avg)]);
[Lens,Lens_avg] = func_Path_Length(matrix);
disp(['平均路径长度为:',num2str(Lens_avg)]);
figure;
subplot(211);
bar([1:Num],Dds);
xlabel('节点编号');
ylabel('节点的度');
subplot(212);
bar([0:M],P_Dds,'r');
xlabel('节点的度');
ylabel('节点度的概率');
3.小世界 network

其性能指标如下:

下面,通过不同的攻击类型,来判断网络的鲁棒性,仿真结果如下所示:

clc;
clear;
close all;
warning off;
addpath 'func\'
rng(1);
%产生随机网络
%Num--顶点个数,Per--连接概率,avg_length--边的平均长度
Num = 100;
K = 3;
Per = 0.4;
[matrix,x,y] = func_WS_network(Num,K,Per);
figure;
plot(x,y,'r.','Markersize',18);
hold on;
for i=1:Num
for j=i+1:Num
if matrix(i,j)~=0
plot([x(i),x(j)],[y(i),y(j)],'b--','linewidth',1);
hold on;
end
end
end
hold off
%计算相应的指标
[Cc,Cc_avg] = func_Cluster_Coeff(matrix);
disp(['聚类系数为:',num2str(Cc_avg)]);
[Dds,Dds_avg,M,P_Dds]= func_Degree_Distribution(matrix);
disp(['平均度为:',num2str(Dds_avg)]);
[Lens,Lens_avg] = func_Path_Length(matrix);
disp(['平均路径长度为:',num2str(Lens_avg)]);
figure;
subplot(211);
bar([1:Num],Dds);
xlabel('节点编号');
ylabel('节点的度');
subplot(212);
bar([0:M],P_Dds,'r');
xlabel('节点的度');
ylabel('节点度的概率');
4.NS小世界 network

其性能指标如下:

下面,通过不同的攻击类型,来判断网络的鲁棒性,仿真结果如下所示:

clc;
clear;
close all;
warning off;
addpath 'func\'
rng(1);
%产生随机网络
%Num--顶点个数,Per--连接概率,avg_length--边的平均长度
Num = 100;
K = 2;
Per = 0.005;
[matrix,x,y] = func_NW_network(Num,K,Per);
figure;
plot(x,y,'r.','Markersize',18);
hold on;
for i=1:Num
for j=i+1:Num
if matrix(i,j)~=0
plot([x(i),x(j)],[y(i),y(j)],'b--','linewidth',1);
hold on;
end
end
end
hold off
%计算相应的指标
[Cc,Cc_avg] = func_Cluster_Coeff(matrix);
disp(['聚类系数为:',num2str(Cc_avg)]);
[Dds,Dds_avg,M,P_Dds]= func_Degree_Distribution(matrix);
disp(['平均度为:',num2str(Dds_avg)]);
[Lens,Lens_avg] = func_Path_Length(matrix);
disp(['平均路径长度为:',num2str(Lens_avg)]);
figure;
subplot(211);
bar([1:Num],Dds);
xlabel('节点编号');
ylabel('节点的度');
subplot(212);
bar([0:M],P_Dds,'r');
xlabel('节点的度');
ylabel('节点度的概率');
%A12-27边栏推荐
- Px4 control mode summary
- Pay attention to this live broadcast and learn about the path to achieve the dual carbon goal of the energy industry
- First experience of Galaxy Kirin
- Set in set (III)
- KEIL - 下载调试出现“TRACE HW not present”
- Verilog中case,casez,casex语句的用法
- Bat usage details 2
- 图解八股,真的太顶了
- 与MQTT的初定情缘
- Static routing job
猜你喜欢

New project folder based on PIO plug-in in vscode -- Interpretation

Gazebo installation, uninstall and upgrade
![[wechat applet: single or multiple styles, background color, rounded corners]](/img/01/0381915591b0d3c13afbba4d50952d.png)
[wechat applet: single or multiple styles, background color, rounded corners]

1.8 - 多级存储
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

从底层结构开始学习FPGA----RAM IP核及关键参数介绍

0基础转行软件测试,如何实现月薪9.5k+

Rhcsa day 3

KEIL - 下载调试出现“TRACE HW not present”

Principle: webmvcconfigurer and webmvcconfigurationsupport pit avoidance Guide
随机推荐
ini解析学习文档
Verilog中case,casez,casex语句的用法
Basic questions (I)
2020-10-06
图片。。。。。
Switch must be better than if Else fast
C # - C # process and convert pixeldata of CT images with fo DICOM
Thread safe solutions, communication between threads (classic examples of producers and consumers)
不忘初心,能偷懒就偷懒:C#操作Word文件
Picture.....
阿里云买的40G高效云盘挂载只有20G
My experience in functional testing for so many years
Connect to remote server
Fastapi learning Day2
1.6 - CPU组成
As function memo
KEIL - 下载调试出现“TRACE HW not present”
Gazebo installation, uninstall and upgrade
High performance distributed execution framework ray
C language final experiment report (student achievement management system) source code