restart;
Douglas E. Lewit
Mathematics major at Northeastern Illinois University
Secondary Education major at National-Louis University
Proud member of the Maple community!
In the problem below I take advantage of Maple's Graph Theory package to simulate how an infection might spread throughout a small community of 15 individuals. To make the problem simpler I had to make certain assumptions. First of all, I am not taking into account the recovery or death of infected individuals. Such a consideration would definitely make the problem much more challenging. Secondly, I am assuming, as can be seen from my zeroorone procedure below, that there is a 25% probability that any individual in the community is connected to any other individual in the community. (In other words, we do not have a situation here where every person is connected to every other person. In such an event the infection would obviously spread much faster than it does here.) Also, using my algorithm there is the possibility of reinfection, which isn't an unrealistic expectation at all. In any infected population, there is always the possibility that two infected individuals will interact with each other, hence reinfection is at least statistically possible even if it's biologically impossible in the case of a specific illness or disease. And just for clarification, in the graphs below yellow vertices represent healthy, uninfected individuals while red vertices represent infected individuals. The infection being analyzed is strictly hypothetical and mathematical in nature. This is a computer simulation project rather than a biology project! For example, the infection may not be a biological infection at all. The 15 vertices could represent 15 different computers, and the "infection" that spreads could be interpreted as a computer virus rather than a biological virus.
with(GraphTheory);
interface(rtablesize=15);
A:=Matrix(15,fill=0);
zeroorone:=proc() local r: r:=rand()/1e12: if r<=0.25 then 1: else 0: end if: end proc:
for i to 15 do for j from i+1 to 15 do A[i,j]:=zeroorone(): A[j,i]:=A[i,j]: end do: end do:
A;
V:=Graph(A);
DrawGraph(V);
plot0:=DrawGraph(V);
Random:=proc(n)
global RandSEQ;
local a, i, k, A, P;
A:=[seq(k,k=1..n)]:
RandSEQ:=[]:
while numelems(RandSEQ)<n do
a:=nops(A):
P:=rand(1..a):
i:=P():
RandSEQ:=[op(RandSEQ),A[i]]:
A:=subsop(i=NULL,A):
end do:
RandSEQ;
end proc;
Neighborhood(V,1); ###### just doing an example and checking my algorithm.
b:=Neighborhood(V,1);
a:=[];
Random(3);
for n to 3 do a:=[op(a),b[RandSEQ[n]]]: end do: a;
n:=1: HighlightVertex(V,1,red): plot1:=DrawGraph(V,style=circle): C:=[]: for k from 2 to 200 do b:=Neighborhood(V,n): K:=numelems(b): Random(K): a:=[]: a:=[op(a),b[RandSEQ[1]]]: C:=[op(C),n]:n:=a[1]: HighlightEdges(V,{n,op(nops(C),C)},green): plot||k:=DrawGraph(V,style=circle): HighlightVertex(V,n,red): plot||(k+1):=DrawGraph(V,style=circle): od:
with(plots):
display(plot0);
display([seq(plot||n,n=0..201)],insequence=true,caption="\n\nThe infection is spreading!",captionfont=[Arial,bold,18]);
You can see from the animation above that about 162 time steps are necessary for the infection to spread to every member of the small community of 15 members. But this value of time=162 (could be minutes, days, weeks, or months, or any other relevant unit of time decided by the model) is only valid for the situation where a node (i.e. member of the network or community) has a 25% chance of being connected to any other node. And of course if there are more nodes in the community, it will take longer than 162 time steps for the infection to spread to all members of the community, again assuming a fixed probability that any node in the network (or community) has a 25% chance of being connected to any other node in the network or community. I sincerely hope that you have enjoyed this project as much as I have. MAPLE IS THE BEST SOFTWARE FOR EXPLORING ADVANCED MATHEMATICS!