code: def CreateDirectedEdges(self, points, gr, layer_width):
          
          for z0, x0, Q0 in points:
              for z1, x1, Q1 in points:
                  dz = z1 - z0  # no fabs because we check arrow direction
                  if dz > 0.0:  # make sure arrow in right direction
                      if dz - layer_width < distance_threshold:  # only adjacents
                          dx = math.fabs(x1 - x0)
  
                          if dx > 5 * bar_width:
                              continue
  
                          # Weights are negative to in order to use shortest path
                          # algorithms on the graph.
                          weight = -1 * math.hypot(dz, dx)
  
                          edge = ((z0, x0, Q0), (z1, x1, Q1))
  
                          gr.add_edge(edge, wt=weight)
  
          # Ensure that it is already transitively reduced
          assert len(critical.transitive_edges(gr)) == 0
  
          return gr
docs: Take each key (ie. point) in the graph and for that point
          create an edge to every point downstream of it where the weight
          of the edge is the tuple (distance, angle)