To check if there are cycles . If yes , then they are not convertible . Else , they are convertible .
for ( const [ key , value ] of Object . entries ( mp ) ) { if ( key === value ) continue ; else { if ( find ( key ) == find ( value ) ) return false ; else join ( key , value ) ; } } return true ; }