I have to study the resistance of the principal cluster of a percolating network of conducting wires . Individual wires are labeled from 1 to n. I represent the network by a graph G(V,E) and find its adjacency matrix A, where A_ij = 1 if wires i and j are in contact, 0 otherwise.
My question is the following : given that I need to implement Kirchhoff's Laws on the main percolated cluster, I need an algorithm that returns all the, ideally, smallest loops in the cluster. Do you know of an algorithm (mine is bruteforce now and not efficient) that finds all the loops inside a graph from its adjacency matrix ?
In general, there can be exponentially many simple cycles (loops), so since you want only the "smallest", it sounds as though you don't want them all. If you're looking to write equations corresponding to Kirchhoff's second law for all possible cycles, then it suffices to use just the equation for each cycle in a cycle basis. There is a polynomial-time algorithm to find the cycle basis that uses the least total number of edges (minimum cycle basis). Rather than implement that algorithm, however, it may suffice to switch from arc variables xu→v to differences of node variables yv - yu (fix one node variable per connected component to be zero).