gammagl.layers.conv.MixHopConv

class MixHopConv(in_channels, out_channels, p, norm='both', add_bias=True)[source]

The sparsified neighborhood mixing graph convolutional operator from the “MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing” paper

\[\mathit{H^{(i+1)}}=\Vert_{{j\in P}}{\sigma ({\widehat{A}^{j}H^{(i)}W_{j}^{(i)}})},\]

where \(\hat{A} = D^{-\tfrac{1}{2}}(A + I_n)D^{-\tfrac{1}{2}}\) is a symmetrically normalized adjacency matrix with self-connections and \(\hat{D}_{ii} = \sum_{j=0} \hat{A}_{ij}\) its diagonal degree matrix.

Parameters:
  • in_channels (int) – Size of each input sample

  • out_channels (int) – Size of each output sample

  • p (list) – The list of integer adjacency powers

  • norm (str, optional) –

    How to apply the normalizer. Can be one of the following values:

    • right, to divide the aggregated messages by each node’s in-degrees, which is equivalent to averaging the received messages.

    • none, where no normalization is applied.

    • both (default), where the messages are scaled with \(1/c_{ji}\) above, equivalent to symmetric normalization.

    • left, to divide the messages sent out from each node by its out-degrees, equivalent to random walk normalization.

  • add_bias (bool) – If set to False, the layer will not learn an additive bias. (default: True)

forward(x, edge_index, edge_weight=None, num_nodes=None)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.