update maze generation

still not quite correct. The flattening of duplicate edges loses
ordering information, which is important for mazes.