🧬 Motifs¶
Submodules¶
hypergraphx.motifs.directed_motifs module¶
- hypergraphx.motifs.directed_motifs.compute_directed_motifs(hypergraph, order=3, runs_config_model=10, *, seed=None, rng=None)[source]¶
Compute the number of motifs of a given order in a directed hypergraph.
- Parameters:
hypergraph (DirectedHypergraph) – The directed hypergraph of interest
order (int) – The order of the motifs to compute
runs_config_model (int) – The number of runs of the configuration model
- Returns:
keys: ‘observed’, ‘config_model’, ‘norm_delta’ ‘observed’ reports the number of occurrences of each motif in the observed hypergraph ‘config_model’ reports the number of occurrences of each motif in each sample of the configuration model ‘norm_delta’ reports the norm of the difference between the observed and the configuration model
- Return type:
dict
hypergraphx.motifs.motifs module¶
- hypergraphx.motifs.motifs.compute_motifs(hypergraph, order=3, runs_config_model=10, *, seed=None, rng=None)[source]¶
Compute the number of motifs of a given order in a hypergraph.
- Parameters:
hypergraph (Hypergraph) – The hypergraph of interest
order (int) – The order of the motifs to compute
runs_config_model (int) – The number of runs of the configuration model
- Returns:
keys: ‘observed’, ‘config_model’, ‘norm_delta’ ‘observed’ reports the number of occurrences of each motif in the observed hypergraph ‘config_model’ reports the number of occurrences of each motif in each sample of the configuration model ‘norm_delta’ reports the norm of the difference between the observed and the configuration model
- Return type:
dict
hypergraphx.motifs.utils module¶
- hypergraphx.motifs.utils.diff_sum(observed, null_models)[source]¶
Compute the relative abundance between the observed frequencies and the null models
- Parameters:
observed (list) – Observed frequencies
null_models (list) – Null models
- Returns:
Relative abundance between the observed frequencies and the null models
- Return type:
list
Notes
The relative abundance is computed as: (observed - null) / (observed + null + 4)
- hypergraphx.motifs.utils.directed_diff_sum(observed, null_models)[source]¶
Compute the relative abundance between the observed frequencies and the null models for directed hypergraphs.
- Parameters:
observed (list) – Observed frequencies
null_models (list) – Null models
- Returns:
Relative abundance between the observed frequencies and the null models
- Return type:
list
Notes
The relative abundance is computed as: (observed - null) / (observed + null + 4)
- hypergraphx.motifs.utils.generate_motifs(N)[source]¶
Generates all possible patterns of non-isomorphic subhypergraphs of size N
- Parameters:
N (int) – Size of the subhypergraphs
- Returns:
List of all possible patterns of non-isomorphic subhypergraphs of size N
- Return type:
list
- hypergraphx.motifs.utils.norm_vector(a)[source]¶
Normalize a vector
- Parameters:
a (list) – Vector to be normalized
- Returns:
Normalized vector (unit vector) or the original vector if the norm is zero
- Return type:
list
- hypergraphx.motifs.utils.power_set(A)[source]¶
Compute the power set of a set
- Parameters:
A (list) – Set
- Yields:
list – Subsets of the set
- hypergraphx.motifs.utils.relabel(edges, relabeling)[source]¶
Relabel the vertices of a hypergraph according to a given relabeling
- Parameters:
edges (list) – Edges of the hypergraph
relabeling (dict) – Relabeling
- Returns:
Edges of the hypergraph with the vertices relabeled
- Return type:
list
Notes
The relabeling is a dictionary that maps the old labels to the new labels
- hypergraphx.motifs.utils.z_score(observed, null_models)[source]¶
Compute the z-score between the observed frequencies and the null models
- Parameters:
observed (list) – Observed frequencies
null_models (list) – Null models
- Returns:
Z-score between the observed frequencies and the null models
- Return type:
list
Module contents¶
Motif computations.
Expose a small, stable API surface at package level for discoverability. Implementations are imported lazily on first use.