How to use splitapply/findgroups on clustered/non-sequential graphs
显示 更早的评论
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);

回答(0 个)
类别
在 帮助中心 和 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!