D4L / abstractGraph

MIT License
2 stars 0 forks source link

Shortest path operation #10

Open D4L opened 11 years ago

D4L commented 11 years ago

Path Operations

Task

Implement the ability to find the shortest path

Content

Assume graph is K3 ( { v1, v2, v4 }, { edges formed with sum (e##) } ) with non-connected v3

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"]