fNecklaces {Necklaces}R Documentation

Necklaces of a fixed configuration

Description

The function generates all the representatives of the necklaces corresponding to a fixed configuration.

Usage

fNecklaces(pv=c(), bOut=FALSE, fn=1)

Arguments

pv

vector: the fixed configuration

bOut

boolean: if TRUE, the function produces a compact result

fn

integer: the first value of the alphabet, the default is 1

Details

The function generates all the representatives of the necklaces corresponding to a fixed configuration. If the second parameter (bOut) is set equal to TRUE, the function produces a compact result. The third parameter (fn) initializes the first value of the alphabet, which by default is equal to 1. For example, to generate all the representatives of necklaces corresponding to the fixed configuration (2,1,1), run fNecklaces(c(2,1,1)). In such a case the alphabet is {1,2,3}. Using the nPerm function of the kStatistics package, the function first generates all the permutations of the vector (1,1,2,3) corresponding to the configuration (2,1,1):

(I) (3,2,1,1), (2,3,1,1), (3,1,1,2), ..., (1,1,2,3) (12 in total)

Then the cNecklaces function of the Necklaces package is called with input equal to each vector in (I). For each obtained list, only the representative survives. At the end all the representatives of the necklaces are printed, that are [1 1 2 3], [1 1 3 2], [1 2 1 3].

Value

list

the list containing all the representatives of the necklaces corresponding to a fixed configuration.

Note

The function calls the cNecklaces function in the Necklaces package and the nPerm function in the kStatistics package.

Author(s)

Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it

References

Di Nardo, E. (2014) On a symbolic representation of non-central Wishart random matrices with applications. Jour. Mult. Anal. Vol.125, 121–135. (https://arxiv.org/abs/1312.4395)

Di Nardo, E., and Guarino., G. (2022) kStatistics: Unbiased Estimates of Joint Cumulant Products from the Multivariate Faa Di Bruno's Formula. The R journal - In press. (https://arxiv.org/abs/2206.15348)

Di Nardo, E., and Guarino., G. (2022) Necklaces and bracelets in R - (https://arxiv.org/abs/2208.06855)

Flajolet, P., and Sedgewick, R. (2009) Analytic combinatorics. Cambridge University press.

See Also

cBracelets, LyndonW, sBruijn

Examples

# Generate all the necklaces of the configuration (2,1,1) 
# corresponding to the vector (1,1,2,3)
fNecklaces(c(2,1,1))  

# The previous result in a compact form
fNecklaces(c(2,1,1),TRUE)

# The first value of the alphabet is set equal to zero 
fNecklaces(c(2,1,1),TRUE,0)



[Package Necklaces version 1.0 Index]