Challenge 9: Remove Edge

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

Problem statement

You must implement the removeEdge function, which takes a source and a destination as arguments. If an edge exists between the two, it should be deleted.

Input

The input is a graph, a source (integer), and a destination (integer).

Output

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

Sample input

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

Sample output

removeEdge(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.