code: def define_sets(nm, neighborhoods: dict, rev_neighborhoods: dict):
      """
      Define sets of points for the incremental LOF algorithm.
      """
      # Define set of new points from batch
      set_new_points = set(range(nm[0], nm[0] + nm[1]))
      set_neighbors: set = set()
      set_rev_neighbors: set = set()
  
      # Define neighbors and reverse neighbors of new data points
      for i in set_new_points:
          set_neighbors = set(set_neighbors) | set(neighborhoods[i])
          set_rev_neighbors = set(set_rev_neighbors) | set(
              rev_neighborhoods[i]
          )
  
      # Define points that need to update their local reachability distance because of new data points
      set_upd_lrd = set_rev_neighbors
      for j in set_rev_neighbors:
          set_upd_lrd = set_upd_lrd | set(rev_neighborhoods[j])
      set_upd_lrd = set_upd_lrd | set_new_points
  
      # Define points that need to update their lof because of new data points
      set_upd_lof = set_upd_lrd
      for m in set_upd_lrd:
          set_upd_lof = set_upd_lof | set(rev_neighborhoods[m])
      set_upd_lof = set_upd_lof
  
      return (
          set_new_points,
          set_neighbors,
          set_rev_neighbors,
          set_upd_lrd,
          set_upd_lof,
      )
  
imports: from __future__ import annotations
  import copy
  import functools
  import pandas
  from river import anomaly, utils
  from river.neighbors.base import DistanceFunc
label_desc: Use image node_id 3 for calling a global function with example usage: define_sets(nm, neighborhoods, rev_neighborhoods) and returns: set_new_points,  set_neighbors,  set_rev_neighbors,  set_upd_lrd,  set_upd_lof