code: def node_counts(self, graph):
      node_types = [
          node.get_attributes()["node_type"]
          for node in graph.get_nodes()
      ]
      a, b = np.unique(node_types, return_counts=True)
      nc = dict(zip(a, b))
      return nc
  
file_path: pytensor/tests/d3viz/test_formatting.py
imports: import numpy
  import pytest
  from pytensor import config, function
  from pytensor.d3viz.formatting import PyDotFormatter
  from pytensor.printing import pydot_imported, pydot_imported_msg
  from tests.d3viz import models
label_desc: Use image node_id 2 for calling the TestPyDotFormatter obj's underlying member method code with example usage: obj.node_counts(graph) and returns: nc