  Phenomenological nonequilibrium thermodynamics describes how fluxes of
conserved quantities such as matter, energy and charge flow from outer
reservoirs across a system, and how they irreversibly degrade from one form to
another. Stochastic thermodynamics is formulated in terms of probability fluxes
circulating in the system's configuration space. The consistency of the two
frameworks is granted by the condition of local detailed balance, which
specifies the amount of physical quantities exchanged with the reservoirs
during single transitions between configurations. We demonstrate that the
topology of the configuration space crucially determines the number of
independent thermodynamic affinities (forces) that the reservoirs generate
across the system, and provide a general algorithm that produces the
fundamental affinities and their conjugate currents contributing to the total
dissipation, based on the interplay between macroscopic conservations laws for
the currents and microscopic symmetries of the affinities.
