I have been thinking about the problem in the last few days, but since I am new to MATLAB, I have no idea how to solve it. Here is the background. Suppose you have a symmetric matrix N×N, where each element has either 0, or 1, and N = (1,2,...,n).
For instance:
A =
0 1 1 0
1 0 0 1
1 0 0 0
0 1 0 0
If A(i,j) == 1, then it is possible to form a pair (i,j), and if A(i,j)==0, then it is impossible to form a pair (i,j). For example, it (1,2)is a possible pair, because A(1,2)==A(2,1)==1, but is (3,4)NOT a possible pair like A(3,4)==A(4,3)==0.
Here is the problem. Suppose a member of a set Ncan only be for a pair with no more than one other element in the set N(i.e., if 1 forms a pair with 2, then 1 cannot form a pair with 3). How can I find all possible “lists” of possible pairs? In the above example, one “list” will consist of only a pair (1,2). If this pair is formed, then it is impossible to form other pairs. Other "list" will be: ((1,3),(2,4)). I searched the forum and found that the last “list” is the maximum match that can be found, for example, using a two-way approach to the graph. However, I’m not only interested in finding the maximum match; I am interested to find ALL possible “lists” of possible pairs. Another example:
A =
0 1 1 1
1 0 0 1
1 0 0 0
1 1 0 0
There are three possible lists in this example:
(1,2)
((1,3),(2,4))
(1,4)
, , , . , . !