http://www.perlmonks.org?node_id=469074

in reply to Re: If I had a Free Two Months...
in thread If I had a Free Two Months...

This sounds essentially like a graph theory problem. Have a track segments be arcs and the places where they connect be nodes. I don't know exactly what the criteria are for a "connecting, valid layout", but I'll assume it's at least planarity (no tracks crossing one another) and that there always exists a non-zero-length path from a node to itself. The presence of cross-over bridges permit a special case of track-crossing, so graphs with a c.o.b. would be allowed to be non-planar only for the c.o.b. arcs. Switches are just two arcs going to/coming from the same node.

Once you've got the graph designed, you can start tackling the problem of laying it out spatially so that it fits with the pieces.

Replies are listed 'Best First'.
Re^3: If I had a Free Two Months...
by pboin (Deacon) on Jun 22, 2005 at 16:23 UTC

That's pretty much what I've thought about so far. The place where my brain just starts to smoke is the switches. Not only does a switch have one 'in' and two 'out' paths, but if you flip it over, one 'out' is in the same place and the other 'out' is in a third place.

I just can't figure out how the recursion would work in that situation. Fortunately, I'm too busy with paying work to figure that out right now.