From Erich Friedman's Math Magic, (problem #2 on that page) your challenge is to find the edge elimination number of a connected graph.
A single edge elimination is the removal of an edge from a graph, without disconnecting the graph, except for creating lone vertices. For instance, in the graph below, the two leftmost edges and the rightmost edge may be legally eliminated, but the center edge may not, because that would lead to two disconnected components larger than a single vertex.
An edge elimination sequence is the elimination of every edge in a graph in a specified order. Each elimination must be legal at the point in the sequence when it is performed. For instance, one legal edge elimination sequence on the above graph would be to remove the rightmost edge, then the center edge, then the top-left edge, then the bottom-left edge.
The edge elimination number of a graph is the number of different edge elimination sequences that a graph has. For instance, the above graph has an edge elimination number of 14. There are 4 sequences starting with the top left edge, 4 with the bottom left edge, and 6 with the right edge.
Input: The input graph is guaranteed to be connected. The graph will be given as a list of edges with labeled vertices. for instance, the above graph might be given as:
[(0,2), (1,2), (2,3), (3,4)]
Within that requirement, whatever format is most convenient for your language/code is fine. Don't cheese this. (e.g. no code in the vertex labels.)
Code: You may write a program taking input from the command line or from STDIN, or a function, or a verb, or your language's equivalent.
This is code golf, fewest bytes wins.
Tests:
One edge:
[(0,1)]
1
Path:
[(0,1), (1,2), (2,3), (3,4)]
8
Triangle with two additional edges off one vertex:
[(0,1), (1,2), (0,2), (0,3), (0,4)]
92
Randomly generated:
[(0, 2), (0, 4), (1, 2), (1, 4), (2, 5), (3, 4), (3, 5)]
1240
[(0, 2), (0, 3), (1, 3), (1, 4), (1, 5), (2, 3), (3, 4), (3, 5)]
16560
Again, this is code golf, fewest bytes wins. Please ask any clarifying questions, or tell me if I've done something wrong.