class_docstr: Class for generating training and test data for link prediction in graphs.
  
  The class requires as input a graph (in networkx format) and a percentage as a function of the total number of edges
  in the given graph of the number of positive and negative edges to sample. For heterogeneous graphs, the caller
  can also specify the type of edge and an edge property to split on. In the latter case, only a date property
  can be used and it must be in the format ``dd/mm/yyyy``. A date to be used as a threshold value such that only
  edges that have date after the threshold must be given. This effects only the sampling of positive edges.
  
  Negative edges are sampled at random by (for 'global' method) selecting two nodes in the graph and
  then checking if these edges are connected or not. If not, the pair of nodes is considered a negative sample.
  Otherwise, it is discarded and the process repeats. Alternatively, negative edges are sampled (for 'local' method)
  using DFS search at a distance from the source node (selected at random from all nodes in the graph)
  sampled according to a given set of probabilities.
  
  Positive edges can be sampled so that when they are subsequently removed from the graph, the reduced graph is either
  guaranteed, or not guaranteed, to remain connected. In the former case, graph connectivity is maintained by first
  calculating the minimum spanning tree. The edges that belong to the minimum spanning tree are protected from
  removal, and therefore cannot be sampled for the training set. The edges that do not belong to the minimum spanning
  tree are then sampled uniformly at random, until the required number of positive edges have been sampled for the
  training set. In the latter case, when connectedness of the reduced graph is not guaranteed, positive edges are
  sampled uniformly at random from all the edges in the graph, regardless of whether they belong to the spanning tree
  (which is not calculated in this case).
  
  Args:
      g (StellarGraph or networkx object): The graph to sample edges from.
      g_master (StellarGraph or networkx object): The graph representing the original dataset and a superset of the
          graph g. If it is not None, then when positive and negative edges are sampled, care is taken to make sure
          that a true positive edge is not sampled as a negative edge.
class_docstr_tok: ["Class","for","generating","training","and","test","data","for","link","prediction","in","graphs",".","The","class","requires","as","input","a","graph","(","in","networkx","format",")","and","a","percentage","as","a","function","of","the","total","number","of","edges","in","the","given","graph","of","the","number","of","positive","and","negative","edges","to","sample",".","For","heterogeneous","graphs",",","the","caller","can","also","specify","the","type","of","edge","and","an","edge","property","to","split","on",".","In","the","latter","case",",","only","a","date","property","can","be","used","and","it","must","be","in","the","format","``","dd\/mm\/yyyy","``",".","A","date","to","be","used","as","a","threshold","value","such","that","only","edges","that","have","date","after","the","threshold","must","be","given",".","This","effects","only","the","sampling","of","positive","edges",".","Negative","edges","are","sampled","at","random","by","(","for","'global","'","method",")","selecting","two","nodes","in","the","graph","and","then","checking","if","these","edges","are","connected","or","not",".","If","not",",","the","pair","of","nodes","is","considered","a","negative","sample",".","Otherwise",",","it","is","discarded","and","the","process","repeats",".","Alternatively",",","negative","edges","are","sampled","(","for","'local","'","method",")","using","DFS","search","at","a","distance","from","the","source","node","(","selected","at","random","from","all","nodes","in","the","graph",")","sampled","according","to","a","given","set","of","probabilities",".","Positive","edges","can","be","sampled","so","that","when","they","are","subsequently","removed","from","the","graph",",","the","reduced","graph","is","either","guaranteed",",","or","not","guaranteed",",","to","remain","connected",".","In","the","former","case",",","graph","connectivity","is","maintained","by","first","calculating","the","minimum","spanning","tree",".","The","edges","that","belong","to","the","minimum","spanning","tree","are","protected","from","removal",",","and","therefore","can","not","be","sampled","for","the","training","set",".","The","edges","that","do","not","belong","to","the","minimum","spanning","tree","are","then","sampled","uniformly","at","random",",","until","the","required","number","of","positive","edges","have","been","sampled","for","the","training","set",".","In","the","latter","case",",","when","connectedness","of","the","reduced","graph","is","not","guaranteed",",","positive","edges","are","sampled","uniformly","at","random","from","all","the","edges","in","the","graph",",","regardless","of","whether","they","belong","to","the","spanning","tree","(","which","is","not","calculated","in","this","case",")",".","Args",":","g","(","StellarGraph","or","networkx","object",")",":","The","graph","to","sample","edges","from",".","g_master","(","StellarGraph","or","networkx","object",")",":","The","graph","representing","the","original","dataset","and","a","superset","of","the","graph","g.","If","it","is","not","None",",","then","when","positive","and","negative","edges","are","sampled",",","care","is","taken","to","make","sure","that","a","true","positive","edge","is","not","sampled","as","a","negative","edge","."]
docstr: Method that filters the edges in the self.g (heterogeneous) graph based on either the edge type
  specified by edge_label, or based on edges of edge_label type that have property edge_attribute_label and
  the value of the latter property is larger than the edge_attribute_threshold.
  
  Args:
      edge_label (str): The type of edges to filter
      edge_attribute_label (str, optional): The edge attribute to use for filtering graph edges
      edge_attribute_threshold (str, optional): The threshold applied to the edge attribute for filtering edges.
  
  Returns:
      (list) List of edges that satisfy the filtering criteria.
