I was recently at dinner with some Linux kernel hackers who were showing off their smartphones. These phones have an interesting unlock mechanism: the phone displays an 3-by-3 array of circles, and the user traces out a path among the circles. If the path is correct, the phone unlocks.
The paths are not arbitrary. From what I could see, here are the rules governing them:
How many unique paths are there?
The paths are not arbitrary. From what I could see, here are the rules governing them:
- Paths are composed of a series of straight line segments.
- Each line segment connects a pair of circles.
- If the preceding line segment arrived at a given circle, then the next line segment must leave that same circle.
- A given circle may be visited only once.
- A line segment may pass over a given circle without visiting it only if that circle has already been visited. (Attempting to pass over a not-yet-visited circle will instead visit that circle.)
How many unique paths are there?

Comments
You missed a condition. There's also a minimum sequence length.