1.You are given a Integer value n which tells the number of vertices in the graph.
2.You are given an Integer value e which tells the number of edges the graph have and then you will be given the data of e edges,in which first value will be vertex1,
second value will be vertex2 and third value will be weight of edges.
3.You have to complete the function main , construct and display.
4. Your display function must display it in the form explained below:
For each vertex you have to print vertex number first which is followed by an arrow sign (->) and then you have to print its neighbours along with their weight.
Look at the sample output below for reference.
Input Format
1.First line consist of two integer values n (number of vertices) and e (number of edges) . 2.Next e lines will contain of 3 inputs each line: 1st input -> vertex1 , 2nd input -> vertex2 and 3rd input -> weight of edge b/w vertex1 and vertex2.
Output Format
void
Constraints
1<=n<=10 0<=e< n^2
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
7 8 0 3 40 1 0 10 2 1 10 3 2 10 4 3 2 5 4 3 6 5 3 6 4 8
Output
0 -> (3,40), (1,10), 1 -> (0,10), (2,10), 2 -> (1,10), (3,10), 3 -> (0,40), (2,10), (4,2), 4 -> (3,2), (5,3), (6,8), 5 -> (4,3), (6,3), 6 -> (5,3), (4,8),