This is a really quick and dirty script to calculate the number of spanning trees of a graph using Kirchoff's Matrix Tree Theorem.
The use of this script requires that the user actually knows how the algorithm works as much of it is manual.
More information can be found at Wikipedia: http://en.wikipedia.org/wiki/Kirchhoff%27s_theorem
Note: There's a lot of non-DRY code and not particularly good implementations of things, but it gets the job done.