Add options for mixed PBC/OBC and direction-colored edges to Grid
Created by: femtobit
This PR extends Grid
to support mixed boundary conditions by passing a list of booleans to pbc=
. It also adds an option to color the edges by direction in order to make it easier to define anisotropic models.
Grid(length=[8, 8], pbc=[True, False]) # cylinder
Grid(length=[8, 8], color_edges=True) # differently colored x/y edges
Under the hood, this PR also changes how the color is stored in NetworkX
graphs: Previously, it was stored as the key of an edge, which is a networkx.MultiGraph
-feature meant to distinguish multiple edges between the same node. Now, I use an extra attribute "color"
on each edge. This makes the implementation easier (attributes can be added and changed more easily than edge keys) and could allow us to use normal graphs where a multigraph is not needed in the future.