code: def _build_sugiyama_layout(vertices, edges):
      #
      # Just a reminder about naming conventions:
      # +------------X
      # |
      # |
      # |
      # |
      # Y
      #
  
      vertices = {v: Vertex(f" {v} ") for v in vertices}
      # NOTE: reverting edges to correctly orientate the graph
      edges = [Edge(vertices[e], vertices[s]) for s, e in edges]
      vertices = vertices.values()
      graph = Graph(vertices, edges)
  
      for vertex in vertices:
          vertex.view = VertexViewer(vertex.data)
  
      # NOTE: determine min box length to create the best layout
      minw = min(v.view.w for v in vertices)
  
      for edge in edges:
          edge.view = EdgeViewer()
  
      sug = SugiyamaLayout(graph.C[0])
      graph = graph.C[0]
      roots = list(filter(lambda x: len(x.e_in()) == 0, graph.sV))
  
      sug.init_all(roots=roots, optimize=True)
  
      sug.yspace = VertexViewer.HEIGHT
      sug.xspace = minw
      sug.route_edge = route_with_lines
  
      sug.draw()
  
      return sug
  
file_path: dvc/dvc/dagascii.py
imports: import math
  import os
  from grandalf.graphs import Edge, Graph, Vertex
  from grandalf.layouts import SugiyamaLayout
  from grandalf.routing import EdgeViewer, route_with_lines
  from dvc.log import logger
label_desc: Use image node_id 1 for calling a global function with example usage: _build_sugiyama_layout(vertices, edges) and returns: sug