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
pathTo and shortestPathTo do not find a path if there is a path going the opposite direction to the edges and .withDirection(GraphTraversal.AnyConnected) is provided.
val g = Graph(1 ~> 2)
val path = g.get(2).withDirection(GraphTraversal.AnyConnected).pathTo(g.get(1))
println(path) // -> None
The text was updated successfully, but these errors were encountered:
this behaviour is intentional - sorry for not having documented it explicitely. Here are the reasons:
Examining the Path type you will realize that it contains the inner nodes and, lazily, the inner edges that are on a path of the given graph. The library is designed such that you cannot compose a Path that contains non-existing nodes or edges with respect to the underlying graph. So pathTo and shortestPathTo can never return a non-existing path.
To achieve the desired result, you could build an inverse respectively undirected graph prior to calling pathTo or shortestPathTo.
More efficienly, a new Path method inverse could be added to the Path class that returns a sequence of nodes/edges. Certainly you can achieve this on your own as well.
pathTo and shortestPathTo do not find a path if there is a path going the opposite direction to the edges and .withDirection(GraphTraversal.AnyConnected) is provided.
The text was updated successfully, but these errors were encountered: