code: def is_cycle(g):
      size = g.num_nodes()
  
      if size < 3:
          return False
  
      for node in range(size):
          neighbors = g.successors(node)
  
          if len(neighbors) != 2:
              return False
  
          if get_previous(node, size - 1) not in neighbors:
              return False
  
          if get_next(node, size - 1) not in neighbors:
              return False
  
      return True
  
imports: import os
  import pickle
  import random
  import matplotlib.pyplot
  import networkx
  from torch.utils.data import Dataset
label_desc: Use image node_id 3 for calling a global function with example usage: is_cycle(g) and returns: True, False, False, False, False