code: def _apply_prediction(G, func, ebunch=None):
      """Applies the given function to each edge in the specified iterable
      of edges.
  
      `G` is an instance of :class:`networkx.Graph`.
  
      `func` is a function on two inputs, each of which is a node in the
      graph. The function can return anything, but it should return a
      value representing a prediction of the likelihood of a "link"
      joining the two nodes.
  
      `ebunch` is an iterable of pairs of nodes. If not specified, all
      non-edges in the graph `G` will be used.
  
      """
      if ebunch is None:
          ebunch = nx.non_edges(G)
      else:
          for u, v in ebunch:
              if u not in G:
                  raise nx.NodeNotFound(f"Node {u} not in G.")
              if v not in G:
                  raise nx.NodeNotFound(f"Node {v} not in G.")
      return ((u, v, func(u, v)) for u, v in ebunch)
  
file_path: networkx/networkx/algorithms/link_prediction.py
imports: from math import log
  import networkx
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 1 for calling a global function with example usage: _apply_prediction(G, func, ebunch) and returns: unknown