torch_geometric.transforms.AddLaplacianEigenvectorPE
- class AddLaplacianEigenvectorPE(k: int, attr_name: Optional[str] = 'laplacian_eigenvector_pe', is_undirected: bool = False, **kwargs: Any)[source]
Bases:
BaseTransform
Adds the Laplacian eigenvector positional encoding from the “Benchmarking Graph Neural Networks” paper to the given graph (functional name:
add_laplacian_eigenvector_pe
).- Parameters:
k (int) – The number of non-trivial eigenvectors to consider.
attr_name (str, optional) – The attribute name of the data object to add positional encodings to. If set to
None
, will be concatenated todata.x
. (default:"laplacian_eigenvector_pe"
)is_undirected (bool, optional) – If set to
True
, this transform expects undirected graphs as input, and can hence speed up the computation of eigenvectors. (default:False
)**kwargs (optional) – Additional arguments of
scipy.sparse.linalg.eigs()
(whenis_undirected
isFalse
) orscipy.sparse.linalg.eigsh()
(whenis_undirected
isTrue
).