Thermal networks considering graph theory and thermodynamics