I have a data structure with an underlying immutable undirected graph. Separately, I have another class that handles moving to the vertices, adjacent to the current vertex. Current vertex can be set to any vertex in a graph.
The related (but unsatisfying) name options I came up with include:
- Traverser
- Iterator
- Cursor (Scrollable Cursor)
Traverser does not fit, because it implies visiting every single vertex of the graph, which is not required in my case. Also, the term "traverse" is used way more frequently in relation to the trees (i.e. the tree traversal), so it might confuse the code readers as they can assume underlying tree (which is a special case of a graph).
Iterator, seemingly, doesn't fit as well, since it also implies traversal of a container (i.e. visiting each vertex). Furthermore, Wikipedia page states that "There must be some way to determine when the iterator has exhausted all of the elements in the container", which never happens with my class. As a side-note, I am aware that some languages and frameworks use the term "Infinite Iterator" that can apply in theory but is somewhat confusing.
Cursor as in Database Cursor. The definition of Scrollable Cursor is the one that fits the best so far, but I wish I found something less specific to databases, more familiar, shorter, or related to the graph terminology.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…