In IEEE802.15.4 compatible network, TDMA mechanism was used to access the medium and all nodes communicate to each other within one superframe periodically. In order to use the time slot efficiently, graph coloring algorithms are used to schedule the time slots in wireless sensor network. In this paper, the impacts of different assignments on network performance were analyzed and the result was extended to mesh topology network. The proposed data delay model was used to design a PSO algorithm to optimize the assignment schema. Finally, simulation was carried out to verify the practicability of the algorithm and the optimization effect was shown.