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

Method N_e_of_group

easygraph/classes/hypergraph.py:1017–1032  ·  view source on GitHub ↗

r"""Return the neighbor hyperedges of the specified vertex of the specified hyperedge group with ``torch.Tensor`` format. .. note:: The ``v_idx`` must be in the range of [0, :attr:`num_v`). Args: ``v_idx`` (``int``): The index of the vertex. ``gr

(self, v_idx: int, group_name: str)

Source from the content-addressed store, hash-verified

1015 return torch.cat(_tmp, dim=0)
1016
1017 def N_e_of_group(self, v_idx: int, group_name: str) -> torch.Tensor:
1018 r"""Return the neighbor hyperedges of the specified vertex of the specified hyperedge group with ``torch.Tensor`` format.
1019
1020 .. note::
1021 The ``v_idx`` must be in the range of [0, :attr:`num_v`).
1022
1023 Args:
1024 ``v_idx`` (``int``): The index of the vertex.
1025 ``group_name`` (``str``): The name of the specified hyperedge group.
1026 """
1027 assert (
1028 group_name in self.group_names
1029 ), f"The specified {group_name} is not in existing hyperedge groups."
1030 assert v_idx < self.num_v
1031 e_indices = self.H_of_group(group_name)[v_idx]._indices()[0]
1032 return e_indices.clone()
1033
1034 def N_v(self, e_idx: int) -> torch.Tensor:
1035 r"""Return the neighbor vertices of the specified hyperedge with ``torch.Tensor`` format.

Callers 3

nbr_e_of_groupMethod · 0.95
N_eMethod · 0.95
test_N_groupFunction · 0.80

Calls 2

H_of_groupMethod · 0.95
cloneMethod · 0.45

Tested by 1

test_N_groupFunction · 0.64