  We develop a general stochastic thermodynamics of RLC electrical networks
built on top of a graph-theoretical representation of the dynamics commonly
used by engineers. The network is: open, as it contains resistors and current
and voltage sources, nonisothermal as resistors may be at different
temperatures, and driven, as circuit elements may be subjected to external
parametric driving. The proper description of the heat dissipated in each
resistor requires care within the white noise idealization as it depends on the
network topology. Our theory provides the basis to design circuits-based
thermal machines, as we illustrate by designing a refrigerator using a simple
driven circuit. We also derive exact results for the low temperature regime in
which the quantum nature of the electrical noise must be taken into account. We
do so using a semiclassical approach which can be shown to coincide with a
fully quantum treatment of linear circuits for which canonical quantization is
possible. We use it to generalize the Landauer-Buttiker formula for energy
currents to arbitrary time-dependent driving protocols.
