code: def read_tu_data(
      folder: str,
      prefix: str,
  ) -> Tuple[Data, Dict[str, Tensor], Dict[str, int]]:
      files = fs.glob(osp.join(folder, f"{prefix}_*.txt"))
      names = [osp.basename(f)[len(prefix) + 1 : -4] for f in files]
  
      edge_index = read_file(folder, prefix, "A", torch.long).t() - 1
      batch = (
          read_file(folder, prefix, "graph_indicator", torch.long) - 1
      )
  
      node_attribute = torch.empty((batch.size(0), 0))
      if "node_attributes" in names:
          node_attribute = read_file(folder, prefix, "node_attributes")
          if node_attribute.dim() == 1:
              node_attribute = node_attribute.unsqueeze(-1)
  
      node_label = torch.empty((batch.size(0), 0))
      if "node_labels" in names:
          node_label = read_file(
              folder, prefix, "node_labels", torch.long
          )
          if node_label.dim() == 1:
              node_label = node_label.unsqueeze(-1)
          node_label = node_label - node_label.min(dim=0)[0]
          node_labels = node_label.unbind(dim=-1)
          node_labels = [one_hot(x) for x in node_labels]
          if len(node_labels) == 1:
              node_label = node_labels[0]
          else:
              node_label = torch.cat(node_labels, dim=-1)
  
      edge_attribute = torch.empty((edge_index.size(1), 0))
      if "edge_attributes" in names:
          edge_attribute = read_file(folder, prefix, "edge_attributes")
          if edge_attribute.dim() == 1:
              edge_attribute = edge_attribute.unsqueeze(-1)
  
      edge_label = torch.empty((edge_index.size(1), 0))
      if "edge_labels" in names:
          edge_label = read_file(
              folder, prefix, "edge_labels", torch.long
          )
          if edge_label.dim() == 1:
              edge_label = edge_label.unsqueeze(-1)
          edge_label = edge_label - edge_label.min(dim=0)[0]
          edge_labels = edge_label.unbind(dim=-1)
          edge_labels = [one_hot(e) for e in edge_labels]
          if len(edge_labels) == 1:
              edge_label = edge_labels[0]
          else:
              edge_label = torch.cat(edge_labels, dim=-1)
  
      x = cat([node_attribute, node_label])
      edge_attr = cat([edge_attribute, edge_label])
  
      y = None
      if "graph_attributes" in names:  # Regression problem.
          y = read_file(folder, prefix, "graph_attributes")
      elif "graph_labels" in names:  # Classification problem.
          y = read_file(folder, prefix, "graph_labels", torch.long)
          _, y = y.unique(sorted=True, return_inverse=True)
  
      num_nodes = int(edge_index.max()) + 1 if x is None else x.size(0)
      edge_index, edge_attr = remove_self_loops(edge_index, edge_attr)
      edge_index, edge_attr = coalesce(edge_index, edge_attr, num_nodes)
  
      data = Data(x=x, edge_index=edge_index, edge_attr=edge_attr, y=y)
      data, slices = split(data, batch)
  
      sizes = {
          "num_node_attributes": node_attribute.size(-1),
          "num_node_labels": node_label.size(-1),
          "num_edge_attributes": edge_attribute.size(-1),
          "num_edge_labels": edge_label.size(-1),
      }
  
      return data, slices, sizes
  
file_path: pytorch_geometric/torch_geometric/io/tu.py
imports: import os.path
  from typing import Dict, List, Optional, Tuple
  import numpy
  import torch
  from torch import Tensor
  from torch_geometric.data import Data
  from torch_geometric.io import fs, read_txt_array
  from torch_geometric.utils import coalesce, cumsum, one_hot, remove_self_loops
label_desc: Use image node_id 1 for calling a global function with example usage: read_tu_data(folder, prefix) and returns: data,  slices,  sizes