public boolean uniformCostSearch(int root_id,int value){

		rootNode=g.all_nodes.get(root_id);
		frontier.insert(rootNode,1);
		rootNode.is_discovered=true;
		rootNode.totalcost=0;
		
		while(!frontier.isEmpty()){

			Node n = (Node)frontier.getItem();

			if(n.node_id==value){
				output.append("found it!\n");
				backtrace(n);
				cost_label.setText("total cost is :" +  n.totalcost  + "\n");
				output.append("Cost :"+ n.totalcost+"\n");
				return true;
			} // end of if  

			explored.add(n); // add seen nodes 

			output.append("total cost for n :" + n.totalcost+"\n");

			for(Node adj : n.visible_nodes){  
				if(frontier.seachItem(adj)==true && adj.is_discovered==false){

					if(adj.totalcost>=(n.totalcost+g.getDistance(n.node_id,adj.node_id))){ // current total cost less than before total cost 
						output.append("current root of "+ (adj.node_id+1) + "is "+(adj.root_node.node_id+1) + " going to be "+(n.node_id+1)+"\n");
						adj.root_node=n;
						adj.totalcost= (float) (n.totalcost+ adj.getDistance(n.node_id,adj.node_id));
						output.append("neighbour "+(adj.node_id+1) + " going to be discovered\n");
						adj.is_discovered=true;
					}
				}// if 

				else if(frontier.seachItem(adj)==false && adj.is_discovered==false){
					output.append("from "+ (n.node_id+1)+"\n");
					adj.root_node=n;
					adj.totalcost= (float) (n.totalcost+ g.getDistance(n.node_id,adj.node_id));
					output.append("total cost for "+(adj.node_id+1) +" is:"+adj.totalcost+"\n");
					frontier.insert(adj,1);
					n.is_discovered=true;
				}
			} // end of for 
					output.append((n.node_id+1) +" going to be ignored\n");
					output.append("\nmy frontier que is :");
					output.append(frontier.array.toString()+"\n");
		}//while
		return false ;
	}//end of method