Skip to content

Shortest path operation #10

@D4L

Description

@D4L

Path Operations

Task

Implement the ability to find the shortest path

Content
  • Finding the shortest path between two vertices
  • Checking if a path between two vertices exists
Example

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions