I did a simple demonstration to illustrate the percolation theory for my students. The content is a conductive square network possessing electrodes at its top and bottom edges. Some randomly chosen knots of the network are cut away. The network is graphically shown by black lines, while to show the cut knot I place a white disk over it. Here is the code:
perc1[n_Integer] := Module[{i, j, lst, lst1, m},
lnHor =
Graphics[{Thick, Table[Line[{{0.5, i}, {10.5, i}}], {i, 1, 10}]}];
lnVer =
Graphics[{Thick, Table[Line[{{j, 0.5}, {j, 10.5}}], {j, 1, 10}]}];
lst = DeleteDuplicates[
Table[{RandomInteger[{1, 10}], RandomInteger[{1, 10}]}, {3000}]];
lst1 = Drop[lst, Length[lst] - n];
disks = Graphics[{White, Table[Disk[lst1[[m]], 0.3], {m, 1, n}]}];
el1 = Graphics[{Black, Thickness[0.03],
Line[{{0.5, 0.5}, {10.5, 0.5}}]}];
el2 = Graphics[{Black, Thickness[0.03],
Line[{{0.2, 10.5}, {10.5, 10.5}}]}];
wir1 = Graphics[Line[{{5, 10.5}, {5, 11}}]];
wir2 = Graphics[Line[{{5, 0.5}, {5, 0.}}]];
Column[{
Row[{Style[
"x = \!\(\*FractionBox[SubscriptBox[\(N\), \(cut\\\ away\)], \
SubscriptBox[\(N\), \(total\)]]\) = ", Italic, 14], n/100 // N}],
Show[{lnHor, lnVer, disks, el1, el2, wir1, wir2},
ImageSize -> 350, PlotRange -> {{0, 11}, {0, 11}}]},
Alignment -> Center]];
percolation1 =
Manipulate[
perc1[n], {{n, 10,
Dynamic[Row[{Style[
"\!\(\*SubscriptBox[\(N\), \(cut\\\ away\)]\)= ", Italic, 14,
Blue], Style[n, 14, Blue]}]]}, 1, 100, 1,
Appearance -> Labeled}, ControlPlacement -> Top,
SaveDefinitions -> True]
That' s what you see:
When moving the slider one varies the number of the knots cut away. This works.
Now my question: It would be nice, if I could in addition show by some color marking possible percolation paths (that is, those contours along which the current can flow from the top to bottom electrode in a given configuration). It should vary dynamically when moving the slider.
Any idea?