public Link shorterConnection(DijkstraNode node){//returns Link with less price between two nodes.Validates by the adjacence nodes.
        //checks th links of the param node and returns the weightless link of the node.
        List<Link> links_of_node=node.getData().getLinks();
        Link link=null;
        int less_weight;
        for(int i=0;i<links_of_node.getLength()+1;i++){
            if(links_of_node.get(i).getWeight()<links_of_node.get(i+1).getWeight()){
                less_weight=links_of_node.get(i).getWeight();
                link=links_of_node.get(i);
            }
            else{
                less_weight=links_of_node.get(i+1).getWeight();
                link=links_of_node.get(i);
            }
        }
        return link;
    }