| 261 | |
| 262 | @property |
| 263 | def D_v_neg_1_2( |
| 264 | self, |
| 265 | ): |
| 266 | import torch |
| 267 | |
| 268 | r"""Return the nomalized diagnal matrix of vertex degree :math:`\mathbf{D}_v^{-\frac{1}{2}}` with ``torch.sparse_coo_tensor`` format. Size :math:`(|\mathcal{V}|, |\mathcal{V}|)`. |
| 269 | """ |
| 270 | if self.cache.get("D_v_neg_1_2") is None: |
| 271 | _mat = self.D_v.clone() |
| 272 | _val = _mat._values() ** -0.5 |
| 273 | _val[torch.isinf(_val)] = 0 |
| 274 | self.cache["D_v_neg_1_2"] = torch.sparse_coo_tensor( |
| 275 | _mat._indices(), _val, _mat.size(), device=self.device |
| 276 | ).coalesce() |
| 277 | return self.cache["D_v_neg_1_2"] |
| 278 | |
| 279 | @property |
| 280 | def node2index(self): |