public void addLink(GraphNode destiny, int weight) { //adds the link with the param destiny and its weight or price.
        if (actual_links == -1) {//if there are not links.
            links.append(new Link(this, destiny, weight));//creates new link and adds it to the list of links of this node.
            actual_links++;
        } else {
            boolean pos = existLink(destiny);//if param exists in the list.
            if (pos == false) {
                links.append(new Link(this, destiny, weight));//creates and adds link to list.
                actual_links++;
            }
        }

    }