If I understand correctly, you would like to have the adjacency matrix, but with the rows and columns permuted according to the resulting cluster membership, correct?

You can get the adjacency matrix by `g.get_adjacency`

. This returns an `igraph`

matrix. It is easier typically to work with a `numpy`

matrix (here imported as `np`

), which you can get as follows:

```
A_mat = g.get_adjacency()
A = np.array(list(A_mat))
```

You can then reorder this matrix however you prefer. If you want to reorder it based on the clustering results, you can do that as follows, where `cluster`

is assumed to be the result of any clustering algorithm:

```
idx = np.argsort(cluster.membership)
A = A[np.ix_(idx, idx)]
```

This is already a dense matrix, so you can simply plot this using `plt.matshow`

.