Accessing Graphs as NetworkX Objects

The datasets discussed above can be converted into datasets of NetworkX graphs by calling the to_nx method. This method returns a NetworkXView object.

polygraph.datasets.base.NetworkXView

View of a dataset that provides graphs in NetworkX format.

This class wraps a dataset to provide access to graphs as NetworkX objects rather than PyTorch Geometric Data objects.

Parameters:

__len__()

Gets the number of graphs in the dataset.

__getitem__(idx)

Gets a graph from the dataset by index.

Parameters:
  • idx (int) –

    Index of the graph to retrieve

Returns:
  • Graph

    Graph as a NetworkX object