Unrecognized function or variable 'graphconncomp'.
显示 更早的评论
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 个)
Walter Roberson
2024-7-23
0 个投票
Apparently it was in the Bioinformatics toolbox.
5 个评论
Mihai Mehedint
2024-7-23
Steven Lord
2024-7-23
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
2024-7-23
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
2024-7-23
类别
在 帮助中心 和 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!
