The gas-gathering pipeline network is a critical infrastructure for collecting and conveying natural gas from the extraction site to the processing facility. This paper introduces a design optimization model for a star–tree gas-gathering pipeline network within a discrete space, aimed at determining the optimal configuration of this infrastructure. The objective is to reduce the investment required to build the network. Key decision variables include the locations of stations, the plant location, the connections between wells and stations, and the interconnections between stations. Several equality and inequality constraints are formulated, primarily addressing the affiliation between wells and stations, the transmission radius, and the capacity of the stations. The design of a star–tree pipeline network represents a complex, non-deterministic polynomial (NP) hard combinatorial optimization problem. To tackle this challenge, a hierarchical optimization framework coupled with an improved genetic algorithm (IGA) is proposed. The efficacy of the genetic algorithm is validated through testing and comparison with other traditional algorithms. Subsequently, the optimization model and solution methodology are applied to the layout design of a pipeline network. The findings reveal that the optimized network configuration reduces investment costs by 16% compared to the original design. Furthermore, when comparing the optimal layout under a star–star topology, it is observed that the investment needed for the star–star topology is 4% higher than that needed for the star–tree topology.