  Most epidemic processes on networks can be modelled by a compartmental model,
that specifies the spread of a disease in a population. The corresponding
compartmental graph describes how the viral state of the nodes (individuals)
changes from one compartment to another. If the compartmental graph does not
contain directed cycles (e.g. the famous SIR model satisfies this property),
then we provide an analytic, closed-form solution of the continuous-time
Markovian compartmental model on heterogeneous networks. The eigenvalues of the
Markovian process are related to cut sets in the contact graph between nodes
with different viral states. We illustrate our finding by analytically solving
the continuous-time Markovian SI and SIR processes on heterogeneous networks.
We show that analytic extensions to e.g. non-Markovian dynamics, temporal
networks, simplicial contagion and more advanced compartmental models are
possible. Our exact and explicit formula contains sums over all paths between
two states in the SIR Markov graph, which prevents the computation of the exact
solution for arbitrary large graphs.
