Learn R Programming

Necklaces (version 1.0)

cNecklaces: Elements in a necklace

Description

The function generates the elements of a necklace in equivalence relation with the vector given in input.

Usage

cNecklaces(v=c(), bOut=FALSE)

Value

list

the list containing all the elements of the necklace in equivalence relation with the vector given in input

Arguments

v

vector: input vector

bOut

boolean: if TRUE, the function produces a compact result

Author

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

Details

The function generates the elements of a necklace which are in equivalence relation with the vector given in input. The first parameter is the input vector. If the second parameter (bOut) is set equal to TRUE, the function produces a compact result.

Example: cNecklaces(c(1,0,2,1)) produces the following result:

[1] 0 2 1 1
[1] 1 0 2 1
[1] 1 1 0 2
[1] 2 1 1 0

cNecklaces(c(1,0,2,1),TRUE) produces the following result:

[ 0 2 1 1 ] ( 1 )
[ 1 0 2 1 ] ( 2 )
[ 1 1 0 2 ] ( 3 )
[ 2 1 1 0 ] ( 4 )

Note that 0 2 1 1 is the representative of the class, that is the minimum in lexicographical order.

References

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

fNecklaces, sBruijn, cBracelets

Examples

Run this code
# Generate the elements of the necklace in equivalence relation with 
# the input vector c(1,0,2,1) 
cNecklaces(c(1,0,2,1)) 

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

Run the code above in your browser using DataLab