The graph might be disconnected. Running BFS from node only colors one component. Add an outer loop: iterate through all nodes to . If color[i] == -1, that node has not been visited yet. Start a BFS from it.
Each BFS handles one connected component. You need all components to be bipartite. If any single BFS finds a conflict, return false. Only if all components pass do you return true.