Unrecognized function or variable 'graphconncomp'.
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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).
Antworten (1)
Walter Roberson
am 23 Jul. 2024
Apparently it was in the Bioinformatics toolbox.
5 Kommentare
Steven Lord
am 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')
Siehe auch
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
