Finding all disconnected subgraphs in a graph

后端 未结 7 2228
长发绾君心
长发绾君心 2020-12-07 22:57

I have a graph which contains an unknown number of disconnected subgraphs. What\'s a good algorithm (or Java library) to find them all?

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 22:58

    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.

提交回复
热议问题