GNN Models#
- class fedgraph.gnn_models.AggreGCN(nfeat: int, nhid: int, nclass: int, dropout: float, NumLayers: int)[source]#
This class is an Aggregated GCN model with different methods of aggregation on the input features for the graph nodes on the first layer with a linear layer and the rest of the layers with GCNConv layers.
- Parameters:
- forward(aggregated_feature: Tensor, adj_t: Tensor) Tensor [source]#
Represents the forward pass computation of a GCN with different methods of aggregation on the input features for the graph nodes on the first layer with a linear layer and the rest of the layers with GCNConv layers.
- Parameters:
x (torch.Tensor) – Input feature tensor for the graph nodes aggregated by the aggregation method.
adj_t (torch.Tensor) – Adjacency matrix of the graph.
- Returns:
(tensor) – The log softmax of the output of the last layer.
- Return type:
- class fedgraph.gnn_models.GCN(nfeat: int, nhid: int, nclass: int, dropout: float, NumLayers: int)[source]#
A Graph Convolutional Network model implementation which creates a GCN with specified numbers of features, hidden layers, and output classes.
- Parameters:
- forward(x: Tensor, adj_t: Tensor) Tensor [source]#
Represents the forward pass computation of a GCN
- Parameters:
x (torch.Tensor) – Input feature tensor for the graph nodes.
adj_t (torch.Tensor) – Adjacency matrix of the graph.
- Returns:
(tensor)
- Return type:
- class fedgraph.gnn_models.GCN_arxiv(nfeat: int, nhid: int, nclass: int, dropout: float, NumLayers: int)[source]#
A variant of the GCN model tailored for the arXiv dataset.
- Parameters:
- forward(x: Tensor, adj_t: Tensor) Tensor [source]#
Represents the forward pass computation of a GCN
- Parameters:
x (torch.Tensor) – Input feature tensor for the graph nodes.
adj_t (torch.Tensor) – Adjacency matrix of the graph.
- Returns:
(tensor)
- Return type:
- class fedgraph.gnn_models.GCN_products(nfeat: int, nhid: int, nclass: int, dropout: float, NumLayers: int)[source]#
A specialized GCN model implementation designed for product graphs.
- Parameters:
- forward(x: Tensor, adj_t: Tensor) Tensor [source]#
This function represents the forward pass computation of a GCN with products as input features for the graph nodes on the first layer and the rest of the layers with GCNConv layers.
- xtorch.Tensor
Input feature tensor for the graph nodes.
- adj_ttorch.Tensor
Adjacency matrix of the graph.
- Returns:
(tensor)
- Return type:
- class fedgraph.gnn_models.SAGE_products(nfeat: int, nhid: int, nclass: int, dropout: float, NumLayers: int)[source]#
A Graph SAGE model designed specifically for handling product graphs as another variant of GCN.
- Parameters:
- forward(x: Tensor, adj_t: Tensor) Tensor [source]#
Represents the forward pass computation of a Graph Sage model
- Parameters:
x (torch.Tensor) – Input feature tensor for the graph nodes.
adj_t (torch.Tensor) – Adjacency matrix of the graph.
- Returns:
(tensor)
- Return type: