An Algebraic and Probabilistic Framework for Network Information Theory