Open D4L opened 11 years ago
Implement the ability to find the shortest path
Assume graph is K3 ( { v1, v2, v4 }, { edges formed with sum (e##) } ) with non-connected v3
graph
graph.path_exist? "v1", "v2" # true graph.path "v1", "v2" # ["v1", "v2"] ordered array graph.path_exist? "v1", "v3" # false graph.delete_edge! "e3" # graph graph.path" v1", "v2" # ["v1", "v4", "v2"]
Path Operations
Task
Implement the ability to find the shortest path
Content
Example
Assume
graph
is K3 ( { v1, v2, v4 }, { edges formed with sum (e##) } ) with non-connected v3