code: def identify_dense_edges(trace: Trace) -> None:
      """
      Modifies a trace in-place by adding all edges based on the
      `cond_indep_stack` information stored at each site.
      """
      for name, node in trace.nodes.items():
          if site_is_subsample(node):
              continue
          if node["type"] == "sample":
              for past_name, past_node in trace.nodes.items():
                  if site_is_subsample(past_node):
                      continue
                  if past_node["type"] == "sample":
                      if past_name == name:
                          break
                      past_node_independent = False
                      for query, target in zip(
                          node["cond_indep_stack"],
                          past_node["cond_indep_stack"],
                      ):
                          if (
                              query.name == target.name
                              and query.counter != target.counter
                          ):
                              past_node_independent = True
                              break
                      if not past_node_independent:
                          trace.add_edge(past_name, name)
  
imports: import sys
  from typing import TYPE_CHECKING, Any, Callable, Literal, Optional
  from typing_extensions import Self
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.trace_struct import Trace
  from pyro.poutine.util import site_is_subsample
label_desc: Use image node_id 1 for calling a global function with example usage: identify_dense_edges(trace) without return types