code: def graph_link_predictor(
      name, train_data, preproc, layer_sizes=[20, 20], verbose=1
  ):
      """
      ```
      Build and return a neural link prediction model.
  
      Args:
          name (string): one of:
                        - 'graphsage' for GraphSAGE model
                        (only GraphSAGE currently supported)
  
          train_data (LinkSequenceWrapper): a ktrain.graph.sg_wrappers.LinkSequenceWrapper object
          preproc(LinkPreprocessor): a LinkPreprocessor instance
          verbose (boolean): verbosity of output
      Return:
          model (Model): A Keras Model instance
      ```
      """
      from .sg_wrappers import LinkSequenceWrapper
  
      # check argument
      if not isinstance(train_data, LinkSequenceWrapper):
          err = """
              train_data must be a ktrain.graph.sg_wrappers.LinkSequenceWrapper object
              """
          raise Exception(err)
      if len(layer_sizes) != len(preproc.sample_sizes):
          raise ValueError(
              "number of layer_sizes must match len(preproc.sample_sizes)"
          )
  
      num_classes = U.nclasses_from_data(train_data)
  
      # set loss and activations
      loss_func = "categorical_crossentropy"
      activation = "softmax"
  
      # import stellargraph
      try:
          import stellargraph as sg
          from stellargraph.layer import GraphSAGE, link_classification
      except:
          raise Exception(SG_ERRMSG)
      if version.parse(sg.__version__) < version.parse("0.8"):
          raise Exception(SG_ERRMSG)
  
      # build a GraphSAGE link prediction model
      graphsage = GraphSAGE(
          layer_sizes=layer_sizes,
          generator=train_data,
          bias=True,
          dropout=0.3,
      )
      x_inp, x_out = graphsage.build()
      prediction = link_classification(
          output_dim=1, output_act="relu", edge_embedding_method="ip"
      )(x_out)
      model = keras.Model(inputs=x_inp, outputs=prediction)
      model.compile(
          optimizer=U.DEFAULT_OPT,
          loss="binary_crossentropy",
          metrics=["accuracy"],
      )
      return model
  
imports: from ..None import utils
  from ..imports import *
label_desc: Use image node_id 4 for calling a global function with example usage: graph_link_predictor(name, train_data, preproc, layer_sizes, verbose) and returns: model