Given a triangular lattice which grows with number n, as follows

I want to list all the connected points in the lattice to form the pairlist. As an example:
n=1:
pairlist={{p_{1},p_{2}},{p_{1},p_{3}},{p_{2},p_{3}}}
n=2:
pairlist={{p_{1},p_{2}},{p_{1},p_{4}},{p_{2},p_{3}},{p_{2},p_{4}},{p_{2},p_{5}},{p_{3},p_{5}},{p_{4},p_{5}},{p_{4},p_{6}},{p_{5},p_{6}}}
n=3:
pairlist={{p_{1},p_{2}},{p_{1},p_{5}},{p_{2},p_{3}},{p_{2},p_{5}},{p_{2},p_{6}},{p_{3},p_{4}},{p_{3},p_{6}},{p_{3},p_{7}},{p_{4},p_{7}},{p_{5},p_{8}},{p_{5},p_{6}},{p_{6},p_{8}},{p_{6},p_{9}},{p_{6},p_{7}},{p_{7},p_{9}},{p_{8},p_{10}},{p_{8},p_{9}},{p_{9},p_{10}}}
Notice that there is no need to list the elements in pairlist in order.
Questions:
- Is there some automatical way to do above tasks?
- If I have
points= Flatten[Table[Subscript[p, i], {i, 1, Binomial[n + 2, 2]}]];, how can I create the triangle lattice withpointsautomatically?
For Question-2, I make one code for n=2 in the below (is there any simple and general way for different n?).
pairlists = {};
n = 2;
points = Flatten[Table[Subscript[p, i], {i, 1, Binomial[n + 2, 2]}]];
For[ii = 1, ii <= Length[points], ii++,
For[jj = ii + 1, jj <= Length[points], jj++,
If[(Abs[points[[ii]][[2]]-points[[jj]][[2]]]==1&&ii != 3) ||(Abs[points[[ii]][[2]]-points[[jj]][[2]]]==2&&Abs[ii-jj]==2&& ii!=1 )||(Abs[points[[ii]][[2]]-points[[jj]][[2]]]==3&&Abs[ii-jj]==3&&ii!=3),
AppendTo[pairlists, {points[[ii]], points[[jj]]}];
]
];
]




p_{i}, how can I automatically get the triangular lattice pattern? – Xuemei Jun 10 '21 at 12:04p_{i}isn't Mathematica syntax. You can just dog = NearestNeighborGraph[points, VertexCoordinates -> points]where points is a list of the coordinates. No need for labels / symbols here. – flinty Jun 10 '21 at 12:06p_{i}is justSubscript[p,i]. I don't know how to write in the stackexchange. – Xuemei Jun 10 '21 at 12:07f[expr,p1,p2]=expr*(1+p1*p2), which are not values. @flinty – Xuemei Jun 10 '21 at 12:20n=2for question 2, could you also have a look? Thank you very much! – Xuemei Jun 10 '21 at 13:09points[[1]],points[[2]]instead of p1,p2. – flinty Jun 10 '21 at 13:24