public void update(Node node){         
          if(trace.size() >0 && parentNode != trace.get(trace.size()-1)){
                  if(node != trace.get(trace.size()-1)){
                          trace.add(parentNode);
                  }
          }
          else if(trace.size()==0)                       
                  trace.add(parentNode);
         
                 
          parentNode = node;
          if (node != null)
        	  path = node.getPath();
          drawGraph();
          revalidate();
  }