Create graph and store in adjacency list form
let adj = new Array ( n ) ; for ( var i = 0 ; i < adj . length ; i ++ ) { adj [ i ] = new Array ( 2 ) ; } for ( var i = 0 ; i < adj . length ; i ++ ) { for ( var j = 0 ; j < adj . length ; j ++ ) { adj [ i ] [ j ] = 0 ; } }