F1201_lecture1_gcc

easy
1.You will be given an graph represented in form of ArrayList<ArrayList<edge>>, where edge is a user defined class  (a type) which contains three Integer data members:
	1st : v1 (denotes) vertex1.
	2nd : v2 (denotes) vertex2.
	3rd : wt (denotes the weight of edge b/w v1 and v2).
	(we have constructed this representation of graph in 1st question)
	
2. Given a graph , find GCC in the given graph.
3.In graph, a component, sometimes called a connected component, of a Bidirectional graph is a subgraph in which any two vertices are connected to each other by edge,
 and which is connected to no additional vertices in the supergraph. You have to find the total number of connected components in the graph.

Input Format

graph given

Output Format

print all connected components

Constraints

.

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

        
Output
[0, 3, 1, 2, 4, 5, 6]
Previous
F1201-lecture2-190320-dijkstra
Next
Prim's Minimum Spanning Tree (mst).

Related Questions