code: def get_links(jobs, dag, idx, nodes, representatives, direct: bool):
      for u in jobs:
          for v in dag.dependencies[u]:
              target = idx[u]
              source = idx[representatives[v]]
              if target - source == 1:
                  if not direct:
                      continue
              else:
                  if direct:
                      continue
  
              yield {
                  "target": target,
                  "source": source,
                  "sourcerule": nodes[source]["rule"],
                  "targetrule": nodes[target]["rule"],
                  "value": 1,
              }
  
label_desc: Use image node_id 3 for calling a global function with example usage: get_links(jobs, dag, idx, nodes, representatives, direct) without return types