Challenge: Print the Transpose of a Graph
Given a graph, find its transpose.
We'll cover the following
Problem Statement
You have to implement a function which will take a graph as input and print its transpose.
Input
A graph.
Output
Transpose of a graph.
Sample Input
graph = {
0 -> 1
1 -> 2
2 -> 3
3 -> 0
2 -> 4
4 -> 2
}
Sample Output
0-->3
1-->0
2-->1 4
3-->2
4-->2
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.