class_docstr: Dynamic graph layout during computation
  
  This assigns (x, y) locations to all tasks quickly and dynamically as new
  tasks are added.  This scales to a few thousand nodes.
  
  It is commonly used with distributed/dashboard/components/scheduler.py::TaskGraph, which
  is rendered at /graph on the diagnostic dashboard.
docstr: Reset the index and refill new and new_edges
  
  From time to time TaskGraph wants to remove invisible nodes and reset
  all of its indices.  This helps.
docstr_tok: ["Reset","the","index","and","refill","new","and","new_edges","From","time","to","time","TaskGraph","wants","to","remove","invisible","nodes","and","reset","all","of","its","indices",".","This","helps","."]
code: def reset_index(self):
      """Reset the index and refill new and new_edges
  
      From time to time TaskGraph wants to remove invisible nodes and reset
      all of its indices.  This helps.
      """
      self.new = []
      self.new_edges = []
      self.visible_updates = []
      self.state_updates = []
      self.visible_edge_updates = []
  
      self.index = {}
      self.next_index = 0
      self.index_edge = {}
      self.next_edge_index = 0
  
      for key in self.x:
          self.index[key] = self.next_index
          self.next_index += 1
          self.new.append(key)
          for dep in self.scheduler.tasks[key].dependencies:
              edge = (dep.key, key)
              self.index_edge[edge] = self.next_edge_index
              self.next_edge_index += 1
              self.new_edges.append(edge)
  
file_path: distributed/distributed/diagnostics/graph_layout.py
imports: from __future__ import annotations
  import uuid
  from distributed.diagnostics.plugin import SchedulerPlugin
  from distributed.utils import TupleComparable
label_desc: Use image node_id 4 for calling the GraphLayout obj's underlying member method code with example usage: obj.reset_index() without return types