code: def graph_links_from_csv(
      nodes_filepath,
      links_filepath,
      sample_sizes=[10, 20],
      train_pct=0.1,
      val_pct=0.1,
      sep=",",
      holdout_pct=None,
      holdout_for_inductive=False,
      missing_label_value=None,
      random_state=None,
      verbose=1,
  ):
      """
      ```
      Loads graph data from CSV files.
      Returns generators for links in graph for use with GraphSAGE model.
      Args:
          nodes_filepath(str): file path to training CSV containing node attributes
          links_filepath(str): file path to training CSV describing links among nodes
          sample_sizes(int): Number of nodes to sample at each neighborhood level.
          train_pct(float): Proportion of edges to use for training.
                            Default is 0.1.
                            Note that train_pct is applied after val_pct is applied.
          val_pct(float): Proportion of edges to use for validation
          sep (str):  delimiter for CSVs. Default is comma.
          random_state (int):  random seed for train/test split
          verbose (boolean): verbosity
      Return:
          tuple of EdgeSequenceWrapper objects for train and validation sets and LinkPreprocessor
      ```
      """
      try:
          import networkx as nx
      except ImportError:
          raise ImportError(
              "Please install networkx:  pip install networkx"
          )
  
      # import stellargraph
      try:
          import stellargraph as sg
          from stellargraph.data import EdgeSplitter
      except:
          raise Exception(SG_ERRMSG)
      if version.parse(sg.__version__) < version.parse("0.8"):
          raise Exception(SG_ERRMSG)
  
      # ----------------------------------------------------------------
      # read graph structure
      # ----------------------------------------------------------------
      nx_sep = None if sep in [" ", "\t"] else sep
      G = nx.read_edgelist(path=links_filepath, delimiter=nx_sep)
      # print(nx.info(G))
  
      # ----------------------------------------------------------------
      # read node attributes
      # ----------------------------------------------------------------
      node_attr = pd.read_csv(nodes_filepath, sep=sep, header=None)
      num_features = (
          len(node_attr.columns.values) - 1
      )  # subract ID and treat all other columns as features
      feature_names = ["w_{}".format(ii) for ii in range(num_features)]
      node_data = pd.read_csv(
          nodes_filepath, header=None, names=feature_names, sep=sep
      )
      node_data.index = node_data.index.map(str)
      df = node_data[node_data.index.isin(list(G.nodes()))]
      for col in feature_names:
          if not isinstance(node_data[col].values[0], str):
              continue
          df = pd.concat(
              [
                  df,
                  df[col]
                  .astype("str")
                  .str.get_dummies()
                  .add_prefix(col + "_"),
              ],
              axis=1,
              sort=False,
          )
          df = df.drop([col], axis=1)
      feature_names = df.columns.values
      node_data = df
      node_features = node_data[feature_names].values
      for nid, f in zip(node_data.index, node_features):
          G.nodes[nid][sg.globalvar.TYPE_ATTR_NAME] = "node"
          G.nodes[nid]["feature"] = f
  
      # ----------------------------------------------------------------
      # train/validation sets
      # ----------------------------------------------------------------
      edge_splitter_test = EdgeSplitter(G)
      (
          G_test,
          edge_ids_test,
          edge_labels_test,
      ) = edge_splitter_test.train_test_split(
          p=val_pct, method="global", keep_connected=True
      )
      edge_splitter_train = EdgeSplitter(G_test)
      (
          G_train,
          edge_ids_train,
          edge_labels_train,
      ) = edge_splitter_train.train_test_split(
          p=train_pct, method="global", keep_connected=True
      )
      epp = LinkPreprocessor(G, sample_sizes=sample_sizes)
      trn = epp.preprocess_train(
          G_train, edge_ids_train, edge_labels_train
      )
      val = epp.preprocess_valid(
          G_test, edge_ids_test, edge_labels_test
      )
  
      return (trn, val, epp)
  
imports: from ..None import utils
  from ..imports import *
  from .preprocessor import LinkPreprocessor, NodePreprocessor
label_desc: Use image node_id 2 for calling a global function with example usage: graph_links_from_csv(nodes_filepath, links_filepath, sample_sizes, train_pct, val_pct, sep, holdout_pct, holdout_for_inductive, missing_label_value, random_state, verbose) and returns: trn,  val,  epp