Newbie question: I would like to implement lattice structure as an array of structs named Node, where each Node contains as one of its field a list of its neighbouring Nodes in the lattice. My, possibly naive, first try
mutable struct Node
value :: Int
neighbors :: Array{Union{Node,Int},1}
end
where I use the Union type to duck the issue of self-reference works, but I wonder if there is a more elegant way, and if there are no performance penalties incurred by using the Union type in this way.