class_docstr: A helper class to compute and plot lineage of ml-metadata artifacts.
class_docstr_tok: ["A","helper","class","to","compute","and","plot","lineage","of","ml-metadata","artifacts","."]
docstr: Adds the parent artifacts/executions for `node_id` to the graph `g`.
docstr_tok: ["Adds","the","parent","artifacts\/executions","for","`","node_id","`","to","the","graph","`","g","`","."]
code: def _add_parents(
      self, g, node_id, is_artifact, depth, max_depth=None
  ):
      """Adds the parent artifacts/executions for `node_id` to the graph `g`."""
      # if it is not an artifact, use negative gnode id
      gnode_id = node_id if is_artifact else -1 * node_id
      self._add_node_attribute(g, node_id, depth, is_artifact)
      if gnode_id in g and g.in_edges(gnode_id):
          return
      if max_depth is not None and depth > max_depth:
          return
      if is_artifact:
          for e_id, is_cached in self._get_upstream_execution_ids(
              node_id
          ):
              g.add_edge(e_id * -1, node_id, is_cached=is_cached)
              self._add_parents(
                  g, e_id, not is_artifact, depth + 1, max_depth
              )
      else:
          for a_id in self._get_upstream_artifact_ids(node_id):
              g.add_edge(a_id, node_id * -1, is_cached=False)
              self._add_parents(
                  g, a_id, not is_artifact, depth + 1, max_depth
              )
  
imports: import re
  from IPython.display import display_html
  import matplotlib.pyplot
  import networkx
  import pandas
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 5 for calling the _LineageGraphHelper obj's underlying member method code with example usage: obj._add_parents(g, node_id, is_artifact, depth, max_depth) without return types