<awangdev>Redundant Connection_1.java
private boolean hasCycle(Map<Integer, Set<Integer>> graph, int curr, int target, int pre) {

        if (graph.get(curr).contains(target)) return true;
        for (int num : graph.get(curr)) {
            if (num == pre) continue;
            if (hasCycle(graph, num, target, curr)) return true;
        }
        return false;
    }
private boolean sample_funcname ( Map < Integer , Set < Integer >> graph , int curr , int target , int pre ) {
  if ( graph . get ( curr ) . contains ( target ) ) return true ;
  for ( int num : graph . get ( curr ) ) {
    if ( num == pre ) continue ;
    if ( hasCycle ( graph , num , target , curr ) ) return true ;
  }
  return false ;
}
