Generators#
Generators for random simplicial complexes.
- toponetx.generators.random_simplicial_complexes.linial_meshulam_complex(n: int, p: float, seed=None) SimplicialComplex [source]#
Generate a random Linial-Meshulam simplicial complex [1].
The random simplicial complex is generated by starting with a complete graph (i.e., a complete 1-skeleton) and then adding 2-simplices with probability p.
- Parameters:
- nint
The number of nodes.
- pfloat
The probability of a 2-simplex being added.
- seedint or random_state (optional)
Indicator of random number generation state.
- Returns:
- SimplicialComplex
A random Linial-Meshulam simplicial complex.
Notes
This is equivalent to multiparameter_linial_meshulam_complex with edge probability one and 2-simplex probability p.
References
[1]Nathan Linial and Roy Meshulam, “Homological Connectivity Of Random 2-Complexes,” Combinatorica 26, no. 4 (August 2006): 475-87, https://doi.org/10.1007/s00493-006-0027-9.
- toponetx.generators.random_simplicial_complexes.multiparameter_linial_meshulam_complex(n: int, ps: Sequence[float], seed: Random | None = None) SimplicialComplex [source]#
Generate a random multiparameter Linial-Meshulam complex.
The random simplicial complex is generated inductively, starting with a set of n nodes. The probability for two nodes to be connected is given by ps[0]. Then, the probability for each k-clique to be identified by a k-1-simplex is given by ps[k-2].
- Parameters:
- nint
The number of nodes.
- pssequence of floats
The probabilities for each simplex rank. The first entry is the probability for two nodes to be connected. The second entry dictates the probability for a 2-simplex to be added to the previous 1-skeleton etc.
- seedint or random_state (optional)
Indicator of random number generation state.
- Returns:
- SimplicialComplex
A random multiparameter Linial-Meshulam complex.
Notes
For p[0] = 1.0 and p[1] = p, this recovers the standard random Linial-Meshulam complex provided by random_linial_meshulam_complex.
- toponetx.generators.random_simplicial_complexes.random_clique_complex(n: int, p: float, seed=None) SimplicialComplex [source]#
Generate a random clique complex [1].
In random clique complexes, a sample from an Erdős-Rényi graph is drawn and all cliques are identified with a face of a simplicial complex.
- Parameters:
- nint
The number of nodes.
- pfloat
The probability of an edge between two nodes.
- seedint or random_state (optional)
Indicator of random number generation state.
- Returns:
- SimplicialComplex
A random clique complex.
References
[1]Matthew Kahle, “Topology of Random Clique Complexes,” Discrete Mathematics 309, no. 6 (April 2009): 1658-71, https://doi.org/10.1016/j.disc.2008.02.037.
Generators for random cell complexes.
- toponetx.generators.random_cell_complexes.np_cell_complex(n: int, p: float, seed=None) CellComplex [source]#
Generate $CC_{(n,p)}$ complex.
In an $(n,p)$ cell complex, a sample from an Erdős-Rényi graph is drawn, also called $G_{n,p}$, and all basis cycles are identified with a cell of a cell complex.
- Parameters:
- nint
The number of nodes.
- pfloat
The probability of an edge between two nodes.
- seedint or random_state (optional)
Indicator of random number generation state.
- Returns:
- CellComplex
An (n,p) cell complex.