I got bored, so I quickly put together a function in python to determine if a given degree sequence is graphical. It uses the Erdős–Gallai theorem to do the checking. I know it isn’t the most difficult function in the world to write, but I find it useful.

Update: 2012-01-23

After actually going to class, I did another implementation that uses the Havel-Hakimi algorithm instead. Both work, but I thought I would share this one too. Plus this one is recursive, and who doesn’t love recursion?