Skip to contents

Z = (N_real - mean N_rand)/sd N_rand over a degree-preserving randomized ensemble; p = fraction of randomizations with count at or above the real count (P < 0.01 motif cutoff). Feed-forward loop and 3-cycle.

Usage

morie_motiff(
  adjacency,
  motif = "ffl",
  n_random = 100,
  seed = 0,
  swaps = NULL,
  preserve_mutual = TRUE
)

Arguments

adjacency

Directed 0/1 adjacency (n x n).

motif

"ffl" or "cycle3".

n_random

Ensemble size.

seed

SplitMix64 seed (mirrors the Python arm).

swaps

Edge swaps per randomization (default 10 * edges).

preserve_mutual

TRUE (default) preserves the mutual-edge count (mfinder, Milo refs. 17-18); FALSE fixes only in/out degree.

Value

A list with elements count, z_score, p_value, rand_mean, rand_sd, motif, n_random, seed, method.

References

Milo, R. et al. (2002). Network motifs: simple building blocks of complex networks. Science, 298(5594), 824-827.

Examples

# \donttest{
set.seed(22)
A <- matrix(rbinom(15 * 15, 1, 0.15), 15); diag(A) <- 0
morie_motiff(A, motif = "ffl", n_random = 30, seed = 1)[c("count", "z_score")]
#> $count
#> [1] 7
#> 
#> $z_score
#> [1] -0.3802391
#> 
# }