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

Method D_e

easygraph/classes/hypergraph.py:928–943  ·  view source on GitHub ↗

r"""Return the hyperedge degree matrix :math:`\mathbf{D}_e` with ``torch.sparse_coo_tensor`` format.

(self)

Source from the content-addressed store, hash-verified

926
927 @property
928 def D_e(self) -> torch.Tensor:
929 r"""Return the hyperedge degree matrix :math:`\mathbf{D}_e` with ``torch.sparse_coo_tensor`` format.
930 """
931 if self.cache.get("D_e") is None:
932 _tmp = [
933 self.D_e_of_group(name)._values().clone() for name in self.group_names
934 ]
935 _tmp = torch.cat(_tmp, dim=0).view(-1)
936 _num_e = _tmp.size(0)
937 self.cache["D_e"] = torch.sparse_coo_tensor(
938 torch.arange(0, _num_e).view(1, -1).repeat(2, 1),
939 _tmp,
940 torch.Size([_num_e, _num_e]),
941 device=self.device,
942 ).coalesce()
943 return self.cache["D_e"]
944
945 def D_e_of_group(self, group_name: str) -> torch.Tensor:
946 r"""Return the hyperedge degree matrix :math:`\mathbf{D}_e` of the specified hyperedge group with ``torch.sparse_coo_tensor`` format.

Callers

nothing calls this directly

Calls 3

D_e_of_groupMethod · 0.95
cloneMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected