The epidemic spread of infectious diseases is ubiquitous and often has a considerable impact on public health and economic wealth. The large variability in the spatio-temporal patterns of epidemics prohibits simple interventions and requires a detailed analysis of each epidemic with respect to its infectious agent and the corresponding routes of transmission. To facilitate this analysis, we introduce a mathematical framework which links epidemic patterns to the topology and dynamics of the underlying transmission network. The evolution, both in disease prevalence and transmission network topology, is derived from a closed set of partial differential equations for infections without allowing for recovery. The predictions are in excellent agreement with complementarily conducted agent-based simulations. The capacity of this new method is demonstrated in several case studies on HIV epidemics in synthetic populations: it allows us to monitor the evolution of contact behavior among healthy and infected individuals and the contributions of different disease stages to the spreading of the epidemic. This gives both direction to and a test bed for targeted intervention strategies for epidemic control. In conclusion, this mathematical framework provides a capable toolbox for the analysis of epidemics from first principles. This allows for fast, in silico modeling--and manipulation--of epidemics and is especially powerful if complemented with adequate empirical data for parameterization.