National security education in the new era puts forward new and higher expectations on the scope, degree, speed, and object of knowledge dissemination, while presenting new dissemination characteristics such as all-media and group emergence.Based on graph theory algorithm, this study proposes a dissemination model with credibility constraints about national security education knowledge.Text mining is used to analyze discussions of social network users on national security education knowledge from Sina Weibo and Baidu Search. The dissemination mechanism of national security knowledge is explored through text analysis. Based on this, different expectations of information dissemination are set to conduct numerical simulation. The simulation results show the model is highly sensitive to parameter changes. In the case of R < 1, with the increase of β, the time for S to reach the steady state decreases, and the time for I to reach the maximum value decreases, while the maximum value increases.When β = 0.03, Max I = 39.86; and when μ = 0.3, Max I = 37.23. The model plays an important role in controlling and managing knowledge dissemination.The proposed graph theory-based knowledge diffusion model achieves an average knowledge stock of 0.924 under regular networks and 0.726 under scale-free networks. In terms of knowledge diffusion rate, this model outperforms both the traditional knowledge diffusion model and the random diffusion model.