code: def rulegraph_spec(dag):
      # get toposorting, and keep only one job of each rule per level
      representatives = dict()
  
      toposorted = [
          get_representatives(level, representatives)
          for level in dag.toposorted()
      ]
  
      jobs = [job for level in toposorted for job in level]
  
      nodes = [
          {"rule": job.rule.name, "fx": 10, "fy": i * 50}
          for i, job in enumerate(jobs)
      ]
      idx = {job: i for i, job in enumerate(jobs)}
  
      xmax = 100
      ymax = max(node["fy"] for node in nodes)
  
      _get_links = partial(
          get_links, jobs, dag, idx, nodes, representatives
      )
  
      return (
          {
              "nodes": nodes,
              "links": list(_get_links(direct=False)),
              "links_direct": list(_get_links(direct=True)),
          },
          xmax,
          ymax,
      )
  
label_desc: Use image node_id 1 for calling a global function with example usage: rulegraph_spec(dag) and returns: dict,  xmax,  ymax