Well, in computer terms, a matrix is a list of lists (or an array of arrays). This would be a 5x5 matrix:
Code:
AD000
0000B
00000
00C00
00000
(A) has two potential connections with neighbors, to the right and below. (B) has three potential connections (up, down, and left). Finally, (C) has four potential (up, down, right, and left).
However, I only want to count unique connections. So, for example, even though (A) has two neighboring nodes and (D) has three, the connection between them should only be counted once.