Using IGraphM, I want to get the `VertexComponent()`

neighbors around all nodes, in a periodic `IGTriangularLattice()`

graph. To do that, I do:

```
(*Dimensions of the graph*)
i = 5;
j = 5;
(*Graph and neighborhoods distance {1} from each node*)
myPeriodicGraph =
IGTriangularLattice({i, j}, VertexLabels -> "Name",
"Periodic" -> True,
VertexCoordinates -> GraphEmbedding(IGTriangularLattice({i, j})));
allNeighbors =
Table(VertexComponent(myPeriodicGraph, i, {1}), {i, 1,
VertexCount(myPeriodicGraph)});
```

Now, just to visualize the order in which `VertexComponent()`

gives the neighborhoods, I have a list of colors to highlight these neighbors for any given focal cell:

```
colorNeighbors = {Red, Lighter(Red), Lighter(Lighter(Red)),
Blue, Lighter(Blue), Lighter(Lighter(Blue))}
```

Okay, let’s see one particular neighborhood:

```
focalNode = 13;
GraphPlot(myPeriodicGraph,
VertexStyle -> (Rule(#((2)), #((1))) & /@
Transpose({colorNeighbors, allNeighbors((focalNode))})))
```

You can see that the `Red()`

tones are these neighbors to the “right” of the `focalNode`

, and the `Blue()`

tones are these to the left. But this is not always the case! Especially when we query one of the nodes sitting at the “edges” of the graph (edge in spatial coordinates; topologically this is a “periodic” space).

```
focalNode = 23;
GraphPlot(myPeriodicGraph,
VertexStyle -> (Rule(#((2)), #((1))) & /@
Transpose({colorNeighbors, allNeighbors((focalNode))})))
```

You can see that the colors are now “disorganized”. The same if you query other boundary nodes, and they disorganize in different ways:

So, my question is, can I get the neighborhoods in a way that they are always oriented in the same order? Let’s say I have a canonical ordering: `{W, NW, NE, E, SE, SW}`

, can I always get this order, no matter where the queried `focalNode`

is? (below an example from a ‘central’ node, a node on the edge of the graph should preserve the orientation of the list of neighbors).

Thanks!