Finding connected components of adjacency matrix graph
You need to allocate marks – int array of length n, where n is the number of vertex in graph and fill it with zeros. Then: 1) For BFS do the following: Components = 0; Enumerate all vertices, if for vertex number i, marks[i] == 0 then ++Components; Put this vertex into queue, and while … Read more