Finding Connected Component in the graph.
11 次查看(过去 30 天)
显示 更早的评论
I have following two questions.
(1) How to find number of connected components in a graph in MATLAB?
(2) How to find the numbers of nodes in the largest connected component in MATLAB?
0 个评论
回答(1 个)
Clayton Gotberg
2021-4-24
Have you looked at the functions available for graphs (see the 'Object Functions' section) in MATLAB? It appears that conncomp will do exactly what you're looking for.
G = graph(); % put your graph here
[bins,binsizes] = conncomp(G); % Find the connected components in G and find the number
% of nodes in each connected component
% binsizes = number of nodes in each connected component
% bins = vector explaining which bin each node goes into
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!