## 1 Introduction
[PERSON], [PERSON], [PERSON], and [PERSON] [26] proposed an ant colony-based sensor deployment method but did not account for mutual sensor interference or environmental changes, limiting its optimization effectiveness. [PERSON], [PERSON], and [PERSON] [27] optimized sensor placement in water networks using a swarm-based ant colony algorithm, but its assumptions on network topology may not be applicable to all water systems. [PERSON], [PERSON], and [PERSON] [28] introduced an optimized coverage method using an improved genetic algorithm and a binary ant colony algorithm, highlighting the need for integrating multiple strategies to enhance convergence speed, though the method's complexity may limit practical use. In summary, while the ant colony algorithm shows potential in sensor placement optimization, challenges remain, including adaptability to dynamic environments, high computational complexity, and reliance on data quality. Future research could explore integrating other optimization techniques or machine learning to address these limitations. In sensor placement optimization, the ant colony algorithm excels at solving complex problems but faces challenges such as limited adaptability to dynamic environments, high computational complexity, sensitivity to parameter choices, and dependence on data quality. These limitations hinder its efficiency and adoption, particularly in precision-demanding applications like urban gas networks. This study introduces a novel approach combining ant colony optimization and hierarchical clustering, addressing both cost-effectiveness and system safety [23; 29; 30; 31]. Hierarchical clustering evaluates the importance of monitoring nodes to determine sensor density requirements, followed by ant colony optimization to fine-tune the sensor layout, minimizing unnecessary deployment and lowering costs. This method improves gas leak detection speed and accuracy, reduces sensor numbers, and optimizes cost-safety balance, enhancing the overall efficiency and sustainability of urban gas networks. This work represents the first systematic application of these methods to gas leak sensor placement in urban gas networks. Key contributions are summarized as follows:  
1. Combining clustering analysis and the ant colony algorithm: This study proposes a method for optimizing sensor layouts in urban gas networks by combining clustering analysis with the ant colony algorithm. Clustering analysis first evaluates the importance of monitoring nodes, and the ant colony algorithm then refines sensor placements. This approach improves layout precision, efficiency, and network coverage, enhancing leak detection and system safety. 2. Pheromone gradient adjustment strategy: This strategy introduces adjustments to the pheromone concentration gradient, represented by the parameters \(\alpha\), \(\beta\), and \(\rho\), in the ant colony algorithm. The parameter \(\alpha\) represents the relative importance of the nodes in terms of their environmental and safety characteristics, while \(\beta\) accounts for the physical distances between nodes. The parameter \(\rho\) represents the pheromone evaporation rate, which is influenced by methane diffusion in soil. The rate varies depending on soil type and moisture content. These adjustments ensure that the pheromone gradient is more accurately tailored to the specific conditions of the gas pipeline network, improving the effectiveness of sensor placement. By considering geological and environmental factors such as soil type, temperature, and the distribution of critical infrastructure, this strategy enhances the precision of the pheromone adjustment, making the algorithm more adaptable to complex and dynamic environments. 3. GIS and the ant colony algorithm in sensor layout optimization: This study applies Geographic Information System (GIS) technology to analyze the urban gas network's 2D distribution and integrates it with the ant colony algorithm for sensor placement optimization.