Find connected components in a graph in MATLAB

孤街醉人 提交于 2019-12-22 13:47:46

问题


I have many 3D data points, and I wish to find 'connected components' in this graph. This is where clusters are formed that exhibit the following properties:

  • Each cluster contains points all of which are at most distance from another point in the cluster.
  • All points in two distinct clusters are at least distance from each other.

This problem is described in the question and answer here.

Is there a MATLAB implementation of such an algorithm built-in or available on the FEX? Simple searches have not thrown up anything useful.


回答1:


Perhaps a density-based clustering algorithm can be applied in this case. See this related question for a description of the DBscan algorithm.




回答2:


I do not think that it is possible to satisfy both conditions in all cases.

If you decide to concentrate on the first condition, you can use Complete-Linkage hierarichical clustering, in which points or groups of points are merged based on the maximum distance between any two points. In Matlab, this is implemented in CLUSTERDATA (see help for the individual function steps).

To calculateyour cluster indices, you'd run

clusterIndex = clusterdata(coordiantes,maxDistance,'criterion','distance','linkage','complete','distance','euclidean')

In case you then want to simply eliminate points of different clusters that are less than minDistance apart, you can run pdist between clusters to clean up your connected components.




回答3:


k-means or k-medoid algorithm may be useful in this case.



来源:https://stackoverflow.com/questions/4567515/find-connected-components-in-a-graph-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!