Total no of closed loop paths in 3-by-3 grid Rules for making a closed loop path:


*

*The path must pass through all points.

*The path have to pass each point only once.

*The path is formed by joining only consecutive points (defined below).


The consecutive points are those points that are consecutive horizontally or vertically. But there is one more thing, the left most points are also consecutive to the right most points and the top most points are consecutive to the bottom most points.
Let's take example of 3-by-3 grid:
A   B   C

D   E   F

G   H   I

$A$ is consecutive to $B$ (if we go right), $C$ (if we go left), $G$ (if we go up) and $D$ (if we go down).
So every point has 4 consecutive points if n > 2, and 
                   2 consecutive points if n = 2,
where n is number of points in each row and each column of a square grid.
An example of the path in the above is $ABCFIHEDGA$
For 2-by-2 case, 
A   B

C   D

there is only one possible path, i.e., $ABDCA$ ($BDCAB$ and $ACDBA$ are same as $ABDCA$, i.e. the order is circular and has no direction).
What is the total no of the paths in 3-by-3 grid? Generalize it for n-by-n grid.
 A: There are $48$ such paths for $n=3$. For $n=4$ the count is $1344$ and the relevant sequence does not seem to appear in OEIS.
I counted these by depth-first search.  Here are the $96$ paths you get if you count a path and its reverse as different:
ABCFDEHIG, ABCFEHIGD, ABCFIGHED, ABCFIHEDG, ABCIFDEHG, ABCIFEHGD, ABCIGHEFD, 
   ABCIHEFDG, ABEDFCIHG, ABEDGHIFC, ABEFCIHGD, ABEFDGHIC, ABEHGDFIC, ABEHGICFD, 
   ABEHICFDG, ABEHIGDFC, ABHEDFCIG, ABHEDGIFC, ABHEFCIGD, ABHEFDGIC, ABHGDEFIC, 
   ABHGICFED, ABHICFEDG, ABHIGDEFC, ACBEDFIHG, ACBEFIHGD, ACBEHGIFD, ACBEHIFDG, 
   ACBHEDFIG, ACBHEFIGD, ACBHGIFED, ACBHIFEDG, ACFDEBHIG, ACFDGIHEB, ACFEBHIGD, 
   ACFEDGIHB, ACFIGDEHB, ACFIGHBED, ACFIHBEDG, ACFIHGDEB, ACIFDEBHG, ACIFDGHEB, 
   ACIFEBHGD, ACIFEDGHB, ACIGDFEHB, ACIGHBEFD, ACIHBEFDG, ACIHGDFEB, ADEBCFIHG, 
   ADEBHGIFC, ADEFCBHIG, ADEFCIGHB, ADEFICBHG, ADEFIGHBC, ADEHBCFIG, ADEHGIFCB, 
   ADFCBEHIG, ADFCIGHEB, ADFEBCIHG, ADFEBHGIC, ADFEHBCIG, ADFEHGICB, ADFICBEHG, 
   ADFIGHEBC, ADGHBEFIC, ADGHEFICB, ADGHICFEB, ADGHIFEBC, ADGICFEHB, ADGIFEHBC, 
   ADGIHBEFC, ADGIHEFCB, AGDEBHIFC, AGDEFCIHB, AGDEFIHBC, AGDEHIFCB, AGDFCIHEB, 
   AGDFEBHIC, AGDFEHICB, AGDFIHEBC, AGHBCIFED, AGHBEDFIC, AGHEBCIFD, AGHEDFICB, 
   AGHICBEFD, AGHICFDEB, AGHIFCBED, AGHIFDEBC, AGICBHEFD, AGICFDEHB, AGIFCBHED, 
   AGIFDEHBC, AGIHBCFED, AGIHBEDFC, AGIHEBCFD, AGIHEDFCB
Mathematica code:
n = 3;
pts = Tuples[Range[0, n - 1], 2];
adj[x_, y_] := 
adj[x, y] = (Count[x - y, 0] == 1) && MemberQ[{1, n - 1}, Max[Abs[x - y]]];
extensions[p_] := Select[Complement[pts, p], adj[Last[p], #] &];

DFS[p_] := (
   If[Length[p] == n^2 && adj[First[p], Last[p]], Sow[p]; Return];
   Scan[DFS[Append[p, #]] &, extensions[p]]);
paths = Reap[DFS[{{0, 0}}]][[2, 1]];

