Closed mtfishman closed 6 months ago
The current design is based off of Networkx in Python: https://networkx.org/documentation/stable/reference/generated/networkx.generators.lattice.hexagonal_lattice_graph.html
So you get the same output there:
I agree it would be better to just have a non-periodic version and then a periodic version that calls that and adds edges and still has the same number of vertices.
Unlike the square lattice, however, I think it is a bit more tricky to do that because there is a slight complexity of which vertices should actually wrap around to which ones in the periodic case in order to preserve the hexagonal structure. This is why n
(the second argument) must be even for when you set the flag periodic=true
and you can't do hexagonal_lattice_graph(1,1; periodic = true)
(because neighboring columns of the lattice need to be shifted relative to each other).
Hence, as far as I understand, you can't just take the open boundary version and add edges (it would break the properties of the hexagonal lattice). You would need to create a new open boundary version which looks slightly weird because the right side of the right-most column would be broken and have some `dangling' vertices.
You're probably right. I think I was partially confused by #59, and not being sure how to interpret m
and n
in hexagonal_lattice_graph(m, n; periodic)
in the case of periodic=true
. Can I think of m
and n
as the number of rows and columns of hexagons, whether or not periodic=true
? I can see why, in that case, the number of vertices won't be the same between periodic=true
and false
, since there are boundary vertices that are shared across the periodic boundary.
Yeah m
and n
are the numbers of rows and columns of hexagons. If you then set the periodic
flag to true
it will build the m
rows and n
columns of hexagons but then "fuse" (merge vertices) the right-most column with the left-most one and "fuse" the top-most row with the bottom-most one
Makes sense, thanks for the clarification, I think besides #59 the behavior makes sense.
Changing the setting of
periodic
inhexagonal_lattice_graph
changes the lattice size:I think instead it should output graphs with the same number of vertices and structure, just with extra periodic edges if
periodic=true
. It is implemented that way right now because the periodic graphs are constructed by first constructing the corresponding non-periodic version of the lattice and then merging vertices, it could still be implemented that way with some code restructuring, for example having an inner non-periodic version which the periodic version calls. The current design makes it difficult to reason about what size lattice will get output. (@JoeyT1994)