I have a matrix in which column 1 and 2 represents the nodes which are connected with each-other. For example, A=[1 2; 1 3; 1 4; 2 1; 3 1; 3 4; 4 1; 4 3].

(in this example, node 1,3, and 4 are connected with each-other hence each of them has one common neighbor).

Now my question is that how do I extract B=[1 3; 1 4; 3 1; 3 4; 4 1; 4 3].

Thanks in advance!

## Best Answer