code: def compute_igraph(
      self: Plottable,
      alg: str,
      out_col: Optional[str] = None,
      directed: Optional[bool] = None,
      use_vids=False,
      params: dict = {},
      stringify_rich_types=True,
  ) -> Plottable:
      """Enrich or replace graph using igraph methods
  
      :param alg: Name of an igraph.Graph method like `pagerank`
      :type alg: str
  
      :param out_col: For algorithms that generate a node attribute column, `out_col` is the desired output column name. When `None`, use the algorithm's name. (default None)
      :type out_col: Optional[str]
  
      :param directed: During the to_igraph conversion, whether to be directed. If None, try directed and then undirected. (default None)
      :type directed: Optional[bool]
  
      :param use_vids: During the to_igraph conversion, whether to interpret IDs as igraph vertex IDs (non-negative integers) or arbitrary values (False, default)
      :type use_vids: bool
  
      :param params: Any named parameters to pass to the underlying igraph method
      :type params: dict
  
      :param stringify_rich_types: When rich types like igraph.Graph are returned, which may be problematic for downstream rendering, coerce them to strings
      :type stringify_rich_types: bool
  
      :returns: Plotter
      :rtype: Plotter
  
      **Example: Pagerank**
          ::
  
              import graphistry, pandas as pd
              edges = pd.DataFrame({'s': ['a','b','c','d'], 'd': ['c','c','e','e']})
              g = graphistry.edges(edges, 's', 'd')
              g2 = g.compute_igraph('pagerank')
              assert 'pagerank' in g2._nodes.columns
  
      **Example: Pagerank with custom name**
          ::
  
              import graphistry, pandas as pd
              edges = pd.DataFrame({'s': ['a','b','c','d'], 'd': ['c','c','e','e']})
              g = graphistry.edges(edges, 's', 'd')
              g2 = g.compute_igraph('pagerank', out_col='my_pr')
              assert 'my_pr' in g2._nodes.columns
  
      **Example: Pagerank on an undirected**
          ::
  
              import graphistry, pandas as pd
              edges = pd.DataFrame({'s': ['a','b','c','d'], 'd': ['c','c','e','e']})
              g = graphistry.edges(edges, 's', 'd')
              g2 = g.compute_igraph('pagerank', directed=False)
              assert 'pagerank' in g2._nodes.columns
  
      **Example: Pagerank with custom parameters**
          ::
  
                  import graphistry, pandas as pd
                  edges = pd.DataFrame({'s': ['a','b','c','d'], 'd': ['c','c','e','e']})
                  g = graphistry.edges(edges, 's', 'd')
                  g2 = g.compute_igraph('pagerank', params={'damping': 0.85})
                  assert 'pagerank' in g2._nodes.columns
  
      """
  
      import igraph
  
      if alg not in compute_algs:
          raise ValueError(
              f'Unexpected parameter alg "{alg}" does not correspond to a known igraph graph.*() algorithm like "pagerank"'
          )
  
      if out_col is None:
          out_col = alg
  
      try:
          ig = self.to_igraph(
              directed=True if directed is None else directed,
              use_vids=use_vids,
          )
          out = getattr(ig, alg)(**params)
      except NotImplementedError as e:
          if directed is None:
              ig = self.to_igraph(directed=False, use_vids=use_vids)
              out = getattr(ig, alg)(**params)
          else:
              raise e
  
      if isinstance(out, igraph.clustering.VertexClustering):
          clustering = out.membership
      elif isinstance(out, igraph.clustering.VertexDendrogram):
          clustering = out.as_clustering().membership
      elif isinstance(out, igraph.Graph):
          return from_igraph(self, out)
      elif isinstance(out, list) and self._nodes is None:
          raise ValueError(
              "No g._nodes table found; use .bind(), .nodes(), .materialize_nodes()"
          )
      elif alg == "articulation_points":
          assert isinstance(out, list)  # List[int]
          membership = [0] * len(ig.vs)
          for i in out:
              membership[i] = 1
          clustering = membership
      elif isinstance(out, list) and len(out) == len(self._nodes):
          if (
              stringify_rich_types
              and len(out) > 0
              and all((isinstance(c, igraph.Graph) for c in out))
          ):
              # ex: k_core
              clustering = [str(c) for c in out]
          else:
              clustering = out
      else:
          if isinstance(out, list) and len(out) > 0:
              xtra = f" (element 0 type: {type(out[0])})"
          else:
              xtra = ""
  
          raise RuntimeError(
              f'Unexpected output type "{type(out)}"{xtra}; should be VertexClustering, VertexDendrogram, Graph, or list_<|V|>'
          )
  
      ig.vs[out_col] = clustering
  
      return self.from_igraph(ig)
  
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 3 for calling a global function with example usage: compute_igraph(alg, out_col, directed, use_vids, params, stringify_rich_types) and returns: self, from_igraph