new algorithm for exact degree graph generation