Finding all disconnected subgraphs in a graph

后端 未结 7 2194
长发绾君心
长发绾君心 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 23:20

    I'm assuming you want to find all the (strongly) connected components? For that you can use Tarjan's algorithm (a variant of DFS)

    0 讨论(0)
提交回复
热议问题