public void setWeight(Vertex a, Vertex b, int weight){
        if(!isConnected(a,b)){
            connect(a,b,weight);
        }else{
            int edgeWeight = this.weight.get(new Edge(a,b));
            if(edgeWeight!=1){
                this.withWeight--;
            }
            if(edgeWeight<0){
                this.withNegativeWeight--;
            }
            this.weight.put(new Edge(a,b), weight);
            if(weight!=1){
                this.withWeight++;
            }
            if(weight<0){
                this.withNegativeWeight++;
            }
        }
    }