Challenge: Check if Removing Edge Creates Components in Graph
Given a graph and an edge, check whether removing that edge creates components in the graph.
We'll cover the following
Problem Statement #
Implement a function which takes a source and a destination as arguments and checks whether deleting it will create separate components in the graph.
Input #
A graph, a source (integer), and a destination (integer)
Output #
true
or false
(a boolean variable) confirming whether separate components will be created or not
Sample Input #
graph { 0 -> 1
0 -> 2
2 -> 3
2 -> 4
4 -> 0}
source = 0 destination = 1
Sample Output #
true
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.