Finding Connected Component in the graph.
조회 수: 15 (최근 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!