How to use splitapply/findgroups on clustered/non-sequential graphs
Ältere Kommentare anzeigen
I implemented the splitapply function on a graph that has non-sequential clusters. The index numbers of the returned clusters were sequentially numbered but the graph vertices are not sequentially numbered. I want it to return the exact node indices from the original graph.
% The actual results: clusters: [1,2,3];[4,5,6]
% The expected results: clusters: [1,2,3];[6,8,9]
G = graph([1 1 2 6 6 8],[2 3 3 8 9 9]);
plot(G)
bins=conncomp(G);
clusters = splitapply(@(x) {x}, 1:numnodes(G), bins);

Antworten (0)
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!