code: def test_pyg_to_graphs_global(self):
      import deepsnap
  
      deepsnap.use(nx)
  
      pyg_dataset = Planetoid("./planetoid", "Cora")
      graphs = GraphDataset.pyg_to_graphs(pyg_dataset)
      self.assertTrue(isinstance(graphs[0].G, nx.Graph))
      dataset = GraphDataset(graphs, task="node")
      num_nodes = dataset.num_nodes[0]
      node_0 = int(0.8 * num_nodes)
      node_1 = int(0.1 * num_nodes)
      node_2 = num_nodes - node_0 - node_1
      train, val, test = dataset.split()
      self.assertTrue(isinstance(train[0].G, nx.Graph))
      self.assertTrue(isinstance(val[0].G, nx.Graph))
      self.assertTrue(isinstance(test[0].G, nx.Graph))
      self.assertEqual(train[0].node_label_index.shape[0], node_0)
      self.assertEqual(val[0].node_label_index.shape[0], node_1)
      self.assertEqual(test[0].node_label_index.shape[0], node_2)
  
      train_loader = DataLoader(
          train, collate_fn=Batch.collate(), batch_size=1
      )
      for batch in train_loader:
          self.assertTrue(isinstance(batch.G[0], nx.Graph))
  
      deepsnap.use(sx)
      graphs = GraphDataset.pyg_to_graphs(pyg_dataset)
      self.assertTrue(isinstance(graphs[0].G, sx.Graph))
      dataset = GraphDataset(graphs, task="node")
      num_nodes = dataset.num_nodes[0]
      node_0 = int(0.8 * num_nodes)
      node_1 = int(0.1 * num_nodes)
      node_2 = num_nodes - node_0 - node_1
      train, val, test = dataset.split()
      self.assertTrue(isinstance(train[0].G, sx.Graph))
      self.assertTrue(isinstance(val[0].G, sx.classes.graph.Graph))
      self.assertTrue(isinstance(test[0].G, sx.classes.graph.Graph))
      self.assertEqual(train[0].node_label_index.shape[0], node_0)
      self.assertEqual(val[0].node_label_index.shape[0], node_1)
      self.assertEqual(test[0].node_label_index.shape[0], node_2)
  
      train_loader = DataLoader(
          train, collate_fn=Batch.collate(), batch_size=1
      )
      for batch in train_loader:
          self.assertTrue(isinstance(batch.G[0], sx.Graph))
  
file_path: deepsnap/tests/test_graph_backend.py
imports: import snap
  import snapx
  import unittest
  import torch
  import networkx
  from torch.utils.data import DataLoader
  from torch_geometric.datasets import Planetoid
  from deepsnap.graph import Graph
  from deepsnap.batch import Batch
  from deepsnap.dataset import GraphDataset
label_desc: Use image node_id 4 for calling the TestGraphBackend obj's underlying member method code with example usage: obj.test_pyg_to_graphs_global() without return types