public boolean existLink(GraphNode link) {//checks if there is a link from the parameter in the links of this node.
        for (int i = 0; i < links.getLength(); i++) {
            if (links.get(i).getTerminal().equals(link))//compares with the terminal of the link
                return true;
        }
        return false;
    }