add dtype to numpy array to speed up bfs loop