class_docstr: Universal Gremlin<>pandas/graphistry functionality across Gremlin connectors
  
  Currently serializes queries as strings instead of bytecode in order to support cosmosdb
docstr: Convert traversal results to graphistry object with ._nodes, ._edges
  If only received nodes or edges, populate that field
  For custom src/dst/node bindings, passing in a Graphistry instance with .bind(source=.., destination=..., node=...)
  Otherwise, will do src/dst/id
  For dict results (ex: valueMap/elementMap), specify mode='nodes' ('edges'), else will inspect field 'type'
docstr_tok: ["Convert","traversal","results","to","graphistry","object","with","._nodes",",","._edges","If","only","received","nodes","or","edges",",","populate","that","field","For","custom","src\/dst\/node","bindings",",","passing","in","a","Graphistry","instance","with",".bind","(","source=","..",",","destination=","...",",","node=","...",")","Otherwise",",","will","do","src\/dst\/id","For","dict","results","(","ex",":","valueMap\/elementMap",")",",","specify","mode='nodes","'","(","'edges","'",")",",","else","will","inspect","field","'type","'"]
code: def resultset_to_g(
      self,
      resultsets: Union[ResultSet, Iterable[ResultSet]],
      mode: str = "infer",
      verbose=False,
      ignore_errors=False,
  ) -> Plottable:
      """
      Convert traversal results to graphistry object with ._nodes, ._edges
      If only received nodes or edges, populate that field
      For custom src/dst/node bindings, passing in a Graphistry instance with .bind(source=.., destination=..., node=...)
      Otherwise, will do src/dst/id
      For dict results (ex: valueMap/elementMap), specify mode='nodes' ('edges'), else will inspect field 'type'
      """
  
      if isinstance(resultsets, ResultSet):
          resultsets = [resultsets]
  
      nodes_hits: Set[str] = set()
      nodes: List[dict] = []
      edges_hits: Set[str] = set()
      edges: List[dict] = []
      for resultset in resultsets:
          if verbose:
              logger.debug(
                  "resultset: %s :: %s", resultset, type(resultset)
              )
  
          try:
              for result in resultset:
                  if verbose:
                      logger.debug(
                          "result: %s :: %s", result, type(result)
                      )
                  if isinstance(result, dict):
                      result = [result]
                  if resultset_to_g_structured_item(
                      edges,
                      edges_hits,
                      nodes,
                      nodes_hits,
                      result,
                      ignore_errors,
                  ):
                      continue
                  for item in result:
                      if verbose:
                          logger.debug(
                              "item: %s :: %s", item, type(item)
                          )
  
                      if resultset_to_g_structured_item(
                          edges,
                          edges_hits,
                          nodes,
                          nodes_hits,
                          item,
                          ignore_errors,
                      ):
                          continue
                      elif isinstance(item, dict):
                          if (mode != "infer") or ("type" in item):
                              item_kind = None
                              if mode == "infer":
                                  item_kind = item["type"]
                              elif mode == "nodes":
                                  item_kind = "vertex"
                              elif mode == "edges":
                                  item_kind = "edge"
  
                              if item_kind == "vertex":
                                  flatten_vertex_dict_adder(
                                      nodes, nodes_hits, item
                                  )
                              elif item_kind == "edge":
                                  flatten_edge_dict_adder(
                                      edges, edges_hits, item
                                  )
                              else:
                                  raise ValueError(
                                      "unexpected item type",
                                      item["type"],
                                  )
                          else:
                              for k in item.keys():
                                  item_k_val = item[k]
                                  if item_k_val["type"] == "vertex":
                                      flatten_vertex_dict_adder(
                                          nodes, nodes_hits, item_k_val
                                      )
                                  elif item_k_val["type"] == "edge":
                                      flatten_edge_dict_adder(
                                          edges, edges_hits, item_k_val
                                      )
                                  else:
                                      raise ValueError(
                                          "unexpected item key val:",
                                          type(item[k]),
                                      )
                      else:
                          raise ValueError(
                              "unexpected non-dict item type:",
                              type(item),
                          )
  
          except Exception as e:
              if ignore_errors:
                  logger.info("Supressing error", exc_info=True)
              else:
                  raise e
  
      nodes_df = pd.DataFrame(nodes) if len(nodes) > 0 else None
      edges_df = pd.DataFrame(edges) if len(edges) > 0 else None
  
      g = self.nodes(nodes_df)
  
      if len(edges) > 0 and edges_df is not None:
          g = g.edges(edges_df)
      # elif len(nodes) > 0:
      #    v0 = nodes[0][g._node]
      #    g = g.edges(pd.DataFrame({
      #        g._source: pd.Series([v0], dtype=nodes_df[g._node].dtype),  # type: ignore
      #        g._destination: pd.Series([v0], dtype=nodes_df[g._node].dtype)  # type: ignore
      #    }))
      elif g._edges is None:
          g = g.edges(
              pd.DataFrame(
                  {
                      g._source: pd.Series([], dtype="object"),
                      g._destination: pd.Series([], dtype="object"),
                  }
              )
          )
  
      bindings = {}
      if g._source is None:
          bindings["source"] = "src"
      if g._destination is None:
          bindings["destination"] = "dst"
      if g._node is None:
          bindings["node"] = "id"
      if (
          g._edge_title is None
          and g._edge_label is None
          and g._edges is not None
      ):
          if "label" in g._edges:
              bindings["edge_title"] = "label"
      g = g.bind(**bindings)
  
      return g
  
imports: from typing import Any, Callable, Iterable, List, Optional, Set, Union, TYPE_CHECKING
  import os, pandas
  from .Plottable import Plottable
  from .util import setup_logger
label_desc: Use image node_id 7 for calling the GremlinMixin obj's underlying member method code with example usage: obj.resultset_to_g(resultsets, mode, verbose, ignore_errors) and returns: g