You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The order in which the traversed methods of a TraversalListener for a DepthFirstIterator are called seems wrong to me. I would expect that edges would always be traversed right before the vertex they are leading to. Instead, for a branching point, all outgoing edges are traversed, and then the traversal is continued from one of the edge's targets.
Steps to reproduce (small coding example)
val graph = SimpleDirectedGraph<String, DefaultEdge>(DefaultEdge::class.java)
graph.addVertex("1")
graph.addVertex("2")
graph.addVertex("3")
graph.addVertex("4")
graph.addEdge("1", "2")
graph.addEdge("1", "3")
graph.addEdge("2", "4")
graph.addEdge("3", "4")
class MyListener(): TraversalListener<String, DefaultEdge> {
override fun connectedComponentFinished(e: ConnectedComponentTraversalEvent) {}
override fun connectedComponentStarted(e: ConnectedComponentTraversalEvent) {}
override fun edgeTraversed(e: EdgeTraversalEvent<DefaultEdge>) {
println("visit edge ${e.edge}")
}
override fun vertexTraversed(e: VertexTraversalEvent<String>) {
println("visit vertex ${e.vertex}")
}
override fun vertexFinished(e: VertexTraversalEvent<String>) {}
}
val listener = MyListener()
val iterator = DepthFirstIterator(graph, "1")
iterator.addTraversalListener(listener)
iterator.forEach { _ -> }
Issue
The order in which the traversed methods of a TraversalListener for a DepthFirstIterator are called seems wrong to me. I would expect that edges would always be traversed right before the vertex they are leading to. Instead, for a branching point, all outgoing edges are traversed, and then the traversal is continued from one of the edge's targets.
Steps to reproduce (small coding example)
Expected behaviour
I would expect to get as output:
Instead I get:
The text was updated successfully, but these errors were encountered: