chainer_chemistry.dataset.preprocessors.construct_adj_matrix

chainer_chemistry.dataset.preprocessors.construct_adj_matrix(mol, out_size=-1, self_connection=True)[source]

Returns the adjacent matrix of the given molecule.

This function returns the adjacent matrix of the given molecule. Contrary to the specification of rdkit.Chem.rdmolops.GetAdjacencyMatrix(), The diagonal entries of the returned matrix are all-one.

Parameters:
  • mol (rdkit.Chem.Mol) – Input molecule.
  • out_size (int) – The size of the returned matrix. If this option is negative, it does not take any effect. Otherwise, it must be larger than the number of atoms in the input molecules. In that case, the adjacent matrix is expanded and zeros are padded to right columns and bottom rows.
  • self_connection (bool) – Add self connection or not. If True, diagonal element of adjacency matrix is filled with 1.
Returns:

The adjacent matrix of the input molecule.

It is 2-dimensional array with shape (atoms1, atoms2), where atoms1 & atoms2 represent from and to of the edge respectively. If out_size is non-negative, the returned its size is equal to that value. Otherwise, it is equal to the number of atoms in the the molecule.

Return type:

adj_array (numpy.ndarray)