Scale-free network optimization: foundations and algorithms