<awangdev>Bus Routes_1.java
public int numBusesToDestination(int[][] routes, int S, int T) {
        Set<Integer> visited = new HashSet<>();
        Map<Integer, Set<Integer>> stopMap = new HashMap<>();
        Queue<Integer> queue = new LinkedList<>();
        for (int i = 0; i < routes.length; i++) {
            for (int stop : routes[i]) {
                stopMap.putIfAbsent(stop, new HashSet<>());
                stopMap.get(stop).add(i); 
            }
        }
        queue.offer(S);
        int count = 0;
        while (!queue.isEmpty()) {
            int size = queue.size();
            for (int i = 0; i < size; i++) { 
                int stop = queue.poll(); 
                if (stop == T) return count;
                for (int bus : stopMap.get(stop)) {
                    if (!visited.contains(bus)) {
                        visited.add(bus);
                        for (int nextStop : routes[bus]) {
                            queue.offer(nextStop); 
                        }
                    }
                }
            }
            count++;
        }
        
        return -1;
    }
public int sample_funcname ( int [ ] [ ] var_0 , int var_1 , int var_2 ) {
  Set < Integer > var_6 = new HashSet < > ( ) ;
  Map < Integer , Set < Integer >> var_9 = new HashMap < > ( ) ;
  Queue < Integer > var_12 = new LinkedList < > ( ) ;
  for ( int var_14 = 0 ;
  var_14 < var_0 . length ;
  var_14 ++ ) {
    for ( int var_16 : var_0 [ var_14 ] ) {
      var_9 . putIfAbsent ( var_16 , new HashSet < > ( ) ) ;
      var_9 . get ( var_16 ) . add ( var_14 ) ;
    }
  }
  var_12 . offer ( var_1 ) ;
  int var_21 = 0 ;
  while ( ! var_12 . isEmpty ( ) ) {
    int size = var_12 . size ( ) ;
    for ( int var_14 = 0 ;
    var_14 < size ;
    var_14 ++ ) {
      int var_16 = var_12 . poll ( ) ;
      if ( var_16 == var_2 ) return var_21 ;
      for ( int var_25 : var_9 . get ( var_16 ) ) {
        if ( ! var_6 . contains ( var_25 ) ) {
          var_6 . add ( var_25 ) ;
          for ( int var_27 : var_0 [ var_25 ] ) {
            var_12 . offer ( var_27 ) ;
          }
        }
      }
    }
    var_21 ++ ;
  }
  return - 1 ;
}
