mindchemistry.e3.utils.radius_graph_full

View Source On Gitee
mindchemistry.e3.utils.radius_graph_full(x, batch=None, loop=False, flow='source_to_target')[source]

Computes graph edges to all points within a given distance.

Parameters
  • x (Tensor) – node feature matrix.

  • batch (Tensor) – batch vector. If it is none, then calculate and return. Default: None.

  • loop (bool) – whether contain self-loops in the graph. Dufault: False.

  • flow (str) – {'source_to_target', 'target_to_source'}, the flow direction when using in combination with message passing. Dufault: 'source_to_target'.

Returns

edge_index (ndarray) - including edges of source and destination.

batch (ndarray) - batch vector.

Raises

ValueError – If flow is not in {'source_to_target', 'target_to_source'}.

Supported Platforms:

Ascend

Examples

>>> from mindchemistry.e3.utils import radius_graph_full
>>> from mindspore import ops, Tensor
>>> x = Tensor(ops.ones((5, 12, 3)))
>>> edge_index, batch = radius_graph_full(x)
>>> print(edge_index.shape)
(2, 660)
>>> print(batch.shape)
(60,)