Apologies for the academic response ... but the algorithm Sin Knuth TAOCP , Volume 4, Fascicle 4 is precisely about generating all spanning trees (p. 26ff). There are some musings when he talks about spanning trees, but your best bet is TAOCP.
source
share