class_docstr: Assemble, save, and render DOT source code, open result in viewer.
class_docstr_tok: ["Assemble",",","save",",","and","render","DOT","source","code",",","open","result","in","viewer","."]
docstr: Add the current content of the given sole ``graph`` argument as subgraph            or return a context manager returning a new graph instance created            with the given (``name``, ``comment``, etc.) arguments whose content is            added as subgraph when leaving the context manager's ``with``-block.
  
  Args:
      graph: An instance of the same kind (:class:`.Graph`, :class:`.Digraph`)
             as the current graph (sole argument in non-with-block use).
      name: Subgraph name (``with``-block use).
      comment: Subgraph comment (``with``-block use).
      graph_attr: Subgraph-level attribute-value mapping (``with``-block use).
      node_attr: Node-level attribute-value mapping (``with``-block use).
      edge_attr: Edge-level attribute-value mapping (``with``-block use).
      body: Verbatim lines to add to the subgraph ``body`` (``with``-block use).
  
  See the :ref:`usage examples in the User Guide <subgraphs>`.
  
  When used as a context manager, the returned new graph instance uses
  ``strict=None`` and the parent graph's values for ``directory``,
  ``format``, ``engine``, and ``encoding`` by default.
  
  Note:
      If the ``name`` of the subgraph begins with ``'cluster'`` (all lowercase)
      the layout engine will treat it as a special cluster subgraph.
docstr_tok: ["Add","the","current","content","of","the","given","sole","``","graph","``","argument","as","subgraph","or","return","a","context","manager","returning","a","new","graph","instance","created","with","the","given","(","``","name","``",",","``","comment","``",",","etc",".",")","arguments","whose","content","is","added","as","subgraph","when","leaving","the","context","manager","'s","``","with","``","-block",".","Args",":","graph",":","An","instance","of","the","same","kind","(",":","class",":","`",".Graph","`",",",":","class",":","`",".Digraph","`",")","as","the","current","graph","(","sole","argument","in","non-with-block","use",")",".","name",":","Subgraph","name","(","``","with","``","-block","use",")",".","comment",":","Subgraph","comment","(","``","with","``","-block","use",")",".","graph_attr",":","Subgraph-level","attribute-value","mapping","(","``","with","``","-block","use",")",".","node_attr",":","Node-level","attribute-value","mapping","(","``","with","``","-block","use",")",".","edge_attr",":","Edge-level","attribute-value","mapping","(","``","with","``","-block","use",")",".","body",":","Verbatim","lines","to","add","to","the","subgraph","``","body","``","(","``","with","``","-block","use",")",".","See","the",":","ref",":","`","usage","examples","in","the","User","Guide","<","subgraphs",">","`",".","When","used","as","a","context","manager",",","the","returned","new","graph","instance","uses","``","strict=None","``","and","the","parent","graph","'s","values","for","``","directory","``",",","``","format","``",",","``","engine","``",",","and","``","encoding","``","by","default",".","Note",":","If","the","``","name","``","of","the","subgraph","begins","with","``","'cluster","'","``","(","all","lowercase",")","the","layout","engine","will","treat","it","as","a","special","cluster","subgraph","."]
code: def subgraph(
      self,
      graph=None,
      name=None,
      comment=None,
      graph_attr=None,
      node_attr=None,
      edge_attr=None,
      body=None,
  ):
      """Add the current content of the given sole ``graph`` argument as subgraph \
             or return a context manager returning a new graph instance created \
             with the given (``name``, ``comment``, etc.) arguments whose content is \
             added as subgraph when leaving the context manager's ``with``-block.
  
          Args:
              graph: An instance of the same kind (:class:`.Graph`, :class:`.Digraph`)
                     as the current graph (sole argument in non-with-block use).
              name: Subgraph name (``with``-block use).
              comment: Subgraph comment (``with``-block use).
              graph_attr: Subgraph-level attribute-value mapping (``with``-block use).
              node_attr: Node-level attribute-value mapping (``with``-block use).
              edge_attr: Edge-level attribute-value mapping (``with``-block use).
              body: Verbatim lines to add to the subgraph ``body`` (``with``-block use).
  
          See the :ref:`usage examples in the User Guide <subgraphs>`.
  
          When used as a context manager, the returned new graph instance uses
          ``strict=None`` and the parent graph's values for ``directory``,
          ``format``, ``engine``, and ``encoding`` by default.
  
          Note:
              If the ``name`` of the subgraph begins with ``'cluster'`` (all lowercase)
              the layout engine will treat it as a special cluster subgraph.
          """
      if graph is None:
          return SubgraphContext(
              self,
              {
                  "name": name,
                  "comment": comment,
                  "directory": self.directory,
                  "format": self.format,
                  "engine": self.engine,
                  "encoding": self.encoding,
                  "graph_attr": graph_attr,
                  "node_attr": node_attr,
                  "edge_attr": edge_attr,
                  "body": body,
                  "strict": None,
              },
          )
  
      args = [name, comment, graph_attr, node_attr, edge_attr, body]
      if not all(a is None for a in args):
          raise ValueError("graph must be sole argument of subgraph()")
  
      if graph.directed != self.directed:
          raise ValueError(
              "%r cannot add subgraph of different kind:"
              " %r" % (self, graph)
          )
  
      lines = ["\t" + line for line in graph.__iter__(subgraph=True)]
      self.body.extend(lines)
  
imports: from .None import backend
  from .None import files
  from .None import lang
label_desc: Use image node_id 10 for calling the Dot obj's underlying member method code with example usage: obj.subgraph(graph, name, comment, graph_attr, node_attr, edge_attr, body) and returns: SubgraphContext