Sum product algorithm on graphs is a general message passing algorithm that unifies many algorithms in channel coding, signal processing, Bayesian inference, and statistical physics. We show that, by extending the underlying algebraic and graphical structures of sum product algorithm, it also provides a unifying perspective for important distributed algorithms in communication networks. Examples treated here include Bellman-Ford (1957, 1962) routing, traffic shaping, wireless network power control, and congestion control. Through local message passing in the form of sum product algorithm on graphs, each of these network control algorithms solves a corresponding global optimization problem. This common framework also leads to new distributed algorithms, such as joint optimization of power control and utility maximization through distributed gradient descent.