public int compareTo(GreedyNode n){
    if(n.pathCost == Integer.MAX_VALUE){ //greedy
      if(this.toGoal - n.toGoal > 0)
        return 1;
      if(this.toGoal - n.toGoal < 0)
        return -1;
    }
    else if(n.toGoal == Integer.MAX_VALUE){ //uniform cost
      if(this.pathCost - n.pathCost > 0)
        return 1;
      if(this.pathCost - n.pathCost < 0)
        return -1;
    }
    else{ //a*
      double thisTot = this.pathCost + this.toGoal;
      double nTot = n.pathCost + n.toGoal;
      if(thisTot - nTot > 0)
        return 1;
      if(thisTot - nTot < 0)
        return -1;
    }
    return 0;
  }