I initially asked this question over at [StackOverflow](https://stackoverflow.com/questions/29804095/ordered-lattice-point-enumeration) as it has algorithmic flavor to it, but I haven't been getting much traction so I thought I would probe the mathematics community.


**Setup:** Let $e\_{i}$ be an orthogonal (but not orthonormal) basis for $\mathbb{R}^{N}$. Define $\Lambda=\big\{\sum\_{j=1}^{N}x\_{j}e\_{j}\mid x\_{j}\in\mathbb{N}\big\}$ (where here I assume $0\in\mathbb{N}$). Now order the points in $\Lambda$ first by their $L^{1}$-norm, breaking ties lexicographically.


**Question:** Is there an efficient algorithm for producing the points in $\Lambda$ in order (up to some pre-defined bound)? Note that I want to walk this set in order, not produce it and then sort it.


**Observations:** This is easy to do if the $e\_{i}$ are orthonormal. For instance, the problem is solved [here](https://literateprograms.org/generating_all_integer_lattice_points__python_.html). To make something like this work here, one would need to be able to efficiently answer the following. given positive real numbers $x\_{1},x\_{2},\ldots, x\_{N}$, is there an efficient way to the numbers $\sum\_{j=1}^{N}n\_{j}x\_{j}$ in increasing order, where $n\_{j}\in\mathbb{N}$.



Ordered lattice point enumeration
I am going to try to answer the version of the Observation which seems to imply that the original "orthogonal" basis condition really is meant to mean "positive multiples of the standard basis vectors". So the problem is, given positive real numbers $x\_1$, $x\_2$, ..., $x\_j$, produce the first $M$ elements of the set $x\_1 \mathbb{N} + x\_2 \mathbb{N} + \cdots + x\_j \mathbb{N}$ in order. For simplicity I'm going to ignore the possibility of ties (this is easily dealt with). The basic idea is just to think of this as a shortest paths problem in the graph $\mathbb{N}^j$ (where the edges are given by the standard basis vectors $e\_i$ and the weight of the edge $e\_i$ is $n\_i$.) Now [Dijkstra's algorithm](http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) does this efficiently (we can just stop when the $M$ nearest neighbours are found). For this particular set up there are even some extra gains to be made -- since we know that the distance to a vertex is independent of the path used to get to it, we can choose a standard path to every vertex (e.g., go along the first dimension, then the second, ...) and only add those neighbours that extend such standard paths.


