libgraph
libgraph copied to clipboard
get_shortest_path doesn't work correctly on undirected graphs
Hi!
I found an example, where get_shortest_path
didn't works, where it looks like it should:
g = Graph.new(type: :undirected) |> Graph.add_vertices([1, 2, 3]) |> Graph.add_edge(1, 3) |> Graph.add_edge(3, 2)
Graph.get_shortest_path(g, 1, 2) # => nil
I think, that get_shortest_path
should raise on undirected graphs or calculate path correctly.
This seems to be a general problem, see issue #11 .
The pathfinding has not been implemented for undirected graphs yet, but if anyone is interested in lending a hand there, I'd love to get support fleshed out so that we can get it addressed. I'm happy to lend a hand in review or with suggestions on how to approach it for anyone not sure where to start.
The pathfinding has not been implemented for undirected graphs yet, but if anyone is interested in lending a hand there, I'd love to get support fleshed out so that we can get it addressed. I'm happy to lend a hand in review or with suggestions on how to approach it for anyone not sure where to start.
Hello, I made a implementation for finding shortest path on undirected graphs. Could you review it ?