## 1 Introduction  
The construction of large-scale satellite communication constellations is developing rapidly, and time-sensitive services play an important role in such fields as finance, telemedicine and intelligent transportation [1; 2], as shown in Figure 1. Due to propagation delay and the Doppler effect, satellite communication requires time and frequency synchronization [3]. Satellite time synchronization is a basic condition for conducting inter-satellite time-sensitive services, which directly affects parameters such as bandwidth, delay, and jitter [4; 5; 6; 7]. Time-sensitive services between satellites rely on long-term continuous and reliable time synchronization sources. Satellite time synchronization methods include star-ground two-way time synchronization [8], inter-satellite time synchronization based on two-way ranging and time transmit (TVRTT) technology [9], and time synchronization using navigation signals [10; 11; 12]. The time synchronization method using navigation constellations has few error sources and high time synchronization accuracy, and it is an important process for time synchronization in satellite constellations. However, in low earth orbit (LEO) satellite networks, inter-satellite links are difficult to maintain due to the drastic changes in relative motion speed between satellites, and links are constantly established and interrupted [13; 14; 15]. Meanwhile, when affected by interference or space environment factors, such as by solar flares and atmospheric gravity wave disturbances [16; 17], the ionosphere will be perturbed, which may lead to distortions and the mis-coding of the signals received by the receivers, which cannot be decoded [18]. These can lead to the network topology being time-varying. In addition, time transfer cannot be accomplished when the time synchronization source fails or the time transmission link fails. Therefore, it is necessary to quickly reselect the clock source and calculate the time synchronization transmission path according to the current network topology in order to achieve the continuous and stable transmission of real-time services. On the Internet, clock information is transmitted from the clock source to the next node level by level, and each node level is a clock level [19; 20]. Every level of clock information transmission will generate errors. As the number of times clock information is transmitted increases, the error will become larger, and the clock synchronization performance will deteriorate. Therefore, the clock synchronization performance is closely related to the clock hierarchy in the network, and the fewer clock hierarchies, the better the clock synchronization performance. Therefore, during the algorithm iteration in this article, the clock hierarchy is established based on the clock transfer tree, and the clock hierarchy of all satellites is weighted and summed. The minimum value is taken as the optimization objective, and the clock synchronization performance is best when the clock hierarchy value is the smallest. The traditional traversal algorithm calculates the clock delivery path and clock hierarchy by using each satellite as a clock source in turn [15; 21], which requires all possible cases to be calculated sequentially, and the optimal result can only be determined by comparing the results of the calculations for all cases [22]. Therefore, as the number of satellites in the network increases, the amount of computation increases dramatically and can even be exponential. Facing the LEO satellite network with time-varying topology under normal circumstances, although the traversal algorithm can pre-calculate the lookup table, when there are unforeseen circumstances that lead to the failure of the satellite link and the need to re-calculate the clock transfer path, the traversal algorithm has a large amount of computational workload, and it cannot compute the results in time, which generates unpredictable delay and jitter, greatly affecting the transmission and processing of information.