docstr_tok: ["Method","that","filters","the","edges","in","the","self.g","(","heterogeneous",")","graph","based","on","either","the","edge","type","specified","by","edge_label",",","or","based","on","edges","of","edge_label","type","that","have","property","edge_attribute_label","and","the","value","of","the","latter","property","is","larger","than","the","edge_attribute_threshold",".","Args",":","edge_label","(","str",")",":","The","type","of","edges","to","filter","edge_attribute_label","(","str",",","optional",")",":","The","edge","attribute","to","use","for","filtering","graph","edges","edge_attribute_threshold","(","str",",","optional",")",":","The","threshold","applied","to","the","edge","attribute","for","filtering","edges",".","Returns",":","(","list",")","List","of","edges","that","satisfy","the","filtering","criteria","."]
code: def _get_edges(
      self,
      edge_label,
      edge_attribute_label=None,
      edge_attribute_threshold=None,
  ):
      """
      Method that filters the edges in the self.g (heterogeneous) graph based on either the edge type
      specified by edge_label, or based on edges of edge_label type that have property edge_attribute_label and
      the value of the latter property is larger than the edge_attribute_threshold.
  
      Args:
          edge_label (str): The type of edges to filter
          edge_attribute_label (str, optional): The edge attribute to use for filtering graph edges
          edge_attribute_threshold (str, optional): The threshold applied to the edge attribute for filtering edges.
  
      Returns:
          (list) List of edges that satisfy the filtering criteria.
  
      """
      # the graph in networkx format is stored in self.g_train
      if self.g.is_multigraph():
          all_edges = list(self.g.edges(keys=True))
      else:
          all_edges = list(self.g.edges())
  
      if (
          edge_attribute_label is None
          or edge_attribute_threshold is None
      ):
          # filter by edge_label
          edges_with_label = [
              e
              for e in all_edges
              if self.g.get_edge_data(*e)["label"] == edge_label
          ]
  
      else:
          # filter by edge label, edge attribute and threshold value
          edge_attribute_threshold_dt = datetime.datetime.strptime(
              edge_attribute_threshold, "%d/%m/%Y"
          )
          edges_with_label = [
              e
              for e in all_edges
              if (
                  self.g.get_edge_data(*e)["label"] == edge_label
                  and datetime.datetime.strptime(
                      self.g.get_edge_data(*e)[edge_attribute_label],
                      "%d/%m/%Y",
                  )
                  > edge_attribute_threshold_dt
              )
          ]
  
      return edges_with_label
  
imports: import datetime
  import warnings
  import networkx
  import pandas
  import numpy
  from math import isclose
  from ..core import StellarGraph
  from ..globalvar import FEATURE_ATTR_NAME
label_desc: Use image node_id 5 for calling the EdgeSplitter obj's underlying member method code with example usage: obj._get_edges(edge_label, edge_attribute_label, edge_attribute_threshold) and returns: edges_with_label