Graph breadth first algorithm (not finished)