/**
   * For Supergraph Search Only The Mapping from the "indexing features" to the query graph will be
   * fetched This mapping will be extended to mappings from the "candidate graph" to the query
   *
   * @param candidateFetcher
   * @param TimeComponent
   * @return
   */
  public List<IGraphResult> verifyFalse(
      IGraphFetcher candidateFetcher, Graph query, long[] TimeComponent) {
    if (candidateFetcher == null || candidateFetcher.size() == 0)
      return new ArrayList<IGraphResult>();
    else {
      if (this.storeEmbedding) this.storedEmbeddings.clear();

      List<IGraphResult> answerSet = new ArrayList<IGraphResult>();
      List<IGraphResult> candidates = candidateFetcher.getGraphs(TimeComponent);
      long start = System.currentTimeMillis();
      while (candidates != null) {
        for (int i = 0; i < candidates.size(); i++) {
          IGraphResultPref oneCandidate = (IGraphResultPref) candidates.get(i);
          FastSUCompleteEmbedding prefixEmbedding =
              this.prefSearcher.getEmbedding(oneCandidate.getPrefixFeatureID(), query);
          Graph g = null;

          if (g == null)
            if (storeEmbedding) this.storedEmbeddings.put(candidates.get(i), prefixEmbedding);
            else {
              FastSUCompleteEmbedding newEmbedding =
                  new FastSUCompleteEmbedding(prefixEmbedding, g);
              if (!newEmbedding.issubIsomorphic()) answerSet.add(candidates.get(i));
              else if (this.storeEmbedding)
                this.storedEmbeddings.put(candidates.get(i), newEmbedding);
            }
        }
        TimeComponent[3] += System.currentTimeMillis() - start;
        candidates = candidateFetcher.getGraphs(TimeComponent);
        start = System.currentTimeMillis();
      }
      return answerSet;
    }
  }
  /**
   * For Supergraph Search Use Only The Mapping from the "indexing features" to the query graph will
   * be fetched This mapping will be extended to mappings from the "candidate graph" to the query
   *
   * @param candidateFetcher
   * @param TimeComponent
   * @return
   */
  public List<IGraphResult> verify(
      IGraphFetcherPrefix candidateFetcher, Graph query, long[] TimeComponent) {

    if (candidateFetcher == null || candidateFetcher.size() == 0)
      return new ArrayList<IGraphResult>();
    else {
      if (this.storeEmbedding) this.storedEmbeddings.clear();
      List<IGraphResult> answerSet = new ArrayList<IGraphResult>();

      List<IGraphResultPref> candidates = candidateFetcher.getGraphs(TimeComponent);
      long start = System.currentTimeMillis();
      while (candidates != null) {
        for (int i = 0; i < candidates.size(); i++) {
          IGraphResultPref oneCandidate = candidates.get(i);
          if (oneCandidate.getPrefixFeatureID() != -1) {
            int[][] suffix = oneCandidate.getSuffix();
            if (suffix != null) {
              FastSUCompleteEmbedding prefixEmbedding =
                  this.prefSearcher.getEmbedding(oneCandidate.getPrefixFeatureID(), query);
              if (prefixEmbedding == null) continue; // this is not an answer
              if (this.storeEmbedding) {
                FastSUCompleteEmbedding newEmbedding =
                    new FastSUCompleteEmbedding(prefixEmbedding, suffix);
                if (newEmbedding.issubIsomorphic()) {
                  answerSet.add(oneCandidate);
                  this.storedEmbeddings.put(oneCandidate, newEmbedding);
                }
              } else {
                FastSU su = new FastSU();
                boolean iso = su.isIsomorphic(prefixEmbedding, suffix);
                if (iso) answerSet.add(oneCandidate);
              }
            } else // the database graph is the same as the prefix
            // feature
            {
              answerSet.add(candidates.get(i));
              if (this.storeEmbedding)
                this.storedEmbeddings.put(
                    oneCandidate,
                    this.prefSearcher.getEmbedding(oneCandidate.getPrefixFeatureID(), query));
            }
          } else {
            // PrefixFeatureID = -1;
            if (this.storeEmbedding) {
              Graph g = oneCandidate.getG();
              if (g == null)
                System.out.println("Exception in VerifierISOPrefix: null g with not prefix");
              FastSUCompleteEmbedding newEmbedding = new FastSUCompleteEmbedding(g, query);
              if (newEmbedding.issubIsomorphic()) {
                answerSet.add(oneCandidate);
                this.storedEmbeddings.put(oneCandidate, newEmbedding);
              }
            } else {
              FastSU su = new FastSU();
              boolean iso = su.isIsomorphic(oneCandidate.getG(), query);
              if (iso) answerSet.add(candidates.get(i));
            }
          }
        }
        TimeComponent[3] += System.currentTimeMillis() - start;
        candidates = candidateFetcher.getGraphs(TimeComponent);
        start = System.currentTimeMillis();
      }
      return answerSet;
    }
  }