Open amengcs opened 1 year ago
The following tree has a single "root" and 5 children attached to that root. I expected the depth to be 2.
BFSWithDepth increments and passes "depth" to the visit function with values as high as 6.
For this case, it increments depth for the root and again for each child attached to the root as it loops through the adjancency graph.
resourceHash := func(r Resource) string { return r.Name() }
s.tree = graph.New(resourceHash, graph.Tree(), graph.Directed(), graph.PreventCycles()) s.tree.AddVertex(NullResource{"root"}) s.tree.AddVertex(NullResource{"A"}) s.tree.AddVertex(NullResource{"B"}) s.tree.AddVertex(NullResource{"C"}) s.tree.AddVertex(NullResource{"D"}) s.tree.AddVertex(NullResource{"E"}) s.tree.AddEdge("root", "A") s.tree.AddEdge("root", "B") s.tree.AddEdge("root", "C") s.tree.AddEdge("root", "D") s.tree.AddEdge("root", "E")
Using version 0.23.0 (latest) It seems like it is returning "width + 1" instead of "depth".
+1 to this 🤕
First of all, sorry for the late response – I'm going to review #153 today.
The following tree has a single "root" and 5 children attached to that root. I expected the depth to be 2.
BFSWithDepth increments and passes "depth" to the visit function with values as high as 6.
For this case, it increments depth for the root and again for each child attached to the root as it loops through the adjancency graph.
resourceHash := func(r Resource) string { return r.Name() }