We address general optimization problems formulated on networks. Each node in the network has a function, and the goal is to find a vector x ∈ ℝ n that minimizes the sum of all the functions. We assume that each function depends on a set of components of x, not necessarily on all of them. This creates additional structure in the problem, which can be captured by the classification scheme we develop. This scheme not only to enables us to design an algorithm that solves very general distributed optimization problems, but also allows us to categorize prior algorithms and applications. Our general-purpose algorithm shows a performance superior to prior algorithms, including algorithms that are application-specific.