graph: use iterators directly rather than copying into []graph.Node

There are still uses in test code; these can remain since they simplify
that code.
This commit is contained in:
Dan Kortschak
2020-06-06 11:20:54 +09:30
parent 91d83a4f35
commit 2bf857dc70
10 changed files with 57 additions and 22 deletions

View File

@@ -62,7 +62,9 @@ func AStar(s, t graph.Node, g traverse.Graph, h Heuristic) (path Shortest, expan
}
visited.Add(uid)
for _, v := range graph.NodesOf(g.From(u.node.ID())) {
to := g.From(u.node.ID())
for to.Next() {
v := to.Node()
vid := v.ID()
if visited.Has(vid) {
continue