Graph Design via Convex Optimization: Online and Distributed Perspectives