Challenge: Remove an Edge

In this challenge, we will learn how to delete an edge between two vertices.

Problem statement

You must implement the remove_edge function which takes a source and a destination as arguments. If an edge exists between the two, it should be deleted. Print the breadth-first traversal on the resultant graph.

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:

Vertex Edges
0 1, 2
1 3
2 4
3 None
4 None

Sample output

Vertex Edges
0 1
1 3
2 4
3 None
4 0

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.