def is_graphical(sequence, method='eg'):
 if (method == 'eg'):
  valid = is_valid_degree_sequence_erdos_gallai(list(sequence))
 elif (method == 'hh'):
  valid = is_valid_degree_sequence_havel_hakimi(list(sequence))
 else:
  msg = "`method` must be 'eg' or 'hh'"
  raise nx.NetworkXException(msg)
 return valid

def is_graphical ( sequence , method = 'eg' ) : if ( method == 'eg' ) : valid = is_valid_degree_sequence_erdos_gallai ( list ( sequence ) ) elif ( method == 'hh' ) : valid = is_valid_degree_sequence_havel_hakimi ( list ( sequence ) ) else : msg = "`method` must be 'eg' or 'hh'" raise nx . NetworkXException ( msg ) return valid
returns true if sequence is a valid degree sequence .