For the "how to find the way through a labyrinth of edges":
The attribute idea might work, but a bit better (also for the example) is to use two distinct attributes: Entry and Exit.

Any other idea how to tell the script which edge to use next at a "multi-edge" vertex?