code: @Override
      public Set<Integer> find(long[] invariants, IAtomContainer container, int[][] graph) {
  
          int n = invariants.length;
  
          // find cyclic vertices using DFS
          RingSearch ringSearch = new RingSearch(container, graph);
  
          // ordered map of the set of vertices for each value
          Map<Long, Set<Integer>> equivalent = new TreeMap<Long, Set<Integer>>();
  
          // divide the invariants into equivalent indexed and ordered sets
          for (int i = 0; i < invariants.length; i++) {
  
              Long invariant = invariants[i];
              Set<Integer> set = equivalent.get(invariant);
  
              if (set == null) {
                  if (ringSearch.cyclic(i)) {
                      set = new HashSet<Integer>(n / 2);
                      set.add(i);
                      equivalent.put(invariant, set);
                  }
              } else {
                  set.add(i);
              }
          }
  
          // find the smallest set of equivalent cyclic vertices
          int minSize = Integer.MAX_VALUE;
          Set<Integer> min = Collections.emptySet();
          for (Map.Entry<Long, Set<Integer>> e : equivalent.entrySet()) {
              Set<Integer> vertices = e.getValue();
              if (vertices.size() < minSize && vertices.size() > 1) {
                  min = vertices;
                  minSize = vertices.size();
              } else if (vertices.size() == minSize) {
                  min.addAll(vertices);
              }
          }
  
          return min;
      }
docs: {@inheritDoc}