MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / L_GCN

Method L_GCN

easygraph/classes/graph.py:480–496  ·  view source on GitHub ↗

r"""Return the GCN Laplacian matrix :math:`\mathcal{L}_{GCN}` of the graph with ``torch.sparse_coo_tensor`` format. Size :math:`(|\mathcal{V}|, |\mathcal{V}|)`. .. math:: \mathcal{L}_{GCN} = \mathbf{\hat{D}}_v^{-\frac{1}{2}} \mathbf{\hat{A}} \mathbf{\hat{D}}_v^{-\frac{1}{2}}

(self)

Source from the content-addressed store, hash-verified

478 # GCN Laplacian smoothing
479 @property
480 def L_GCN(self):
481 r"""Return the GCN Laplacian matrix :math:`\mathcal{L}_{GCN}` of the graph with ``torch.sparse_coo_tensor`` format. Size :math:`(|\mathcal{V}|, |\mathcal{V}|)`.
482
483 .. math::
484 \mathcal{L}_{GCN} = \mathbf{\hat{D}}_v^{-\frac{1}{2}} \mathbf{\hat{A}} \mathbf{\hat{D}}_v^{-\frac{1}{2}}
485
486 """
487 if self.cache.get("L_GCN") is None:
488 _tmp_g = self.clone()
489 _tmp_g.add_extra_selfloop()
490 self.cache["L_GCN"] = (
491 _tmp_g.D_v_neg_1_2.mm(_tmp_g.A)
492 .mm(_tmp_g.D_v_neg_1_2)
493 .clone()
494 .coalesce()
495 )
496 return self.cache["L_GCN"]
497
498 def smoothing_with_GCN(self, X, drop_rate=0.0):
499 r"""Return the smoothed feature matrix with GCN Laplacian matrix :math:`\mathcal{L}_{GCN}`.

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.95
add_extra_selfloopMethod · 0.80

Tested by

no test coverage detected