code: def graph_gen():
      def generator(num_nodes, seed, weight=None):
          np.random.seed(seed)
  
          sm = StructureModel()
          nodes = list(
              "".join(x)
              for x in product(
                  string.ascii_lowercase, string.ascii_lowercase
              )
          )[:num_nodes]
          np.random.shuffle(nodes)
          sm.add_nodes_from(nodes)
  
          # one edge:
          sm.add_weighted_edges_from([("aa", "ab", weight)])
          return sm
  
      return generator
  
imports: import re
  import string
  from itertools import product
  import numpy
  import pandas
  import pytest
  from scipy import stats
  from sklearn.gaussian_process.kernels import RBF
  from causalnex.structure import StructureModel
  from causalnex.structure.data_generators import gen_stationary_dyn_net_and_df, generate_binary_data, generate_binary_dataframe, generate_categorical_dataframe, generate_continuous_data, generate_continuous_dataframe, generate_count_dataframe, generate_dataframe_dynamic, generate_structure, generate_structure_dynamic
  from tests.structure.data_generators.test_core import calculate_proba
label_desc: Use image node_id 2 for calling a global function with example usage: graph_gen() and returns: generator, sm