data
- class cogdl.data.Adjacency(row=None, col=None, row_ptr=None, weight=None, attr=None, num_nodes=None, types=None, **kwargs)[source]
Bases:
cogdl.data.data.BaseGraph
- property device
- property edge_index
- get_weight(indicator=None)[source]
If indicator is not None, the normalization will not be implemented
- property keys
Returns all names of graph attributes.
- property num_edges
- property num_nodes
- property row_indptr
- property row_ptr_v
- class cogdl.data.Batch(batch=None, **kwargs)[source]
Bases:
cogdl.data.data.Graph
A plain old python object modeling a batch of graphs as one big (dicconnected) graph. With
cogdl.data.Data
being the base class, all its methods can also be used here. In addition, single graphs can be reconstructed via the assignment vectorbatch
, which maps each node to its respective graph identifier.- cumsum(key, item)[source]
If
True
, the attributekey
with contentitem
should be added up cumulatively before concatenated together.Note
This method is for internal use only, and should only be overridden if the batch concatenation process is corrupted for a specific data attribute.
- static from_data_list(data_list, class_type=None)[source]
Constructs a batch object from a python list holding
cogdl.data.Data
objects. The assignment vectorbatch
is created on the fly. Additionally, creates assignment batch vectors for each key infollow_batch
.
- property num_graphs
Returns the number of graphs in the batch.
- class cogdl.data.DataLoader(*args, **kwargs)[source]
Bases:
Generic
[torch.utils.data.dataloader.T_co
]Data loader which merges data objects from a
cogdl.data.dataset
to a mini-batch.- Parameters
- dataset: torch.utils.data.dataset.Dataset[torch.utils.data.dataloader.T_co]
- sampler: torch.utils.data.sampler.Sampler
- class cogdl.data.Dataset(root, transform=None, pre_transform=None, pre_filter=None)[source]
Bases:
Generic
[torch.utils.data.dataset.T_co
]Dataset base class for creating graph datasets.
- Parameters
root (string) – Root directory where the dataset should be saved.
transform (callable, optional) – A function/transform that takes in an
cogdl.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
cogdl.data.Data
object and returns a transformed version. The data object will be transformed before being saved to disk. (default:None
)pre_filter (callable, optional) – A function that takes in an
cogdl.data.Data
object and returns a boolean value, indicating whether the data object should be included in the final dataset. (default:None
)
- property edge_attr_size
- property max_degree
- property max_graph_size
- property num_classes
The number of classes in the dataset.
- property num_features
Returns the number of features per node in the graph.
- property num_graphs
- property processed_file_names
The name of the files to find in the
self.processed_dir
folder in order to skip the processing.
- property processed_paths
The filepaths to find in the
self.processed_dir
folder in order to skip the processing.
- property raw_file_names
The name of the files to find in the
self.raw_dir
folder in order to skip the download.
- property raw_paths
The filepaths to find in order to skip the download.
- class cogdl.data.Graph(x=None, y=None, **kwargs)[source]
Bases:
cogdl.data.data.BaseGraph
- property col_indices
- property device
- property edge_attr
- property edge_index
- property edge_types
- property edge_weight
Return actual edge_weight
- property in_norm
- property keys
Returns all names of graph attributes.
- property num_classes
- property num_edges
Returns the number of edges in the graph.
- property num_features
Returns the number of features per node in the graph.
- property num_nodes
- property out_norm
- property raw_edge_weight
Return edge_weight without __in_norm__ and __out_norm__, only used for SpMM
- property row_indptr
- property test_nid
- property train_nid
- property val_nid
- class cogdl.data.MultiGraphDataset(root=None, transform=None, pre_transform=None, pre_filter=None)[source]
Bases:
Generic
[torch.utils.data.dataset.T_co
]- property max_degree
- property max_graph_size
- property num_classes
The number of classes in the dataset.
- property num_features
Returns the number of features per node in the graph.
- property num_graphs