This function find the largest connected component of a networks.
Input A is the adjacency matrix of the network.
Output B is a list of the nodes that are in the largest component.
A(B,B) will give the adj. matrix of the largest component.
Used on Octave, works as advertised.
It would be nice if you commented the code, so that the procedure would be more comprehensible.
You are right. Thank you!
There is a bug in this script. It fails when there are several largest connected components of the same size, because now cm is a vector.
If you only need to find any one of them, than it should be:
Otherwise, a loop is needed to print out all the largest components.
Fixed bug about multiple largest components.
Made the code faster by not using the 'find' function.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.