code: def _compute_styles(self, element, ranges, style):
      elstyle = self.lookup_options(element, "style")
      color = elstyle.kwargs.get("node_color")
      cdim = element.nodes.get_dimension(self.color_index)
      cmap = elstyle.kwargs.get("cmap", "tab20")
      if cdim:
          cs = element.nodes.dimension_values(self.color_index)
          # Check if numeric otherwise treat as categorical
          if cs.dtype.kind == "f":
              style["node_c"] = cs
          else:
              factors = unique_array(cs)
              cmap = color if isinstance(color, Cycle) else cmap
              if isinstance(cmap, dict):
                  colors = [
                      cmap.get(
                          f,
                          cmap.get("NaN", {"color": self._default_nan})[
                              "color"
                          ],
                      )
                      for f in factors
                  ]
              else:
                  colors = process_cmap(cmap, len(factors))
              cs = search_indices(cs, factors)
              style["node_facecolors"] = [
                  colors[v % len(colors)] for v in cs
              ]
              style.pop("node_color", None)
          if "node_c" in style:
              self._norm_kwargs(element.nodes, ranges, style, cdim)
      elif color and "node_color" in style:
          style["node_facecolors"] = style.pop("node_color")
      style["node_edgecolors"] = style.pop("node_edgecolors", "none")
      if is_number(style.get("node_size")):
          style["node_s"] = style.pop("node_size") ** 2
  
      edge_cdim = element.get_dimension(self.edge_color_index)
      if not edge_cdim:
          if not isscalar(style.get("edge_color")):
              opt = (
                  "edge_facecolors"
                  if self.filled
                  else "edge_edgecolors"
              )
              style[opt] = style.pop("edge_color")
          return style
  
      elstyle = self.lookup_options(element, "style")
      cycle = elstyle.kwargs.get("edge_color")
      idx = element.get_dimension_index(edge_cdim)
      cvals = element.dimension_values(edge_cdim)
      if idx in [0, 1]:
          factors = element.nodes.dimension_values(2, expanded=False)
      elif idx == 2 and cvals.dtype.kind in "uif":
          factors = None
      else:
          factors = unique_array(cvals)
      if factors is None or (
          factors.dtype.kind == "f" and idx not in [0, 1]
      ):
          style["edge_c"] = cvals
      else:
          cvals = search_indices(cvals, factors)
          factors = list(factors)
          cmap = elstyle.kwargs.get("edge_cmap", "tab20")
          cmap = cycle if isinstance(cycle, Cycle) else cmap
          if isinstance(cmap, dict):
              colors = [
                  cmap.get(
                      f,
                      cmap.get("NaN", {"color": self._default_nan})[
                          "color"
                      ],
                  )
                  for f in factors
              ]
          else:
              colors = process_cmap(cmap, len(factors))
          style["edge_colors"] = [
              colors[v % len(colors)] for v in cvals
          ]
          style.pop("edge_color", None)
      if "edge_c" in style:
          self._norm_kwargs(
              element, ranges, style, edge_cdim, prefix="edge_"
          )
      else:
          style.pop("edge_cmap", None)
      return style
  
imports: import warnings
  import numpy
  import param
  from matplotlib.collections import LineCollection, PolyCollection
  from ...core.data import Dataset
  from ...core.options import Cycle, abbreviated_exception
  from ...core.util import is_number, isscalar, search_indices, unique_array
  from ...util.transform import dim
  from ..mixins import ChordMixin, GraphMixin
  from ..util import get_directed_graph_paths, process_cmap
  from .element import ColorbarPlot
  from .util import filter_styles
label_desc: Use image node_id 1 for calling the GraphPlot obj's underlying member method code with example usage: obj._compute_styles(element, ranges, style) and returns: style, style