docs: def add_edge_fun(graph):
      """
      Returns a function that adds an edge to the `graph` checking only the out
      node.
  
      :param graph:
          A directed graph.
      :type graph: networkx.classes.digraph.DiGraph
  
      :return:
          A function that adds an edge to the `graph`.
      :rtype: callable
      """
  
      # Namespace shortcut for speed.
      succ, pred, node = graph._succ, graph._pred, graph._node
  
      def add_edge(u, v, **attr):
          if v not in succ:  # Add nodes.
              succ[v], pred[v], node[v] = {}, {}, {}
  
          succ[u][v] = pred[v][u] = attr  # Add the edge.
  
      return add_edge