mirror of
https://github.com/gonum/gonum.git
synced 2025-10-28 09:31:40 +08:00
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:
@@ -48,7 +48,9 @@ func BellmanFordFrom(u graph.Node, g graph.Graph) (path Shortest, ok bool) {
|
||||
uid := u.ID()
|
||||
j := path.indexOf[uid]
|
||||
|
||||
for _, v := range graph.NodesOf(g.From(uid)) {
|
||||
to := g.From(uid)
|
||||
for to.Next() {
|
||||
v := to.Node()
|
||||
vid := v.ID()
|
||||
k := path.indexOf[vid]
|
||||
w, ok := weight(uid, vid)
|
||||
|
||||
Reference in New Issue
Block a user