public void calcCostFromRoot(){
        int cost=0;
        if(this.parent==null) {
            this.setCostFromRoot(0);
        }else{
            for(Edge e:this.parent.children){
                if(e.getTNode().equals(this)){
                    cost=e.getEdgeCost();
                    break;
                }
            }
            this.costFromRoot = this.parent.costFromRoot + cost;
        }
    }