Unrecognized function or variable 'graphconncomp'.
Show older comments
The original code is this. I cannot find the addon containing the graphconncomp function. Error in moseg.MosegAlgAffBase/evalsplit2 (line 389) The line of code accessing it is:
% First find connected components
[S,C] = graphconncomp(Wceps);
There is a potential alternative using the GPToolBox . However when using this function I get a different error:
Incorrect number or types of inputs or outputs for function conncomp.
Error in moseg.MosegAlgAffBase/evalsplit2 (line 413)
[S,C] = conncomp(Wceps);
If there a distribuion of Matlab I should use, or a specific package? (I used AddOn package search also).
1 Comment
Mihai Mehedint
on 23 Jul 2024
Answers (1)
Walter Roberson
on 23 Jul 2024
0 votes
Apparently it was in the Bioinformatics toolbox.
5 Comments
Mihai Mehedint
on 23 Jul 2024
Steven Lord
on 23 Jul 2024
The biograph object and its methods were removed from Bioinformatics Toolbox in release R2022b according to the Release Notes. Replace your usage of that object and those methods with uses of the graph and/or digraph objects and their methods.
Mihai Mehedint
on 23 Jul 2024
Looking at the documentation for graphconncomp, it states that the outputs are the number of components found and a vector indicating to which component each node belongs:
The number of components found is returned in S, and C is a vector indicating to which component each node belongs.
Looking at the conncomp documentation, the first output bins contains information about which component contains each node and the second is the sizes of the components. It doesn't directly return the number of connected components.
Therefore the first output of conncomp is (with the default value for the OutputForm name-value argument) is the equivalent of the second output of graphconncomp. The number of elements in the second output of conncomp or the maximum value in the first output are the equivalent of the first output of graphconncomp.
But if you're just looking for which nodes are part of which components, you don't need to manually generate that list. If you specify 'cell' as the OutputForm, the first output of conncomp changes. In that case "bins is a cell array, and bins{j} contains the node IDs for all nodes that belong to component j." I think that's exactly what you're creating as your ix2 variable.
rng default
randomDigraph = graph(rand(10) < 0.125, 'upper')
plot(randomDigraph)
[connectedComponentVector, sizesOfComponents] = conncomp(randomDigraph)
numberOfConnectedComponents1 = numel(sizesOfComponents) % or
numberOfConnectedComponents2 = max(connectedComponentVector)
connectedComponentCells = conncomp(randomDigraph, 'OutputForm', 'cell')
Mihai Mehedint
on 23 Jul 2024
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!