The input is already an adjacency list. graph[i] gives you all neighbors of node i directly. No need to build the graph yourself. For example, if graph = [[1,3],[0,2],[1,3],[0,2]], then: - Node connects to nodes and - Node connects to nodes and - Node connects to nodes and - Node connects to nodes and This is a -cycle: ----.
Since is even, this graph should be bipartite.