Dense Graph Algorithm