code: def to_igraph(
      self: Plottable,
      directed: bool = True,
      include_nodes: bool = True,
      node_attributes: Optional[List[str]] = None,
      edge_attributes: Optional[List[str]] = None,
      use_vids: bool = False,
  ):
      """Convert current item to igraph Graph . See examples in from_igraph.
  
      :param directed: Whether to create a directed graph (default True)
      :type directed: bool
  
      :param include_nodes: Whether to ingest the nodes table, if it exists (default True)
      :type include_nodes: bool
  
      :param node_attributes: Which node attributes to load, None means all (default None)
      :type node_attributes: Optional[List[str]]
  
      :param edge_attributes: Which edge attributes to load, None means all (default None)
      :type edge_attributes: Optional[List[str]]
  
      :param use_vids: Whether to interpret IDs as igraph vertex IDs, which must be non-negative integers (default False)
      :type use_vids: bool
  
      """
      import igraph
  
      g = self.bind()
      if not include_nodes and self._nodes is not None:
          g._node = None
          g._nodes = None
  
      # otherwise, if no nodes, ig adds extra column 'name' to vertices
      g = g.materialize_nodes()
  
      # igraph expects src/dst first
      edge_attrs = (
          g._edges.columns
          if edge_attributes is None
          else edge_attributes
      )
      edge_attrs = [
          x for x in edge_attrs if x not in [g._source, g._destination]
      ]
      edges_df = g._edges[[g._source, g._destination] + edge_attrs]
  
      # igraph expects node first
      node_attrs = (
          g._nodes if node_attributes is None else node_attributes
      )
      node_attrs = [x for x in node_attrs if x != g._node]
      nodes_df = g._nodes[[g._node] + node_attrs]
      return igraph.Graph.DataFrame(
          edges_df,
          directed=directed,
          vertices=nodes_df,
          use_vids=use_vids,
      )
  
file_path: pygraphistry/graphistry/plugins/igraph.py
imports: import pandas
  from typing import Any, List, Optional
  from graphistry.constants import NODE
  from graphistry.Plottable import Plottable
  from graphistry.util import setup_logger
label_desc: Use image node_id 2 for calling a global function with example usage: to_igraph(directed, include_nodes, node_attributes, edge_attributes, use_vids) and returns: igraph