class_docstr: The classic Sugiyama layout aka layered layout.
  
  - See https://en.wikipedia.org/wiki/Layered_graph_drawing
  - Excellent explanation: https://www.youtube.com/watch?v=Z0RGCWxvCxA
  
  
  **Attributes**
      - dirvh (int): the current aligment state for alignment policy:
               dirvh=0 -> dirh=+1, dirv=-1: leftmost upper
               dirvh=1 -> dirh=-1, dirv=-1: rightmost upper
               dirvh=2 -> dirh=+1, dirv=+1: leftmost lower
               dirvh=3 -> dirh=-1, dirv=+1: rightmost lower
      - order_iter (int): the default number of layer placement iterations
      - order_attr (str): set attribute name used for layer ordering
      - xspace (int): horizontal space between vertices in a layer
      - yspace (int): vertical space between layers
      - dw (int): default width of a vertex
      - dh (int): default height of a vertex
      - g (GraphBase): the graph component reference
      - layers (list[sugiyama.layer.Layer]): the list of layers
      - layoutVertices (dict): associate vertex (possibly dummy) with their sugiyama attributes
      - ctrls (dict): associate edge with all its vertices (including dummies)
      - dag (bool): the current acyclic state
      - init_done (bool): True if things were initialized
  
  **Example**
  
      ::
  
          g = nx.generators.connected_watts_strogatz_graph(1000, 2, 0.3)
          # render
          SugiyamaLayout.draw(g)
          # positions
          positions_dictionary = SugiyamaLayout.arrange(g)
docstr:  Sets layer value for vertex v and add it to the corresponding layer.
  The Layer is created if it is the first vertex with this layer.
docstr_tok: ["Sets","layer","value","for","vertex","v","and","add","it","to","the","corresponding","layer",".","The","Layer","is","created","if","it","is","the","first","vertex","with","this","layer","."]
code: def _set_layer(self, v, backwards=False):
      """
       Sets layer value for vertex v and add it to the corresponding layer.
      The Layer is created if it is the first vertex with this layer.
      """
      assert self.dag
      if not self.layoutVertices[v].layer is None:
          # layer has been set before
          return
      if backwards:
          r = (
              min(
                  [
                      self.layoutVertices[x].layer
                      for x in v.neighbors(+1)
                      if self.layoutVertices[x].layer is not None
                  ]
              )
              + 1
          )
      else:
          r = (
              max(
                  [
                      float("-inf")
                      if self.layoutVertices[x].layer is None
                      else self.layoutVertices[x].layer
                      for x in v.neighbors(-1)
                  ]
                  + [-1]
              )
              + 1
          )
  
      self.layoutVertices[v].layer = r
      # add it to its layer:
      try:
          if len(self.layers) < r + 1:
              for i in range(r + 1 - len(self.layers)):
                  self.layers.append(Layer([]))
          self.layers[r].append(v)
      except IndexError:
          # assert r == len(self.layers)
          self.layers.append(Layer([v]))
  
imports: import pandas, typing
  from sys import getrecursionlimit, setrecursionlimit
  from graphistry.layout.graph import Vertex, GraphBase, Graph, Edge
  from graphistry.layout.utils import DummyVertex, LayoutVertex, Rectangle, size_median
  from graphistry.layout.utils.layer import Layer
label_desc: Use image node_id 19 for calling the SugiyamaLayout obj's underlying member method code with example usage: obj._set_layer(v, backwards) without return types