2
$\begingroup$

I would like to examine the percolation from the left edge to the right edge on random lattice.

Suppose I have a rectangle with N random points on it.

randPts = Table[{RandomReal[{-1, 1}], RandomReal[{-2, 2}]}, {N=100}]

Now I simultaneously increase the radius of each points to r. For a critical r*, there should be a path I can connect from the left edge to right edge. I want to find the critical r* that the percolation happens.

I know that there is a related answer: Finding a percolation path But this answer only connects the leftmost point to the rightmost point. These points can be isolated themselves, so they might not in the path I am looking for.

$\endgroup$

1 Answer 1

2
$\begingroup$

You can take all nodes that are connected to the left edge and connect those to each other. Then do the same for all nodes connected to the right edge. Then connect all nodes that are close to each other. Then pick one of the nodes connected to the left edge, and one of the nodes connected to the right edge, and see if you can find a path between them.

randPts = Table[{RandomReal[{-1, 1}], RandomReal[{-2, 2}]}, {N, 100}];
r = 0.4;
leftEdge = -1;
rightEdge = 1;
leftEdgeNodes = Select[randPts, #[[1]] - r < leftEdge &];
rightEdgeNodes = Select[randPts, #[[1]] + r > rightEdge &];
graph = NearestNeighborGraph[randPts, {All, r}];
graph = EdgeAdd[graph, Join[
    UndirectedEdge @@@ Tuples[leftEdgeNodes, {2}],
    UndirectedEdge @@@ Tuples[rightEdgeNodes, {2}]
    ]];
path = FindShortestPath[graph, First[leftEdgeNodes], First[rightEdgeNodes]];

I'm not sure that NearestNeighborGraph does what you want, please have a look to see that you can use it. Otherwise, you can use the approach of Verbeia in that other Q&A that you linked to.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.