Percolation threshold is a mathematical concept related to percolation theory, which is the formation of long-range connectivity in random systems. Below the threshold a giant connected component does not exist; while above it, there exists a giant component of the order of system size.

How can we calculate a percolation threshold of a graph/network using Mathematica?

  1. Image of a subcellular network: enter image description here

  2. The image is transformed into a graph by utilizing MorphologicalGraph function: enter image description here

  3. By applying the ConnectedComponents function and choosing the list of subgraphs from the suggestion menu one can obtain a soup of graphs/networks. Here are the top of that list: enter image description here

The question is how to exctract the probability that these networks are being connected? What is the critical treshold or bond percolation?

  • $\begingroup$ demonstrations.wolfram.com/PercolationOnASquareGrid $\endgroup$
    – Feyre
    Commented Nov 4, 2016 at 22:20
  • $\begingroup$ This Q&A might also be of interest. $\endgroup$
    – march
    Commented Nov 4, 2016 at 22:25
  • $\begingroup$ @Feyre. Thank you so much. $\endgroup$ Commented Nov 5, 2016 at 0:01
  • $\begingroup$ i don't follow the probabilistic nature of the question. If you have many such images you could see how many show long range connectivity. Otherwise its not clear what you are asking. $\endgroup$
    – george2079
    Commented Nov 6, 2016 at 19:26
  • $\begingroup$ @george2079.Thank you for your consideration. I actually found this nice paper of Prof Oliver Knill "MATHEMATICA ROUTINES FOR INDEX EXPECTATION AND PERCOLATION " which kind of address the challenges I am dealing with at this point. Would appreciate any comments about what the code given actually does to define the site and bond percolations. $\endgroup$ Commented Nov 6, 2016 at 19:53

1 Answer 1


Start with a symmetric matrix of random positive weights.

mybasicweightmatrix = (temp = Table[RandomReal[], {10}, {10}]) + 
   Transpose[temp]; (* symmetric matrix of random positive weights *)

Then threshold the entries such that values less than mythreshold will be set to $0$ (not connected), others to $1$ (connected). Form a graph based on this thresholded adjacency matrix. Then adjust mythreshold until the graph is no longer weakly connected.

 thresholdedmatrix = (HeavisideTheta[# - mythreshold] & /@ 

 myfig = Column[{mythreshold, 
    WeaklyConnectedGraphQ[nn = AdjacencyGraph[thresholdedmatrix]], 
    Graph[nn, GraphLayout -> "CircularEmbedding"]}],

 {mythreshold, 0, 2}]

Here "weakly connected" means there is a path from any vertex to any other vertex. Seems like a reasonable specification of a "giant component."

enter image description here

enter image description here

  • $\begingroup$ G.Stork. Thank you very much. I am a neophyte to programming in general and WL in particular. Do you mind please describing what the code actually does. I am very appreciative. $\endgroup$ Commented Nov 5, 2016 at 0:04
  • $\begingroup$ @ G.Stork. Many Thanks! $\endgroup$ Commented Nov 5, 2016 at 1:20
  • $\begingroup$ Pure Function: You're welcome. Will you be using this in some publication or research? $\endgroup$ Commented Nov 5, 2016 at 4:47

Your Answer

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

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