Connected components in a graph
3 次查看(过去 30 天)
显示 更早的评论
M=[1 2;2 5;3 4;4 6;6 7;6 8;6 9;6 10];
G=graph(M(:,1),M(:,2))
[bins,binsizes]=conncomp(G);
When I use the built in function conncomp, MATLAB always assumes that first component of graph G is the one which node 1 belongs to.
The output bins in the given example is:
bins=[1 1 2 2 1 2 2 2 2 2] How can I make the first component of my graph is where node 6 (for example) belongs to?
Your help would be appreciated.
Thanks!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 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!