  We define the concept of an `open' Markov process, a continuous-time Markov
chain equipped with specified boundary states through which probability can
flow in and out of the system. External couplings which fix the probabilities
of boundary states induce non-equilibrium steady states characterized by
non-zero probability currents flowing through the system. We show that these
non-equilibrium steady states minimize a quadratic form which we call
`dissipation.' This is closely related to Prigogine's principle of minimum
entropy production. We bound the rate of change of the entropy of a driven
non-equilibrium steady state relative to the underlying equilibrium state in
terms of the flow of probability through the boundary of the process.
  We then consider open Markov processes as morphisms in a symmetric monoidal
category by splitting up their boundary states into certain sets of `inputs'
and `outputs.' Composition corresponds to gluing the outputs of one such open
Markov process onto the inputs of another so that the probability flowing out
of the first process is equal to the probability flowing into the second. We
construct a `black-box' functor characterizing the behavior of an open Markov
process in terms of the space of possible steady state probabilities and
probability currents along the boundary. The fact that this is a functor means
that the behavior of a composite open Markov process can be computed by
composing the behaviors of the open Markov processes from which it is composed.
We prove a similar black-boxing theorem for reaction networks whose dynamics
are given by the non-linear rate equation. Along the way we describe a more
general category of open dynamical systems where composition corresponds to
gluing together open dynamical systems.
