- class RandomPartitionGraphDataset(root, num_classes: int, num_nodes_per_class: int, node_homophily_ratio: float, average_degree: float, num_channels: Optional[int] = None, is_undirected: bool = True, transform: Optional[Callable] = None, pre_transform: Optional[Callable] = None, **kwargs)[source]
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
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_channels (int, optional) – The number of node features. If given as
None, node features are not generated. (default:
is_undirected (bool, optional) – Whether the graph to generate is undirected. (default:
transform (callable, optional) – A function/transform that takes in an
torch_geometric.data.Dataobject and returns a transformed version. The data object will be transformed before every access. (default:
pre_transform (callable, optional) – A function/transform that takes in an
torch_geometric.data.Dataobject and returns a transformed version. The data object will be transformed before being saved to disk. (default:
**kwargs (optional) – The keyword arguments that are passed down to
sklearn.datasets.make_classification()method in drawing node features.