As of today, infectious diseases remain one of the leading causes of premature peoples' death on the Earth. According to the World Health Organization, over 1 billion people carry infectious diseases every year. The goal of preventive measures is to influence the source of the infection in order to reduce the contamination of the external environment, localize the spread of microbes, and increase the resistance of the population to diseases. Agent modeling can play a very important role in predicting the spread of diseases and in assessing containment and prevention measures. I consider the processes of spatial distribution and temporary change of these two groups of epidemics as infectious dynamics. As a rule, the topology of the prefractal graph in the proposed models takes on the hard-to-implement spatial components of the dynamics. The topology is expanded by volumetric graphs, and the dynamics of the accumulation of the prefractal graph, called its recognition, is responsible for the temporal component of the process. An elementary participant in the study is understood as an agent. The agent is active, in a certain state that can change under the influence of certain factors. Agent's properties include characteristics that form the level of immunity: height, weight, sex, income, marital status, education, geography, etc.