Challenge: Remove an Edge
Solve the challenge of deleting an edge between two vertices in a directed graph.
We'll cover the following
Problem statement
Implement the RemoveEdge
method, which takes a graph, a source vertice, and a destination vertice as arguments. If both vertices exist in the graph and an edge exists between them, the edge should be deleted.
Input
A graph, a source (integer), and a destination (integer).
Output
A BFS traversal of the graph with the edge between the source and the destination removed.
Sample input
Directed graph:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.