我有一个图,结构是:
struct graph{ vector<edge> edges; vector<vertex> vertex; }
大概就是这样的一个结构吧,就是分别用向量存了边和点,点的数据结构里面有存储和它相连的所有的边的信息。要找出最大联通子图应该怎么找啊?
小伙看你根骨奇佳,潜力无限,来学PHP伐。
Traverse all points
For each point, if it has not been visited, do BFS, mark the points passed on the way as visited, and record the number of points n
Find max(n)
Traverse all points
For each point, if it has not been visited, do BFS, mark the points passed on the way as visited, and record the number of points n
Find max(n)