code: def to_dot(cls, subtask_graphs: List[SubtaskGraph]):
      sio = StringIO()
      sio.write("digraph {\n")
      sio.write("splines=curved\n")
      sio.write("rankdir=BT\n")
      sio.write("graph [compound=true];\n")
      subgraph_index = 0
      current_stage = 0
      result_chunk_to_subtask = dict()
      line_colors = dict()
      color_iter = iter(itertools.cycle(range(1, 9)))
      for stage_line in itertools.combinations(
          range(len(subtask_graphs))[::-1], 2
      ):
          line_colors[stage_line] = f'"/spectral9/{next(color_iter)}"'
  
      for subtask_graph in subtask_graphs:
          for subtask in subtask_graph.topological_iter():
              current_cluster = f"cluster_{subgraph_index}"
              sio.write(
                  cls._export_subtask_to_dot(
                      subtask,
                      current_cluster,
                      current_stage,
                      line_colors,
                      result_chunk_to_subtask,
                  )
              )
              for c in subtask.chunk_graph.results:
                  result_chunk_to_subtask[c.key] = [
                      current_stage,
                      current_cluster,
                  ]
              subgraph_index += 1
          current_stage += 1
      sio.write("}")
      return sio.getvalue()
  
file_path: mars/mars/services/task/supervisor/graph_visualizer.py
imports: import itertools
  from io import StringIO
  from typing import Dict, List
  from ....core.operand import Fetch, FetchShuffle
  from ...subtask import Subtask, SubtaskGraph
label_desc: Use image node_id 1 for calling the GraphVisualizer obj's underlying member method code with example usage: obj.to_dot(cls, subtask_graphs) and returns: sio