libgraph icon indicating copy to clipboard operation
libgraph copied to clipboard

get_shortest_path doesn't work correctly on undirected graphs

Open liveforeverx opened this issue 5 years ago • 3 comments

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.

liveforeverx avatar Jan 29 '20 18:01 liveforeverx

This seems to be a general problem, see issue #11 .

slemonide avatar May 06 '20 11:05 slemonide

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.

bitwalker avatar May 18 '20 14:05 bitwalker

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 ?

Minh-Khang avatar Oct 11 '20 10:10 Minh-Khang