Thermodynamic graph-rewriting (Logical Methods in Computer Science, 2015)