Number of phone locking patterns LG android cell phones have locking screens with $9$ points to be traced in any pre-specified fashion (drawing pattern) so as to join $\geq 4$ points without including any points more than once.
Quoting from a Quora post...


*

*You cannot go over an unlit dot without lighting it. For example, the
pattern [0 2 1 4] is illegal, because moving your finger between 0 and
2 will light 1.


*Once a dot is lit, you can use it to reach another
unlit dot. For example, both [0 4 3 5] and [0 4 5 3] are legal.

The numbers are assigned as:
$$\begin{matrix}0&1&2\\3&4&5\\6&7&8\end{matrix}$$
Right off the bat, the maximum options available depend on the position within the grid:

The question is two-fold:

*

*How many patterns are possible, given that not all points present the same number of choices for the next move, as well as a minimum ($4$) and maximum ($9$) number of points included in the pattern? And is there a way of obtaining a closed-form calculation as opposed to a computer simulation as in this Quora post?


*Does the "pattern" inherent to the drawing on a rigid structure makes some patterns more likely than others (e.g. a letter "C")?
 A: There have been many attempts at computing this number. Most famously this video which appears to show every possible combination.
All of these report the number as: 389,112
A team of researchers from the University of Pennsylvania looking into how these types of passwords could be discerned through fingerprint smudges also calculated the same number (turns out they were also the first to research these kind of "Smudge Attacks").
I don't believe there is a "nice" (non-exhaustive) method of finding this number. The paper on "Smudge Attacks" also states:

Due to the complexity of the intermediate contact point restriction,
we calculated this result via brute force methods.

While this is not a proof, I'd like to provide some intuition as to why this would only have solutions based on exhaustive searches.
A smaller version of this problem would be counting the number of Hamiltonian Paths (a path that visits every dot exactly once) of the following graph (which ignores the "Once a dot is lit, you can use it to reach another unlit dot" condition):

However, counting Hamiltonian path for most graphs usually requires an exhaustive search.

the problem of finding a Hamiltonian path is NP-complete, so the only known way to determine whether a given general graph has a Hamiltonian path is to undertake an exhaustive search (Wolfram Mathworld)

So counting all passwords which use all 9 dots probably requires an exhaustive search.
So to answer your first question: No it's unlikely there is a nice closed-form calculation to the problem that isn't exhaustive.
As to your second question: I believe psychological factors may be more significant. A paper from 2014, showed a lot of passwords only used 4 dots, and many passwords were just alphabetic letters like C, N, O, etc.
If you'd like to know if there are more "rigid structure" passwords than "non-rigid structure" passwords, you'd need to define "rigid structure" more precisely.
A: Use concept of graph theory(Depth first search) where every dot on the lock screen is a node.Assume every dot in the lock screen is connected with all the the other dots. So there are total 9C2 =36 edges.
Now suppose you are at any dot on the lock screen.First we mark the dot as visited. From this dot you can only jump to those dots which have the following properties:
1.There are no unvisited dots on the straight line joining the two dots.
2.The dot we are gonna jump to must be unvisited
Proceeding same way; after searching through all the possible patterns from this dot when we leave the dot (i.e we move to parent dot or node), we mark the dot as unvisited.
Thus we visit through all the possible patterns.
then fianally we will get total number of pattern is 389112
