code: def get_milieu_graph_from_search(
      search_term, src, dst, edf, both=False
  ):
      """
      Can think of this as finding all 2-hop connections from a given `search_term`. It will find all direct edges to
      `search_term` as well as the edges of all those entities. It shows the `milieu graph` of the `search_term`
      :param search_term:
      :param src:
      :param dst:
      :param edf:
      :param both: to retrieve edges from both src and dst columns of dataframe -- if true, returns a larger edgeDataFrame
      :return:
      """
      # get all the entities in either column
      # tdf = pd.concat([search_to_df(search_term, src, edf), search_to_df(search_term, dst, edf)], axis=0)
      tdf = get_nearest(search_term, src, dst, edf)
      # now find all their nearest connections.
      if both:
          gcols = pd.concat([tdf[dst], tdf[src]], axis=0)
          logger.info(
              f"Then finding all edges from {search_term} in {src} and {dst} columns of full edgeDataFrame"
          )
          df = edf[(edf[src].isin(gcols) | edf[dst].isin(gcols))]
      else:
          # logger.info(f'Finding {search_term} in {src} columns')
          # tdf = search_to_df(search_term, src, edf)
          logger.info(
              f"Then finding {src} columns with edges from {search_term} in {dst} column of full edgeDataFrame"
          )
          df = edf[edf[src].isin(list(tdf[dst]) + [search_term])]
      return df
  
file_path: pygraphistry/graphistry/ai_utils.py
imports: import pandas
  import numpy
  import graphistry
  from .constants import DISTANCE, WEIGHT, BATCH
  from logging import getLogger
label_desc: Use image node_id 4 for calling a global function with example usage: get_milieu_graph_from_search(search_term, src, dst, edf, both) and returns: df