article, Mark McConnaughay developed an algorithm to automatically calculate all possible unique layout designs using the Ikea Lillabo wooden train sets that includes curved and straight pieces. It is an interesting, brute force approach to the problem that ends up being quite elegant. If you are Python programmer (I am not) you might find the detail described on the blog linked above interesting.
The animated gif from his site shows the 16 possible uniques solutions from a basic set of track.
The solution does not include turnouts, which can complicate the situation considerably. I wonder if this will turn out to be a new class of computational math problems with a model railroad twist. Any math majors out there want to try for a closed form solution?