2

The matrix is a rectangular construct and therefore intuitively suited for modeling things arranged rectangularly.

However, for other than rectangular shapes. E.g. triangular networks.

How to use the matrix?

mavavilj
  • 7,270

1 Answers1

0

This depends on what size and shape your triangular of hexagonal grid is.
First fix some vertex in it and call it the origin.

Use matrices, but the $(i, j)$ - entry in the matrix corresponds to the vertex that is gotten by moving $i$ horizontal arrows and $j$ upward (it's not vertical as it would be in the square lattice case) (see the arrows in your picture:)

enter image description here

If you don't have the origin in a suitable corner, you will also need negative indices (you need to include zero as an index anyhow). And depending on the shape of your region some of your indices might not correspond to a vertex. These they can be left empty in the matrix.

Here is good site for hexagonal stuff: https://www.redblobgames.com/grids/hexagons/ (look at coordinate systems).

ploosu2
  • 8,707
  • This answer assumes you want to store the vertices as the entries of the matrix. For example if you thinks of them as some sort of tiles and store what tile is there. If you want to store the adjacency matrix of the network, that is just a matrix having the weights, but I will tell you that will sparse! – ploosu2 Feb 03 '18 at 14:02