Dear All,

Sorry for the typoes earlier, let me repost the question.

Suppose I want to generate sequences of length 3 from two symbols {1,2}, we get 
the following 8 sequences
1 1 1
1 1 2
1 2 1
1 2 2
2 1 1
2 1 2
2 2 1
2 2 2

However, I do not want all these 8 sequences. I call two sequencs to be 
isomorphic if one sequence could be obtained from the other by relabelling the 
symbols. For example, 111 is isomorphic to 222, 112 is isomorphic to 221. By 
eliminating all these isomorphic ones, what I want is the following
1 1 1
1 1 2
1 2 1
2 1 1

In general, I need to generate non-isomorphic sequences of length p from t 
distinct symbols. For example, when p=3, t=3 we have
matrix(c(1,2,3,1,1,2,2,1,1,1,2,1,1,1,1),3,5)

[1,]    1    1    2    1    1
[2,]    2    1    1    2    1
[3,]    3    2    1    1    1

When p=4, t=4 we have
matrix(c(1,2,3,4,1,1,2,3,1,2,1,3,1,2,3,1,2,1,1,3,2,3,1,1,2,1,3,1,1,1,2,2,1,2,1,2,1,2,2,1,1,1,1,2,1,1,2,1,1,2,1,1,2,1,1,1,1,1,1,1),4,15)

[1,]    1    1    1    1    2    2    2    1    1     1     1     1     1     
2     1
[2,]    2    1    2    2    1    3    1    1    2     2     1     1     2     
1     1
[3,]    3    2    1    3    1    1    3    2    1     2     1     2     1     
1     1
[4,]    4    3    3    1    3    1    1    2    2     1     2     1     1     
1     1


In general, I need to do this for arbitrary choices of p and t.

Thaks a lot,
Wei
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to