Graph-Based Resource Allocation for Integrated Space and Terrestrial Communications