mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 15:47:01 +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:
@@ -140,7 +140,9 @@ func (lt *lengauerTarjan) dfs(g graph.Directed, v graph.Node) {
|
||||
ltv.label = ltv
|
||||
lt.nodes = append(lt.nodes, ltv)
|
||||
|
||||
for _, w := range graph.NodesOf(g.From(v.ID())) {
|
||||
to := g.From(v.ID())
|
||||
for to.Next() {
|
||||
w := to.Node()
|
||||
wid := w.ID()
|
||||
|
||||
idx, ok := lt.indexOf[wid]
|
||||
|
@@ -162,7 +162,9 @@ func (lt *sLengauerTarjan) dfs(g graph.Directed, v graph.Node) {
|
||||
ltv.label = ltv
|
||||
lt.nodes = append(lt.nodes, ltv)
|
||||
|
||||
for _, w := range graph.NodesOf(g.From(v.ID())) {
|
||||
to := g.From(v.ID())
|
||||
for to.Next() {
|
||||
w := to.Node()
|
||||
wid := w.ID()
|
||||
|
||||
idx, ok := lt.indexOf[wid]
|
||||
|
Reference in New Issue
Block a user