フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can I track the total number of node infections from a set of random seed nodes each? I tried using the v = bfsearch(G,s) command but I got an error report: Error using search (line 27) Starting node must specify one node.

2 ビュー (過去 30 日間)
Chinenye Ezeh
Chinenye Ezeh 2018 年 1 月 30 日
閉鎖済み: Chinenye Ezeh 2018 年 3 月 12 日
clear all
load('nodenetwork.mat');
network = A;
N=size(network,1);
beta=0.12;
gama=0.3;
deadline=20;
flag=zeros(1,N);
bnet=graph(network);
k=randperm(N);
randnodes=randsample(k,4);
flag(randnodes)=1;
for i=1:N
if flag(i)==1
%infect its neighbor
neighbor=find(network(i,:)==1);
for j=1:length(neighbor)
pinf=rand();
if (pinf>=beta)&&(flag(neighbor(j))==0)
flag(neighbor(j))=1;
end
speff=bfsearch(bnet, randnodes);
end
%rocovered
precv=rand();
if (precv>=gama) && (pinf < beta)
flag(i)=2;
network(i,:)=0;
network(:,i)=0;
end
end
end
%the number of S
S=length(find(flag==0));
%the number of I
I=length(find(flag==1));
%the number of R
R=length(find(flag==2));

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by