In this paper, a wireless communication network that uses unmanned aerial vehicles (UAVs) in the sky to transmit information between ground users is considered. We highlight a delay-tolerant network, where information is relayed in a store-and-forward fashion by establishing two types of intermittent communication links: between a UAV and a user (UAV-to-user) and between UAVs (UAV-to-UAV). Thus, a flight algorithm that controls the movement of the UAVs is crucial in achieving rapid information transmission. Our study proposes new flight algorithms that simultaneously consider the two types of communication links. In UAV-to-UAV links, the direct information transmission between two UAVs and the indirect transmission through other UAVs are considered separately. The movement of the UAVs is controlled by solving an optimization problem at certain time intervals, with a variable consideration ratio of the two types of links. In addition, we investigate not only the case where all UAVs move cooperatively but also the case where each UAV moves autonomously. Simulation results show that the proposed algorithms are effective. Moreover, they indicate the existence of an optimal consideration ratio of the two types of communication and demonstrate that our approach enables the control of frequencies of establishing the communication links. We conclude that increasing the frequency of indirect communication between UAVs improves network performance.