Challenge: Remove 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.

Input

A directed graph, a source (integer), and a destination (integer).

Output

A directed graph with the edge between the source and the destination removed.

Sample input

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

Sample output

remove_edge(graph, 2, 3)
Vertex Edges
0 1, 2
1 3
2 4
3 None
4 0

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