code: def has_path(G, source, target):
      """Returns *True* if *G* has a path from *source* to *target*.
  
      Parameters
      ----------
      G : NetworkX graph
  
      source : node
         Starting node for path
  
      target : node
         Ending node for path
      """
      try:
          nx.shortest_path(G, source, target)
      except nx.NetworkXNoPath:
          return False
      return True
  
file_path: networkx/networkx/algorithms/shortest_paths/generic.py
imports: import warnings
  import networkx
label_desc: Use image node_id 1 for calling a global function with example usage: has_path(G, source, target) and returns: True, False