Create all possible paths from a two-dimensional Python matrix

Asked

Viewed 39 times

1

I tried in every way to create all possible paths of elements of a matrix. As in the example below a matrix where I would have 8 total possibilities.

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

Where there is more than one element I would like to leave only one, making all possible combinations of these elements as for example

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

And so on until I had all the possibilities, in some studies I noticed a similarity with an ADT called graphs, but I couldn’t implement it very well. Please help, thanks in advance.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.