# This worksheet contains computations of expected propagation time using Markov transition matrices for
# Expected propagation time for probabilistic zero forcing
# by Jesse Geneson and Leslie Hogben
################################
# Markov method using center with 3 leaves
# Four states: 0, 1, 2, 3 leaves blue
# With 0 blue Pr[force]= 1/3
# With 1 blue Pr[force]= 2/3
################################
maxt = 100
ept = 0
Mt=n(identity_matrix(4))
for t in [1..maxt]:
Mtminus1=Mt
Mt = Mt*M
ept = t*(Mt[0,3] - Mtminus1[0,3]) + ept #sage numbers matrix entries 0,1,...,n-1
ept
2.76315789473684
2.76315789473684
################################
# Markov method using center with 4 leaves
# Five states: 0, 1, 2, 3, 4 leaves blue
# With 0 blue Pr[force]= 1/4
# With 1 blue Pr[force]= 1/2
# With 2 blue Pr[force]= 3/4
################################