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

Method v2v_of_group

easygraph/classes/hypergraph.py:1746–1792  ·  view source on GitHub ↗

r"""Message passing of ``vertices to vertices`` in specified hyperedge group. The combination of ``v2e_of_group`` and ``e2v_of_group``. Args: ``group_name`` (``str``): The specified hyperedge group. ``X`` (``torch.Tensor``): Vertex feature matrix. Size :math:`(|\math

(
        self,
        group_name: str,
        X: torch.Tensor,
        aggr: str = "mean",
        drop_rate: float = 0.0,
        v2e_aggr: Optional[str] = None,
        v2e_weight: Optional[torch.Tensor] = None,
        v2e_drop_rate: Optional[float] = None,
        e_weight: Optional[torch.Tensor] = None,
        e2v_aggr: Optional[str] = None,
        e2v_weight: Optional[torch.Tensor] = None,
        e2v_drop_rate: Optional[float] = None,
    )

Source from the content-addressed store, hash-verified

1744 return X
1745
1746 def v2v_of_group(
1747 self,
1748 group_name: str,
1749 X: torch.Tensor,
1750 aggr: str = "mean",
1751 drop_rate: float = 0.0,
1752 v2e_aggr: Optional[str] = None,
1753 v2e_weight: Optional[torch.Tensor] = None,
1754 v2e_drop_rate: Optional[float] = None,
1755 e_weight: Optional[torch.Tensor] = None,
1756 e2v_aggr: Optional[str] = None,
1757 e2v_weight: Optional[torch.Tensor] = None,
1758 e2v_drop_rate: Optional[float] = None,
1759 ):
1760 r"""Message passing of ``vertices to vertices`` in specified hyperedge group. The combination of ``v2e_of_group`` and ``e2v_of_group``.
1761
1762 Args:
1763 ``group_name`` (``str``): The specified hyperedge group.
1764 ``X`` (``torch.Tensor``): Vertex feature matrix. Size :math:`(|\mathcal{V}|, C)`.
1765 ``aggr`` (``str``): The aggregation method. Can be ``'mean'``, ``'sum'`` and ``'softmax_then_sum'``. If specified, this ``aggr`` will be used to both ``v2e_of_group`` and ``e2v_of_group``.
1766 ``drop_rate`` (``float``): Dropout rate. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. Default: ``0.0``.
1767 ``v2e_aggr`` (``str``, optional): The aggregation method for hyperedges to vertices. Can be ``'mean'``, ``'sum'`` and ``'softmax_then_sum'``. If specified, it will override the ``aggr`` in ``e2v_of_group``.
1768 ``v2e_weight`` (``torch.Tensor``, optional): The weight vector attached to connections (vertices point to hyepredges). If not specified, the function will use the weights specified in hypergraph construction. Defaults to ``None``.
1769 ``v2e_drop_rate`` (``float``, optional): Dropout rate for hyperedges to vertices. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. If specified, it will override the ``drop_rate`` in ``e2v_of_group``. Default: ``None``.
1770 ``e_weight`` (``torch.Tensor``, optional): The hyperedge weight vector. If not specified, the function will use the weights specified in hypergraph construction. Defaults to ``None``.
1771 ``e2v_aggr`` (``str``, optional): The aggregation method for vertices to hyperedges. Can be ``'mean'``, ``'sum'`` and ``'softmax_then_sum'``. If specified, it will override the ``aggr`` in ``v2e_of_group``.
1772 ``e2v_weight`` (``torch.Tensor``, optional): The weight vector attached to connections (hyperedges point to vertices). If not specified, the function will use the weights specified in hypergraph construction. Defaults to ``None``.
1773 ``e2v_drop_rate`` (``float``, optional): Dropout rate for vertices to hyperedges. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. If specified, it will override the ``drop_rate`` in ``v2e_of_group``. Default: ``None``.
1774 """
1775 assert (
1776 group_name in self.group_names
1777 ), f"The specified {group_name} is not in existing hyperedge groups."
1778 if v2e_aggr is None:
1779 v2e_aggr = aggr
1780 if e2v_aggr is None:
1781 e2v_aggr = aggr
1782 if v2e_drop_rate is None:
1783 v2e_drop_rate = drop_rate
1784 if e2v_drop_rate is None:
1785 e2v_drop_rate = drop_rate
1786 X = self.v2e_of_group(
1787 group_name, X, v2e_aggr, v2e_weight, e_weight, drop_rate=v2e_drop_rate
1788 )
1789 X = self.e2v_of_group(
1790 group_name, X, e2v_aggr, e2v_weight, drop_rate=e2v_drop_rate
1791 )
1792 return X

Callers

nothing calls this directly

Calls 2

v2e_of_groupMethod · 0.95
e2v_of_groupMethod · 0.95

Tested by

no test coverage detected