code: def _dict_to_nodearray(
      self,
      d: dict[NodeKey, NodeValue] | cp.ndarray[NodeValue],
      default: NodeValue | None = None,
      dtype: Dtype | None = None,
  ) -> cp.ndarray[NodeValue]:
      if isinstance(d, cp.ndarray):
          if d.shape[0] != len(self):
              raise ValueError
          if dtype is not None and d.dtype != dtype:
              return d.astype(dtype)
          return d
      if default is None:
          val_iter = map(d.__getitem__, self)
      else:
          val_iter = (d.get(node, default) for node in self)
      if dtype is None:
          return cp.array(list(val_iter))
      return cp.fromiter(val_iter, dtype)
  
imports: from __future__ import annotations
  import operator
  from copy import deepcopy
  from typing import TYPE_CHECKING
  import cupy
  import networkx
  import numpy
  import pylibcugraph
  import nx_cugraph
  from ..utils import index_dtype
label_desc: Use image node_id 47 for calling the Graph obj's underlying member method code with example usage: obj._dict_to_nodearray(d, default, dtype) and returns: cp, d, cp, d