torch_geometric.datasets.RandomPartitionGraphDataset
- class RandomPartitionGraphDataset(root: str, num_classes: int, num_nodes_per_class: int, node_homophily_ratio: float, average_degree: float, num_graphs: int = 1, num_channels: Optional[int] = None, is_undirected: bool = True, transform: Optional[Callable] = None, pre_transform: Optional[Callable] = None, **kwargs: Any)[source]
Bases:
StochasticBlockModelDataset
The random partition graph dataset from the “How to Find Your Friendly Neighborhood: Graph Attention Design with Self-Supervision” paper. This is a synthetic graph of communities controlled by the node homophily and the average degree, and each community is considered as a class. The node features are sampled from normal distributions where the centers of clusters are vertices of a hypercube, as computed by the
sklearn.datasets.make_classification()
method.- Parameters:
root (str) – Root directory where the dataset should be saved.
num_classes (int) – The number of classes.
num_nodes_per_class (int) – The number of nodes per class.
node_homophily_ratio (float) – The degree of node homophily.
average_degree (float) – The average degree of the graph.
num_graphs (int, optional) – The number of graphs. (default:
1
)num_channels (int, optional) – The number of node features. If given as
None
, node features are not generated. (default:None
)is_undirected (bool, optional) – Whether the graph to generate is undirected. (default:
True
)transform (callable, optional) – A function/transform that takes in an
torch_geometric.data.Data
object and returns a transformed version. The data object will be transformed before every access. (default:None
)pre_transform (callable, optional) – A function/transform that takes in an
torch_geometric.data.Data
object and returns a transformed version. The data object will be transformed before being saved to disk. (default:None
)**kwargs (optional) – The keyword arguments that are passed down to
sklearn.datasets.make_classification()
method in drawing node features.