# Find Graph Connections for Rock Paper Scissor game

I have a 2-D matrix for all participants to a number of Rock Paper Scissor (RPS) games played between a number of participants. Each row has is labeled for the participant winning, and each column is labeled for the participant losing. Each cell contains the percentage of RPS wins. Because some participants always play the same, I expect to find a 100% in those cells. I'm trying to determine a simple matrix manipulation to find all the participants that play the same strategy, by quickly extracting the combinations. Is there anything in graph theory that suggests a way of dealing with this problem. I've been trying to turn all cells that are not 100% into 0, let's call this matrix A, then adding 1 on the diagonal to obtain matrix D, and then multiplying with dot product matrices D.A, but I'm not sure how to make progress. Here is an example for four individuals labeled a, b, c and d (sorry I don't know how to label the rows and columns in LaTex). $$\begin{bmatrix} 0&1&0.5&0\\ 0&0&1&1\\ 0.5&0&0&0\\ 1&0&1&0 \end{bmatrix}$$ Imagine that the rows are labeled a, b, c, d, and the columns too. So a always wins against b, and wins 50% of the times against c; b wins both against c and d; c always loses against d.

• "Each row has is labeled for the participant winning, and each column is labeled for the participant losing." This doesn't make any sense to me. Can you give a simple example of such a matrix, say for three participants? – Alex Kruckman Feb 12 at 23:42
• @AlexKruckman, I added an example; I hope it helps. – gciriani Feb 13 at 1:42
• Ah, the example helps. Your example has the property that $a_{ij} + a_{ji} = 1$ when $i\neq j$, i.e. with probability $1$, player $i$ beats player $j$ or player $j$ beats player $i$. But games of Rock Paper Scissors often end in ties... Also, I expect that to determine "all the participants that play the same strategy", you'll have to be a bit more precise - what counts as a "strategy"? – Alex Kruckman Feb 13 at 1:50
• @AlexKruckman, I have bots playing the game, who tend to stick to the same play, i.e. either always R or always P or always S. A few bots alternate between plays, and that's why I put in my example one outcome at 50%. Rather than strategies I'm interested in a procedure to automate the search for individuals playing the same play. – gciriani Feb 13 at 2:13

I found an answer, which is consists first in setting to 0 all elements that are not 1. This eliminates all encounters where the players played mixed strategies, leaving only plays where there is a higher chance that the players used pure strategies. Then I dot multiply the matrix by itself twice. The matrix itself gives for each row the columns corresponding to an individual playing a losing strategy. The first dot multiplication gives for each row the column corresponding to the individual twice removed from the corresponding player; the second dot multiplication gives for each row the corresponding column of the players that play the same strategy. Higher numbers would indicate that the there are more connecting paths to that player, thus higher chance of playing the same strategy. So in the example given we would first modify the initial matrix to $$\begin{bmatrix} 0&1&0&0\\ 0&0&1&1\\ 0&0&0&0\\ 1&0&1&0 \end{bmatrix}$$ and after the twice multiplication is done twice we obtain as a result: $$\begin{bmatrix} 1&0&1&0\\ 0&1&0&0\\ 0&0&0&0\\ 0&0&1&1 \end{bmatrix}$$ This indicates that the player in the first row has the same strategy as the player in the 3rd and 4th column; that the player in the 2nd row has the same strategy as the player in the 1st and 3rd column; that the player in the 4th row has the same strategy as the player in the 2nd column.