I have a graph which contains an unknown number of disconnected subgraphs. What\'s a good algorithm (or Java library) to find them all?
I ran into a similar problem where I wanted all the weakly connected subgraphs of a directed graph. I blogged about it here. I used the JUNG API and compare two approaches. My first approach could be used as a template to solve your problem.