I want to make an adjacency matrix A given biadjacency matrix B. The type is adjacency matrix in python.
Let the matrix B = np.array([[1,2,3],[10,20,30],[3,4,5],[50,12,36],[5,6,7],[3,4,5]])
and its transpose Bt = np.transpose(B)
.
Let, also, two zero matrices Z, Zt with dimensions (6,6) and (3,3) respectively.
So A = [[Z,B],[Bt,Zt]]
. But this is a list and its elements:
[[array([[ 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0.]]), array([[ 1, 2, 3],
[10, 20, 30],
[ 3, 4, 5],
[50, 12, 36],
[ 5, 6, 7],
[ 3, 4, 5]])], [array([[ 1, 10, 3, 50, 5, 3],
[ 2, 20, 4, 12, 6, 4],
[ 3, 30, 5, 36, 7, 5]]), array([[ 0., 0., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.]])]].
However I want something like this:
[0., 0., 0., 0., 0., 0., 1, 2, 3
0., 0., 0., 0., 0., 0., 10, 20, 30
0., 0., 0., 0., 0., 0., 3, 4, 5
0., 0., 0., 0., 0., 0., 50, 12, 36
0., 0., 0., 0., 0., 0., 5, 6, 7
0., 0., 0., 0., 0., 0., 3, 4, 5
1, 10, 3, 50, 5, 3, 0., 0., 0.
2, 20, 4, 12, 6, 4, 0., 0., 0.
3, 30, 5, 36, 7, 5, 0., 0., 0.]
I have tried to work with list comprehensions butthe results are not correct. If I had the original graph I could use NetworX package but I can't now. Do you know a way to construct A?