/**
   * Draws the arrows between the nodes
   *
   * @param attributes the attributes of the relation
   * @param fd the functionalDependency to display
   * @param nearNodes the Array of Nodes which are closer to the attribute-Nodes
   * @param farNodes the Array of Nodes which are further away of the attribute-Nodes
   */
  private void drawAttributeArrows(
      ArrayList<Attribute> attributes,
      FunctionalDependency fd,
      ArrayList<mxCell> nearNodes,
      ArrayList<mxCell> farNodes) {
    int index;
    ArrayList<Integer> indices = new ArrayList<>();

    // draw arrows for the SourceAttributes
    for (Attribute sourceAttr : fd.getSourceAttributes()) {
      index = attributes.indexOf(sourceAttr);
      graph.insertEdge(
          parentPane, null, fd, nearNodes.get(index), farNodes.get(index), "EDGE_PLAIN");
      indices.add(index);
    }

    // draw arrows for the TargetAttributes
    for (Attribute targetAttr : fd.getTargetAttributes()) {
      index = attributes.indexOf(targetAttr);
      graph.insertEdge(
          parentPane, null, fd, farNodes.get(index), nearNodes.get(index), "EDGE_ARROW");
      indices.add(index);
    }

    // Connect arrows
    java.util.Collections.sort(indices);
    graph.insertEdge(
        parentPane,
        null,
        fd,
        farNodes.get(indices.get(0)),
        farNodes.get(indices.get(indices.size() - 1)),
        "EDGE_PLAIN");
  }