<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import pickle
import numpy as np

fp = open('matrixDs.pkl', 'rb')
matrixDs = pickle.load(fp)

Bins = [4, 5, 6, 7, 9, 11]
def generateAdjacencyMatrix(matrixD):
    # the matrix is not normalized. I think GCNconv will do the normalization itself
    matrixAs = []; #matrixLs = []
    NumAtom_1, NumAtom_2 = matrixD.shape
    matrixSize = NumAtom_1+NumAtom_2
    for bin_ in Bins:
        matrixA = np.zeros([matrixSize, matrixSize], dtype=np.int8)
        matrixA[:NumAtom_1, NumAtom_1:matrixSize] = matrixD &lt; bin_
        matrixA += matrixA
        matrixAs.append(matrixA)
        # if you want to add the Laplacian matrix
        # matrixL = np.diag(np.sum(matrixA, axis=1)) - matrixA
        # matrixLs.append(matrixL)
    return matrixAs#, matrixLs

for (matrixD_WT, matrixD_MT) in matrixDs:
    # Here, you can adjust the matrices in the format of the GCN algorithm
    matrixAs_WT = generateAdjacencyMatrix(matrixD_WT)
    matrixAs_MT = generateAdjacencyMatrix(matrixD_MT)
</pre></body></html>