diff --git a/dag/dag.go b/dag/dag.go index 0026fd9fd..f8776bc51 100644 --- a/dag/dag.go +++ b/dag/dag.go @@ -167,7 +167,7 @@ func (g *AcyclicGraph) Walk(cb WalkFunc) error { defer g.debug.BeginOperation(typeWalk, "").End("") w := &Walker{Callback: cb, Reverse: true} - w.Update(&g.Graph) + w.Update(g) return w.Wait() } diff --git a/dag/walk.go b/dag/walk.go index 47965764c..a74f1142a 100644 --- a/dag/walk.go +++ b/dag/walk.go @@ -135,7 +135,7 @@ func (w *Walker) Wait() error { // // Multiple Updates can be called in parallel. Update can be called at any // time during a walk. -func (w *Walker) Update(g *Graph) { +func (w *Walker) Update(g *AcyclicGraph) { var v, e *Set if g != nil { v, e = g.vertices, g.edges diff --git a/dag/walk_test.go b/dag/walk_test.go index 5843ca64b..628ae6f64 100644 --- a/dag/walk_test.go +++ b/dag/walk_test.go @@ -9,7 +9,7 @@ import ( ) func TestWalker_basic(t *testing.T) { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Connect(BasicEdge(1, 2)) @@ -34,7 +34,7 @@ func TestWalker_basic(t *testing.T) { } func TestWalker_updateNilGraph(t *testing.T) { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Connect(BasicEdge(1, 2)) @@ -54,7 +54,7 @@ func TestWalker_updateNilGraph(t *testing.T) { } func TestWalker_error(t *testing.T) { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Add(3) @@ -94,7 +94,7 @@ func TestWalker_error(t *testing.T) { func TestWalker_newVertex(t *testing.T) { // Run it a bunch of times since it is timing dependent for i := 0; i < 50; i++ { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Connect(BasicEdge(1, 2)) @@ -130,7 +130,7 @@ func TestWalker_newVertex(t *testing.T) { func TestWalker_removeVertex(t *testing.T) { // Run it a bunch of times since it is timing dependent for i := 0; i < 50; i++ { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Connect(BasicEdge(1, 2)) @@ -170,7 +170,7 @@ func TestWalker_removeVertex(t *testing.T) { func TestWalker_newEdge(t *testing.T) { // Run it a bunch of times since it is timing dependent for i := 0; i < 50; i++ { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Connect(BasicEdge(1, 2)) @@ -211,7 +211,7 @@ func TestWalker_newEdge(t *testing.T) { func TestWalker_removeEdge(t *testing.T) { // Run it a bunch of times since it is timing dependent for i := 0; i < 50; i++ { - var g Graph + var g AcyclicGraph g.Add(1) g.Add(2) g.Add(3)