def left_d_threshold_sequence(n, m):
 cs = (['d'] + (['i'] * (n - 1)))
 if (m < n):
  cs[m] = 'd'
  return cs
 if (m > ((n * (n - 1)) / 2)):
  raise ValueError('Too many edges for this many nodes.')
 cs[(n - 1)] = 'd'
 sum = (n - 1)
 ind = 1
 while (sum < m):
  cs[ind] = 'd'
  sum += ind
  ind += 1
 if (sum > m):
  cs[(sum - m)] = 'i'
 return cs

def left_d_threshold_sequence ( n , m ) : cs = ( [ 'd' ] + ( [ 'i' ] * ( n - 1 ) ) ) if ( m < n ) : cs [ m ] = 'd' return cs if ( m > ( ( n * ( n - 1 ) ) / 2 ) ) : raise ValueError ( 'Too many edges for this many nodes.' ) cs [ ( n - 1 ) ] = 'd' sum = ( n - 1 ) ind = 1 while ( sum < m ) : cs [ ind ] = 'd' sum += ind ind += 1 if ( sum > m ) : cs [ ( sum - m ) ] = 'i' return cs
create a skewed threshold graph with a given number of vertices (n) and a given number of edges (m) .