Topological expansion and boundary conditions