V
VisionSet
I have a graph of cells that build a simple 2D grid.
Each node is associated with its north, south, east, west neighbour.
In the problem I have, I need to traverse the nodes in either north/south or
east/west directions.
But I realsise I can split my problem in half by just going along one axis
and then doing a transpose for the other.
What is the best way of implementing the transpose? At present I have all
my nodes collected in a Node[][].
Do I really want to travserse the array and call transpose on every node,
since I do this regularly?
I naturally don't want to optimise prematurely, but is there a better
approach?
TIA
Mike W.
Each node is associated with its north, south, east, west neighbour.
In the problem I have, I need to traverse the nodes in either north/south or
east/west directions.
But I realsise I can split my problem in half by just going along one axis
and then doing a transpose for the other.
What is the best way of implementing the transpose? At present I have all
my nodes collected in a Node[][].
Do I really want to travserse the array and call transpose on every node,
since I do this regularly?
I naturally don't want to optimise prematurely, but is there a better
approach?
TIA
Mike W.